PoDoFo 1.2.0
Loading...
Searching...
No Matches
OutputStream.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_OUTPUT_STREAM_H
6#define AUX_OUTPUT_STREAM_H
7
8#include "basedefs.h"
9
10namespace PoDoFo {
11
14class PODOFO_API OutputStream
15{
16public:
18 virtual ~OutputStream();
19
23 void Write(char ch);
24
28 void Write(const std::string_view& view);
29
34 void Write(const char* buffer, size_t size);
35
36 void Flush();
37
38protected:
41 static void WriteBuffer(OutputStream& stream, const char* buffer, size_t size);
42 static void Flush(OutputStream& stream);
43
44protected:
45 virtual void writeBuffer(const char* buffer, size_t size) = 0;
46 virtual void flush();
47
50 virtual void checkWrite() const;
51
55 void enableWriteWindow(char* cur, char* end);
56
60 void disableWriteWindow();
61
62protected:
75 char* m_wcur;
76 char* m_wend;
77
78private:
81 void writeSlowPath(const char* buffer, size_t size);
82
83private:
84 OutputStream(const OutputStream&) = delete;
85 OutputStream& operator=(const OutputStream&) = delete;
86};
87
88};
89
90#endif // AUX_OUTPUT_STREAM_H
An interface for writing blocks of data to a data source.
Definition OutputStream.h:15
char * m_wcur
Inline write window over memory owned by the implementation, mirroring InputStream's read window.
Definition OutputStream.h:75
void Write(const std::string_view &view)
Write the view to the OutputStream.
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