CppCommon  1.0.4.1
C++ Common Library
writer.h
Go to the documentation of this file.
1 
9 #ifndef CPPCOMMON_WRITER_H
10 #define CPPCOMMON_WRITER_H
11 
12 #include <string>
13 #include <vector>
14 
15 namespace CppCommon {
16 
18 
22 class Writer
23 {
24 public:
25  Writer() noexcept = default;
26  Writer(const Writer&) noexcept = default;
27  Writer(Writer&&) noexcept = default;
28  virtual ~Writer() noexcept = default;
29 
30  Writer& operator=(const Writer&) noexcept = default;
31  Writer& operator=(Writer&&) noexcept = default;
32 
34 
39  virtual size_t Write(const void* buffer, size_t size) = 0;
40 
42 
46  size_t Write(const std::string& text);
48 
52  size_t Write(const std::vector<std::string>& lines);
53 
55  virtual void Flush() {}
56 };
57 
58 } // namespace CppCommon
59 
60 #endif // CPPCOMMON_WRITER_H
Writer interface.
Definition: writer.h:23
virtual size_t Write(const void *buffer, size_t size)=0
Write a byte buffer base method.
Writer() noexcept=default
virtual void Flush()
Flush the writer.
Definition: writer.h:55
C++ Common project definitions.
Definition: token_bucket.h:15