Panda3D
|
A StreamWriter object is used to write sequential binary data directly to an ostream. More...
#include "streamWriter.h"
Public Member Functions | |
StreamWriter (const StreamWriter ©) | |
The copy constructor does not copy ownership of the stream. More... | |
StreamWriter (std::ostream &out) | |
StreamWriter (std::ostream *out, bool owns_stream) | |
void | add_be_float32 (float value) |
Adds a 32-bit single-precision big-endian floating-point number to the stream. More... | |
void | add_be_float64 (PN_float64 value) |
Adds a 64-bit big-endian floating-point number to the streamWriter. More... | |
void | add_be_int16 (int16_t value) |
Adds a signed 16-bit big-endian integer to the streamWriter. More... | |
void | add_be_int32 (int32_t value) |
Adds a signed 32-bit big-endian integer to the streamWriter. More... | |
void | add_be_int64 (int64_t value) |
Adds a signed 64-bit big-endian integer to the streamWriter. More... | |
void | add_be_uint16 (uint16_t value) |
Adds an unsigned 16-bit big-endian integer to the streamWriter. More... | |
void | add_be_uint32 (uint32_t value) |
Adds an unsigned 32-bit big-endian integer to the streamWriter. More... | |
void | add_be_uint64 (uint64_t value) |
Adds an unsigned 64-bit big-endian integer to the streamWriter. More... | |
void | add_bool (bool value) |
Adds a boolean value to the stream. More... | |
void | add_fixed_string (const std::string &str, size_t size) |
Adds a fixed-length string to the stream. More... | |
void | add_float32 (float value) |
Adds a 32-bit single-precision floating-point number to the stream. More... | |
void | add_float64 (PN_float64 value) |
Adds a 64-bit floating-point number to the stream. More... | |
void | add_int16 (int16_t value) |
Adds a signed 16-bit integer to the stream. More... | |
void | add_int32 (int32_t value) |
Adds a signed 32-bit integer to the stream. More... | |
void | add_int64 (int64_t value) |
Adds a signed 64-bit integer to the stream. More... | |
void | add_int8 (int8_t value) |
Adds a signed 8-bit integer to the stream. More... | |
void | add_string (const std::string &str) |
Adds a variable-length string to the stream. More... | |
void | add_string32 (const std::string &str) |
Adds a variable-length string to the stream, using a 32-bit length field. More... | |
void | add_uint16 (uint16_t value) |
Adds an unsigned 16-bit integer to the stream. More... | |
void | add_uint32 (uint32_t value) |
Adds an unsigned 32-bit integer to the stream. More... | |
void | add_uint64 (uint64_t value) |
Adds an unsigned 64-bit integer to the stream. More... | |
void | add_uint8 (uint8_t value) |
Adds an unsigned 8-bit integer to the stream. More... | |
void | add_z_string (std::string str) |
Adds a variable-length string to the stream, as a NULL-terminated string. More... | |
void | append_data (const std::string &data) |
Appends some more raw data to the end of the streamWriter. More... | |
void | append_data (const void *data, size_t size) |
Appends some more raw data to the end of the streamWriter. More... | |
void | flush () |
Calls flush() on the underlying stream. More... | |
std::ostream * | get_ostream () const |
void | operator= (const StreamWriter ©) |
The copy constructor does not copy ownership of the stream. More... | |
void | pad_bytes (size_t size) |
Adds the indicated number of zero bytes to the stream. More... | |
void | write (const std::string &str) |
A synonym of append_data(). More... | |
Public Attributes | |
get_ostream | |
Returns the stream in use. More... | |
A StreamWriter object is used to write sequential binary data directly to an ostream.
Its interface is very similar to Datagram by design; it's primarily intended as a convenience to eliminate the overhead of writing bytes to a Datagram and then writing the Datagram to a stream.
Definition at line 29 of file streamWriter.h.
|
inline |
The copy constructor does not copy ownership of the stream.
Definition at line 43 of file streamWriter.I.
|
inline |
Adds a 32-bit single-precision big-endian floating-point number to the stream.
Since this kind of float is not necessarily portable across different architectures, special care is required.
Definition at line 244 of file streamWriter.I.
|
inline |
Adds a 64-bit big-endian floating-point number to the streamWriter.
Definition at line 257 of file streamWriter.I.
|
inline |
Adds a signed 16-bit big-endian integer to the streamWriter.
Definition at line 188 of file streamWriter.I.
|
inline |
Adds a signed 32-bit big-endian integer to the streamWriter.
Definition at line 197 of file streamWriter.I.
|
inline |
Adds a signed 64-bit big-endian integer to the streamWriter.
Definition at line 206 of file streamWriter.I.
|
inline |
Adds an unsigned 16-bit big-endian integer to the streamWriter.
Definition at line 215 of file streamWriter.I.
|
inline |
Adds an unsigned 32-bit big-endian integer to the streamWriter.
Definition at line 224 of file streamWriter.I.
Referenced by HashVal::output_binary().
|
inline |
Adds an unsigned 64-bit big-endian integer to the streamWriter.
Definition at line 233 of file streamWriter.I.
|
inline |
Adds a boolean value to the stream.
Definition at line 86 of file streamWriter.I.
|
inline |
Adds a fixed-length string to the stream.
If the string given is less than the requested size, this will pad the string out with zeroes; if it is greater than the requested size, this will silently truncate the string.
Definition at line 310 of file streamWriter.I.
|
inline |
Adds a 32-bit single-precision floating-point number to the stream.
Since this kind of float is not necessarily portable across different architectures, special care is required.
Definition at line 166 of file streamWriter.I.
|
inline |
Adds a 64-bit floating-point number to the stream.
Definition at line 179 of file streamWriter.I.
|
inline |
Adds a signed 16-bit integer to the stream.
Definition at line 110 of file streamWriter.I.
|
inline |
Adds a signed 32-bit integer to the stream.
Definition at line 119 of file streamWriter.I.
Referenced by DownloadDb::Db::write_bogus_header().
|
inline |
Adds a signed 64-bit integer to the stream.
Definition at line 128 of file streamWriter.I.
|
inline |
Adds a signed 8-bit integer to the stream.
Definition at line 94 of file streamWriter.I.
|
inline |
Adds a variable-length string to the stream.
This actually adds a count followed by n bytes.
Definition at line 267 of file streamWriter.I.
|
inline |
Adds a variable-length string to the stream, using a 32-bit length field.
Definition at line 282 of file streamWriter.I.
|
inline |
Adds an unsigned 16-bit integer to the stream.
Definition at line 137 of file streamWriter.I.
|
inline |
Adds an unsigned 32-bit integer to the stream.
Definition at line 146 of file streamWriter.I.
Referenced by DownloadDb::Db::write_bogus_header().
|
inline |
Adds an unsigned 64-bit integer to the stream.
Definition at line 155 of file streamWriter.I.
|
inline |
Adds an unsigned 8-bit integer to the stream.
Definition at line 102 of file streamWriter.I.
|
inline |
Adds a variable-length string to the stream, as a NULL-terminated string.
Definition at line 294 of file streamWriter.I.
|
inline |
Appends some more raw data to the end of the streamWriter.
Definition at line 332 of file streamWriter.I.
|
inline |
Appends some more raw data to the end of the streamWriter.
Definition at line 324 of file streamWriter.I.
|
inline |
Calls flush() on the underlying stream.
Definition at line 340 of file streamWriter.I.
|
inline |
The copy constructor does not copy ownership of the stream.
Definition at line 56 of file streamWriter.I.
void StreamWriter::pad_bytes | ( | size_t | size | ) |
Adds the indicated number of zero bytes to the stream.
Definition at line 19 of file streamWriter.cxx.
|
inline |
A synonym of append_data().
This is useful when assigning the StreamWriter to sys.stderr and/or sys.stdout in Python.
Definition at line 349 of file streamWriter.I.
|
inline |
Returns the stream in use.
Definition at line 39 of file streamWriter.h.