libcommonc++  0.7
DataWriter.h++
Go to the documentation of this file.
1 /* ---------------------------------------------------------------------------
2  commonc++ - A C++ Common Class Library
3  Copyright (C) 2005-2014 Mark A Lindner
4 
5  This file is part of commonc++.
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public
18  License along with this library; if not, write to the Free
19  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  ---------------------------------------------------------------------------
21 */
22 
23 #ifndef __ccxx_DataWriter_hxx
24 #define __ccxx_DataWriter_hxx
25 
27 #include <commonc++/String.h++>
28 
29 namespace ccxx {
30 
31 class Blob;
32 
41 {
42  public:
43 
45  virtual ~DataWriter();
46 
47  virtual void skip(size_t count) = 0;
48 
57  virtual void skip(size_t count, byte_t fillByte) = 0;
58 
65  virtual void flush() = 0;
66 
72  DataWriter& operator<<(bool v);
73 
80 
86  DataWriter& operator<<(const byte_t* v);
87 
93  DataWriter& operator<<(char v);
94 
100  DataWriter& operator<<(const char* v);
101 
107  DataWriter& operator<<(int16_t v);
108 
114  DataWriter& operator<<(const int16_t* v);
115 
121  DataWriter& operator<<(uint16_t v);
122 
128  DataWriter& operator<<(const uint16_t* v);
129 
135  DataWriter& operator<<(int32_t v);
136 
142  DataWriter& operator<<(const int32_t* v);
143 
149  DataWriter& operator<<(uint32_t v);
150 
156  DataWriter& operator<<(const uint32_t* v);
157 
163  DataWriter& operator<<(const int64_t& v);
164 
170  DataWriter& operator<<(const int64_t* v);
171 
177  DataWriter& operator<<(const uint64_t& v);
178 
184  DataWriter& operator<<(const uint64_t* v);
185 
191  DataWriter& operator<<(float v);
192 
198  DataWriter& operator<<(const float* v);
199 
205  DataWriter& operator<<(const double& v);
206 
212  DataWriter& operator<<(const double* v);
213 
219  DataWriter& operator<<(const Blob& v);
220 
226  DataWriter& operator<<(const String& v);
227 
233  DataWriter& operator<<(const Manipulator& manip);
234 
235  protected:
236 
238  DataWriter();
239 
245  virtual size_t write(const byte_t *buf, size_t count) = 0;
246 
247  private:
248 
250 };
251 
252 } // namespace ccxx
253 
254 #endif // __ccxx_DataWriter_hxx
A base class for DataEncoder manipulators.
Definition: DataEncoder.h++:115
std::ostream & operator<<(std::ostream &stream, const BitSet &bs)
Definition: BitSet.h++:383
#define COMMONCPP_API
Definition: Common.h++:126
A reference-counting, copy-on-write, threadsafe container for arbitrary binary data.
Definition: Blob.h++:45
A flexible, reference counted, copy-on-write, thread-safe, nullable string.
Definition: String.h++:50
#define CCXX_COPY_DECLS(CLASS)
Inlines declarations of a copy constructor and assignment operator for the class CLASS.
Definition: Common.h++:295
An abstract base class for data writers.
Definition: DataWriter.h++:40
Definition: AllocationMap.c++:25
An abstract class with basic functionality that is common to all data decoders (readers) and data enc...
Definition: DataEncoder.h++:74
unsigned char byte_t
An unsigned 8-bit value.
Definition: Integers.h++:68