22 StreamWriter(ostream &out) :
34 StreamWriter(ostream *out,
bool owns_stream) :
36 _owns_stream(owns_stream)
199 nassertv(
sizeof(value) == 4);
300 nassertv(
sizeof(value) == 4);
326 nassertv(str.length() <= (PN_uint16)0xffff);
359 size_t null_pos = str.find(
'\0');
378 if (str.length() < size) {
395 _out->write((
const char *)data, size);
A StreamWriter object is used to write sequential binary data directly to an ostream.
void add_float32(float value)
Adds a 32-bit single-precision floating-point number to the stream.
void append_data(const void *data, size_t size)
Appends some more raw data to the end of the streamWriter.
void add_be_uint64(PN_uint64 value)
Adds an unsigned 64-bit big-endian integer to the streamWriter.
void add_be_uint16(PN_uint16 value)
Adds an unsigned 16-bit big-endian integer to the streamWriter.
void add_be_float64(PN_float64 value)
Adds a 64-bit big-endian floating-point number to the streamWriter.
void add_int8(PN_int8 value)
Adds a signed 8-bit integer to the stream.
void add_be_int32(PN_int32 value)
Adds a signed 32-bit big-endian integer to the streamWriter.
void add_int64(PN_int64 value)
Adds a signed 64-bit integer to the stream.
void add_z_string(string str)
Adds a variable-length string to the stream, as a NULL-terminated string.
const void * get_data() const
Returns the pointer to the first byte of the data, either reversed or nonreversed, as appropriate.
void operator=(const StreamWriter ©)
The copy constructor does not copy ownership of the stream.
void add_be_int16(PN_int16 value)
Adds a signed 16-bit big-endian integer to the streamWriter.
void add_uint8(PN_uint8 value)
Adds an unsigned 8-bit integer to the stream.
void add_uint16(PN_uint16 value)
Adds an unsigned 16-bit integer to the stream.
void add_be_int64(PN_int64 value)
Adds a signed 64-bit big-endian integer to the streamWriter.
void add_be_float32(float value)
Adds a 32-bit single-precision big-endian floating-point number to the stream.
void flush()
Calls flush() on the underlying stream.
void add_bool(bool value)
Adds a boolean value to the stream.
void add_int16(PN_int16 value)
Adds a signed 16-bit integer to the stream.
void add_be_uint32(PN_uint32 value)
Adds an unsigned 32-bit big-endian integer to the streamWriter.
NativeNumericData and ReversedNumericData work together to provide a sneaky interface for automatical...
void add_uint32(PN_uint32 value)
Adds an unsigned 32-bit integer to the stream.
NativeNumericData and ReversedNumericData work together to provide a sneaky interface for automatical...
void write(const string &str)
A synonym of append_data().
ostream * get_ostream() const
Returns the stream in use.
void add_string32(const string &str)
Adds a variable-length string to the stream, using a 32-bit length field.
void pad_bytes(size_t size)
Adds the indicated number of zero bytes to the stream.
void add_float64(PN_float64 value)
Adds a 64-bit floating-point number to the stream.
void add_uint64(PN_uint64 value)
Adds an unsigned 64-bit integer to the stream.
void add_int32(PN_int32 value)
Adds a signed 32-bit integer to the stream.
void add_fixed_string(const string &str, size_t size)
Adds a fixed-length string to the stream.
void add_string(const string &str)
Adds a variable-length string to the stream.
const void * get_data() const
Returns the pointer to the first byte of the data, either reversed or nonreversed, as appropriate.