PoDoFo  1.0.0-dev
OutputStream.h
1 
7 #ifndef AUX_OUTPUT_STREAM_H
8 #define AUX_OUTPUT_STREAM_H
9 
10 #include "basedefs.h"
11 
12 namespace PoDoFo {
13 
17 class PODOFO_API OutputStream
18 {
19 public:
20  OutputStream();
21  virtual ~OutputStream();
22 
27  void Write(char ch);
28 
33  void Write(const std::string_view& view);
34 
40  void Write(const char* buffer, size_t size);
41 
42  void Flush();
43 
44 protected:
45  static void WriteBuffer(OutputStream& stream, const char* buffer, size_t size);
46  static void Flush(OutputStream& stream);
47 
48 protected:
49  virtual void writeBuffer(const char* buffer, size_t size) = 0;
50  virtual void flush();
51 
55  virtual void checkWrite() const;
56 
57 private:
58  OutputStream(const OutputStream&) = delete;
59  OutputStream& operator=(const OutputStream&) = delete;
60 };
61 
62 };
63 
64 #endif // AUX_OUTPUT_STREAM_H
An interface for writing blocks of data to a data source.
Definition: OutputStream.h:18
void Write(const std::string_view &view)
Write the view to the OutputStream.
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition: basetypes.h:16