PoDoFo 1.2.0
Loading...
Searching...
No Matches
InputStream.h
1// SPDX-FileCopyrightText: 2007 Dominik Seichter <domseichter@web.de>
2// SPDX-FileCopyrightText: 2020 Francesco Pretto <ceztko@gmail.com>
3// SPDX-License-Identifier: LGPL-2.0-or-later OR MPL-2.0
4
5#ifndef AUX_INPUT_STREAM_H
6#define AUX_INPUT_STREAM_H
7
8#include "basedefs.h"
9
10namespace PoDoFo {
11
12class OutputStream;
13
16class PODOFO_API InputStream
17{
18public:
20 virtual ~InputStream();
21
27 void Read(char* buffer, size_t size);
28
34 size_t Read(char* buffer, size_t size, bool& eof);
35
40 char ReadChar();
41
46 bool Read(char& ch);
47
51 void CopyTo(OutputStream& stream);
52
56 void CopyTo(OutputStream& stream, size_t size);
57
58protected:
59 static size_t ReadBuffer(InputStream& stream, char* buffer, size_t size, bool& eof);
60 static bool ReadChar(InputStream& stream, char& ch);
61
62protected:
66 virtual size_t readBuffer(char* buffer, size_t size, bool& eof) = 0;
67
70 virtual bool readChar(char& ch);
71
74 virtual void checkRead() const;
75
76private:
77 InputStream(const InputStream&) = delete;
78 InputStream& operator=(const InputStream&) = delete;
79};
80
81};
82
83#endif // AUX_INPUT_STREAM_H
An interface for reading blocks of data from a data source.
Definition InputStream.h:17
virtual size_t readBuffer(char *buffer, size_t size, bool &eof)=0
Read a buffer from the stream.
An interface for writing blocks of data to a data source.
Definition OutputStream.h:15
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition basetypes.h:30
All classes, functions, types and enums of PoDoFo are members of these namespace.
Definition basetypes.h:13