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:
39 static void WriteBuffer(OutputStream& stream, const char* buffer, size_t size);
40 static void Flush(OutputStream& stream);
41
42protected:
43 virtual void writeBuffer(const char* buffer, size_t size) = 0;
44 virtual void flush();
45
48 virtual void checkWrite() const;
49
50private:
51 OutputStream(const OutputStream&) = delete;
52 OutputStream& operator=(const OutputStream&) = delete;
53};
54
55};
56
57#endif // AUX_OUTPUT_STREAM_H
An interface for writing blocks of data to a data source.
Definition OutputStream.h:15
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