PoDoFo 1.0.0-dev
Loading...
Searching...
No Matches
InputStream.h
1
7#ifndef AUX_INPUT_STREAM_H
8#define AUX_INPUT_STREAM_H
9
10#include "basedefs.h"
11
12namespace PoDoFo {
13
14class OutputStream;
15
19class PODOFO_API InputStream
20{
21public:
23 virtual ~InputStream();
24
31 void Read(char* buffer, size_t size);
32
39 size_t Read(char* buffer, size_t size, bool& eof);
40
46 char ReadChar();
47
53 bool Read(char& ch);
54
60 void CopyTo(OutputStream& stream);
61
67 void CopyTo(OutputStream& stream, size_t size);
68
69protected:
70 static size_t ReadBuffer(InputStream& stream, char* buffer, size_t size, bool& eof);
71 static bool ReadChar(InputStream& stream, char& ch);
72
73protected:
78 virtual size_t readBuffer(char* buffer, size_t size, bool& eof) = 0;
79
83 virtual bool readChar(char& ch);
84
88 virtual void checkRead() const;
89
90private:
91 InputStream(const InputStream&) = delete;
92 InputStream& operator=(const InputStream&) = delete;
93};
94
95};
96
97#endif // AUX_INPUT_STREAM_H
An interface for reading blocks of data from a data source.
Definition InputStream.h:20
virtual size_t readBuffer(char *buffer, size_t size, bool &eof)=0
Read a buffer from the stream /param eof true if the stream reached eof during read /returns number o...
An interface for writing blocks of data to a data source.
Definition OutputStream.h:18
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition basetypes.h:38
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition basetypes.h:16