#include <streamReader.h>
Public Member Functions | |
StreamReader (istream &in) | |
StreamReader (istream *in, bool owns_stream) | |
If owns_stream is true, the stream pointer will be deleted when the StreamReader destructs. | |
StreamReader (const StreamReader ©) | |
The copy constructor does not copy ownership of the stream. | |
void | operator= (const StreamReader ©) |
The copy constructor does not copy ownership of the stream. | |
~StreamReader () | |
istream * | get_istream () const |
Returns the stream in use. | |
bool | get_bool () |
Extracts a boolean value. | |
PN_int8 | get_int8 () |
Extracts a signed 8-bit integer. | |
PN_uint8 | get_uint8 () |
Extracts an unsigned 8-bit integer. | |
PN_int16 | get_int16 () |
Extracts a signed 16-bit integer. | |
PN_int32 | get_int32 () |
Extracts a signed 32-bit integer. | |
PN_int64 | get_int64 () |
Extracts a signed 64-bit integer. | |
PN_uint16 | get_uint16 () |
Extracts an unsigned 16-bit integer. | |
PN_uint32 | get_uint32 () |
Extracts an unsigned 32-bit integer. | |
PN_uint64 | get_uint64 () |
Extracts an unsigned 64-bit integer. | |
float | get_float32 () |
Extracts a 32-bit single-precision floating-point number. | |
PN_float64 | get_float64 () |
Extracts a 64-bit floating-point number. | |
PN_int16 | get_be_int16 () |
Extracts a signed big-endian 16-bit integer. | |
PN_int32 | get_be_int32 () |
Extracts a signed big-endian 32-bit integer. | |
PN_int64 | get_be_int64 () |
Extracts a signed big-endian 64-bit integer. | |
PN_uint16 | get_be_uint16 () |
Extracts an unsigned big-endian 16-bit integer. | |
PN_uint32 | get_be_uint32 () |
Extracts an unsigned big-endian 32-bit integer. | |
PN_uint64 | get_be_uint64 () |
Extracts an unsigned big-endian 64-bit integer. | |
float | get_be_float32 () |
Extracts a 32-bit single-precision big-endian floating-point number. | |
PN_float64 | get_be_float64 () |
Extracts a 64-bit big-endian floating-point number. | |
string | get_string () |
Extracts a variable-length string. | |
string | get_z_string () |
Extracts a variable-length string, as a NULL-terminated string. | |
string | get_fixed_string (size_t size) |
Extracts a fixed-length string. | |
void | skip_bytes (size_t size) |
Skips over the indicated number of bytes in the stream. | |
string | extract_bytes (size_t size) |
Extracts the indicated number of bytes in the stream and returns them as a string. | |
string | readline () |
Assumes the stream represents a text file, and extracts one line up to and including the trailing newline character. | |
Private Attributes | |
istream * | _in |
bool | _owns_stream |
Its interface is similar to DatagramIterator by design; see also StreamWriter.
Definition at line 42 of file streamReader.h.
|
Definition at line 31 of file streamReader.I. References INLINE. |
|
If owns_stream is true, the stream pointer will be deleted when the StreamReader destructs.
Definition at line 48 of file streamReader.I. References INLINE. |
|
The copy constructor does not copy ownership of the stream.
Definition at line 65 of file streamReader.I. References _in, and _owns_stream. |
|
Definition at line 95 of file streamReader.I. References get_uint8(), and INLINE. |
|
Extracts the indicated number of bytes in the stream and returns them as a string.
Definition at line 129 of file streamReader.cxx. References _in. |
|
Extracts a 32-bit single-precision big-endian floating-point number. Since this kind of float is not necessarily portable across different architectures, special care is required. Definition at line 417 of file streamReader.I. |
|
Extracts a 64-bit big-endian floating-point number.
Definition at line 439 of file streamReader.I. |
|
Extracts a signed big-endian 16-bit integer.
Definition at line 309 of file streamReader.I. |
|
Extracts a signed big-endian 32-bit integer.
Definition at line 326 of file streamReader.I. |
|
Extracts a signed big-endian 64-bit integer.
Definition at line 343 of file streamReader.I. |
|
Extracts an unsigned big-endian 16-bit integer.
Definition at line 360 of file streamReader.I. |
|
Extracts an unsigned big-endian 32-bit integer.
Definition at line 377 of file streamReader.I. |
|
Extracts an unsigned big-endian 64-bit integer.
Definition at line 394 of file streamReader.I. |
|
Extracts a boolean value.
Definition at line 123 of file streamReader.I. References _in, INLINE, PN_int16, and NativeNumericData::store_value(). |
|
Extracts a fixed-length string. However, if a zero byte occurs within the string, it marks the end of the string. Definition at line 84 of file streamReader.cxx. |
|
Extracts a 32-bit single-precision floating-point number. Since this kind of float is not necessarily portable across different architectures, special care is required. Definition at line 270 of file streamReader.I. References _in, INLINE, PN_int64, and ReversedNumericData::store_value(). |
|
Extracts a 64-bit floating-point number.
Definition at line 292 of file streamReader.I. References _in. |
|
Extracts a signed 16-bit integer.
Definition at line 162 of file streamReader.I. |
|
Extracts a signed 32-bit integer.
Definition at line 179 of file streamReader.I. References _in, INLINE, PN_uint32, and NativeNumericData::store_value(). |
|
Extracts a signed 64-bit integer.
Definition at line 196 of file streamReader.I. References _in, INLINE, PN_uint64, and NativeNumericData::store_value(). |
|
Extracts a signed 8-bit integer.
Definition at line 136 of file streamReader.I. References _in, INLINE, PN_int32, and NativeNumericData::store_value(). |
|
Returns the stream in use.
Definition at line 110 of file streamReader.I. |
|
Extracts a variable-length string.
Definition at line 34 of file streamReader.cxx. References size_t. |
|
Extracts an unsigned 16-bit integer.
Definition at line 213 of file streamReader.I. References _in, INLINE, nassertr, and NativeNumericData::store_value(). |
|
Extracts an unsigned 32-bit integer.
Definition at line 230 of file streamReader.I. References _in, INLINE, PN_float64, and NativeNumericData::store_value(). |
|
Extracts an unsigned 64-bit integer.
Definition at line 247 of file streamReader.I. References _in, INLINE, PN_int16, and ReversedNumericData::store_value(). |
|
Extracts an unsigned 8-bit integer.
Definition at line 149 of file streamReader.I. References _in, INLINE, PN_int64, and NativeNumericData::store_value(). Referenced by ~StreamReader(). |
|
Extracts a variable-length string, as a NULL-terminated string.
Definition at line 59 of file streamReader.cxx. |
|
The copy constructor does not copy ownership of the stream.
Definition at line 82 of file streamReader.I. |
|
Assumes the stream represents a text file, and extracts one line up to and including the trailing newline character. Returns empty string when the end of file is reached. The interface here is intentionally designed to be similar to that for Python's File.readline() function. Definition at line 165 of file streamReader.cxx. |
|
Skips over the indicated number of bytes in the stream.
Definition at line 108 of file streamReader.cxx. |
|
Definition at line 85 of file streamReader.h. Referenced by extract_bytes(), get_be_int32(), get_bool(), get_fixed_string(), get_float32(), get_float64(), get_int32(), get_int64(), get_int8(), get_uint16(), get_uint32(), get_uint64(), get_uint8(), operator=(), skip_bytes(), and StreamReader(). |
|
Definition at line 86 of file streamReader.h. Referenced by StreamReader(). |