libcommonc++  0.7
DataReader.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_DataReader_hxx
24 #define __ccxx_DataReader_hxx
25 
26 #include <commonc++/Blob.h++>
29 #include <commonc++/String.h++>
30 
31 namespace ccxx {
32 
41 {
42  public:
43 
45  virtual ~DataReader();
46 
52  DataReader& operator>>(bool& v);
53 
59  DataReader& operator>>(byte_t& v);
60 
66  DataReader& operator>>(byte_t* v);
67 
73  DataReader& operator>>(char& v);
74 
80  DataReader& operator>>(char* v);
81 
87  DataReader& operator>>(int16_t& v);
88 
94  DataReader& operator>>(int16_t* v);
95 
101  DataReader& operator>>(uint16_t& v);
102 
108  DataReader& operator>>(uint16_t* v);
109 
115  DataReader& operator>>(int32_t& v);
116 
122  DataReader& operator>>(int32_t* v);
123 
129  DataReader& operator>>(uint32_t& v);
130 
136  DataReader& operator>>(uint32_t* v);
137 
143  DataReader& operator>>(int64_t& v);
144 
150  DataReader& operator>>(int64_t* v);
151 
157  DataReader& operator>>(uint64_t& v);
158 
164  DataReader& operator>>(uint64_t* v);
165 
171  DataReader& operator>>(float& v);
172 
178  DataReader& operator>>(float* v);
179 
185  DataReader& operator>>(double& v);
186 
192  DataReader& operator>>(double* v);
193 
199  DataReader& operator>>(Blob& v);
200 
206  DataReader& operator>>(String& v);
207 
213  DataReader& operator>>(const Manipulator& manip);
214 
223  size_t readBytes(byte_t* buf, size_t len);
224 
232  void readFully(byte_t* buf, size_t len);
233 
234  protected:
235 
237  DataReader();
238 
247  virtual size_t read(byte_t* buf, size_t count) = 0;
248 
257  virtual void readString(String& v, uint32_t length);
258 
259  private:
260 
262 };
263 
264 } // namespace ccxx
265 
266 #endif // __ccxx_DataReader_hxx
An abstract base class for data readers.
Definition: DataReader.h++:40
A base class for DataEncoder manipulators.
Definition: DataEncoder.h++:115
#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
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