MIRA
|
Input stream adapter that can be assigned to any input stream and allows binary input using the >> stream operators. More...
#include <stream/BinaryStream.h>
Public Types | |
typedef Base::char_type | char_type |
typedef StreamUnderlay::pos_type | pos_type |
enum | fmtflags { none = 0, net = 1L << 0 } |
Public Member Functions | |
BinaryIstream (streambuffer_pointer buffer) | |
Constructor. More... | |
BinaryIstream (Base &s) | |
Constructor. More... | |
BinaryIstream (Base &s, pos_type pos) | |
Constructor specifying the stream and the current read position. More... | |
BinaryIstream & | operator>> (char *v) |
stream operator for the built-in C++ datatypes More... | |
BinaryIstream & | operator>> (std::string &v) |
BinaryIstream & | operator>> (bool &v) |
BinaryIstream & | operator>> (char &v) |
BinaryIstream & | operator>> (uint8 &v) |
BinaryIstream & | operator>> (uint16 &v) |
BinaryIstream & | operator>> (uint32 &v) |
BinaryIstream & | operator>> (uint64 &v) |
BinaryIstream & | operator>> (int8 &v) |
BinaryIstream & | operator>> (int16 &v) |
BinaryIstream & | operator>> (int32 &v) |
BinaryIstream & | operator>> (int64 &v) |
BinaryIstream & | operator>> (float &v) |
BinaryIstream & | operator>> (double &v) |
template<typename T > | |
BinaryIstream & | operator>> (Buffer< T > &v) |
BinaryIstream & | operator>> (BinaryIosBase &(*manipFn)(BinaryIosBase &)) |
This stream operator is for internal use only. More... | |
template<typename T > | |
void | read (T *data, std::size_t count) |
fmtflags | setf (fmtflags flags) |
Setting new format flags. More... | |
void | unsetf (fmtflags mask) |
Clearing format flags. More... | |
Public Attributes | |
decltype(std::declval< Base >().rdbuf()) typedef | streambuffer_pointer |
Protected Member Functions | |
template<typename T > | |
BinaryIstream & | fromBinary (T &value) |
Reads every type T from this binary stream. More... | |
BinaryIstream & | stringFromBinary (char *value) |
Special method for reading C-strings (pointer value must point to memory address with enough memory for storing the read string. More... | |
BinaryIstream & | stringFromBinary (std::string &value) |
Special method for reading STL-strings. More... | |
Protected Attributes | |
fmtflags | mFmtFlags |
Input stream adapter that can be assigned to any input stream and allows binary input using the >> stream operators.
This class can be used with different stream "underlays". The underlay provides the actual stream functionality and stores or transmits the data. Currently the binary stream comes in two flavors:
BinaryStlIstream can be used as adapter to any existing STL conform stream This class can be used as adapter to any existing STL conform stream (like file streams, string streams, zip-streams, etc). The resulting binary stream object can be used to read data from the underlying stream in binary format using the >>-operator. Additionally, there exist special manipulators to control the byte-order: 'net' will set the binary stream into network byte order (big endian) mode. Afterwards all read values are interpreted as Big Endian values. 'host' sets it into host byte order mode (the default).
Example:
BinaryBufferIstream is similar to BinaryStlIstream but reads the data from a Buffer.
Example:
typedef Base::char_type char_type |
typedef StreamUnderlay::pos_type pos_type |
|
inherited |
|
inline |
Constructor.
Constructs a BinaryIstream based on the specified stream buffer object. The stream buffer object must be specified as pointer. If you use BinaryIstream based on STL streams, then the stream buffer object must be of the type std::basic_streambuf<_CharT, _Traits> (see corresponding documentation of STL streams). If you use BinaryIstream based on BinaryBufferStreamBase, the stream buffer object must be of the type std::vector<uint8>.
|
inline |
Constructor.
The underlying input stream must be specified as parameter.
|
inline |
Constructor specifying the stream and the current read position.
|
inline |
stream operator for the built-in C++ datatypes
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
This stream operator is for internal use only.
It provides an interface for stream manipulators like net and host. The manipulators are passed as function pointers. The passed manipulator functions are then called with the binary stream object as parameter (same mechanism as ios_base with manipulators hex, oct, etc).
|
inline |
|
inlineprotected |
Reads every type T from this binary stream.
Can be used for native C++ types or POD only !
|
inlineprotected |
Special method for reading C-strings (pointer value must point to memory address with enough memory for storing the read string.
|
inlineprotected |
Special method for reading STL-strings.
Setting new format flags.
flags | Additional flags to set. |
This function sets additional flags in format control. Flags that were previously set remain set.
|
inlineinherited |
Clearing format flags.
mask | The flags to unset. |
This function clears mask in the format flags.
decltype(std::declval<Base>().rdbuf()) typedef streambuffer_pointer |
|
protectedinherited |