Public Types | |
enum | ByteOrder { BIGENDIAN, LITTLEENDIAN } |
Public Member Functions | |
NDataStream (void) | |
Constructs a NDataStream object with no Data. | |
NDataStream (const NDataStream &stream) | |
Copy constructor for NDataStream. | |
NDataStream (const char *str) | |
Copy constructor for NDataStream. | |
~NDataStream (void) | |
Destroys the NDataStream object, freeing any resource allocated. | |
void | setByteOrder (ByteOrder bo) |
Sets the bytes in which data will be serialized. | |
ByteOrder | getByteOrder (void) const |
Get the current configured byte order. | |
NDataStream & | set (const void *src, nuint32 bytes) |
Sets the stream data. | |
NDataStream & | set (const char *str) |
Sets the stream data. | |
NDataStream & | set (const NString &str) |
Sets the stream data. | |
NDataStream & | set (const nint16 val) |
Sets the stream data. | |
NDataStream & | set (const nuint16 val) |
Sets the stream data. | |
NDataStream & | set (const nint32 val) |
Sets the stream data. | |
NDataStream & | set (const nuint32 val) |
Sets the stream data. | |
NDataStream & | set (const nint64 val) |
Sets the stream data. | |
NDataStream & | set (const nuint64 val) |
Sets the stream data. | |
NDataStream & | append (const char *str) |
Appends data to the stream. | |
NDataStream & | append (const NString &str) |
Sets the stream data. | |
NDataStream & | append (const void *src, nuint32 bytes) |
Appends data to the stream. | |
NDataStream & | append (const nint16 val) |
Appends data to the stream. | |
NDataStream & | append (const nuint16 val) |
Appends data to the stream. | |
NDataStream & | append (const nint32 val) |
Appends data to the stream. | |
NDataStream & | append (const nuint32 val) |
Appends data to the stream. | |
NDataStream & | append (const nint64 val) |
Appends data to the stream. | |
NDataStream & | append (const nuint64 val) |
Appends data to the stream. | |
NString | toString (void) const |
Converts the stream data to a NString object. | |
NString | toString (nuint32 size) const |
Converts the stream data to a NString object. | |
NString | toString (nuint32 start, nuint32 bytes) const |
Converts the stream data to a NString object. | |
unsigned char | toChar (void) const |
Converts the first byte of the stream data to char. | |
unsigned char | toChar (nuint32 pos) const |
Converts a byte of the stream data to char. | |
nint16 | toInt16 (void) const |
Converts the stream to a 16 bit signed integer. | |
nint32 | toInt32 (void) const |
Converts the stream to a 32 bit signed integer. | |
nint64 | toInt64 (void) const |
Converts the stream to a 64 bit signed integer. | |
bool | isNull (void) const |
Returns true if the stream is null. | |
nuint32 | size (void) const |
Returns the size of the stream. | |
const void * | data (void) const |
Returns a pointer to the data associated with the stream. | |
bool | operator== (const NDataStream &rhs) const |
Equality test. | |
bool | operator!= (const NDataStream &rhs) const |
Equality test. | |
NDataStream & | operator= (const char *str) |
Sets the stream data. | |
NDataStream & | operator= (const NString &str) |
Sets the stream data. | |
NDataStream & | operator= (const NDataStream &str) |
Sets the stream data. | |
NDataStream & | operator= (const nint16 val) |
Sets the stream data. | |
NDataStream & | operator= (const nuint16 val) |
Sets the stream data. | |
NDataStream & | operator= (const nint32 val) |
Sets the stream data. | |
NDataStream & | operator= (const nuint32 val) |
Sets the stream data. | |
NDataStream & | operator= (const nint64 val) |
Sets the stream data. | |
NDataStream & | operator= (const nuint64 val) |
Sets the stream data. | |
NDataStream & | operator+= (const char *str) |
Appends data to the stream. | |
NDataStream & | operator+= (const NString &str) |
Sets the stream data. | |
NDataStream & | operator+= (const NDataStream &str) |
Appends data to the stream. | |
NDataStream & | operator+= (const nint16 val) |
Appends data to the stream. | |
NDataStream & | operator+= (const nuint16 val) |
Appends data to the stream. | |
NDataStream & | operator+= (const nint32 val) |
Appends data to the stream. | |
NDataStream & | operator+= (const nuint32 val) |
Appends data to the stream. | |
NDataStream & | operator+= (const nint64 val) |
Appends data to the stream. | |
NDataStream & | operator+= (const nuint64 val) |
Appends data to the stream. | |
NDataStream | operator+ (const char *str) |
Appends data to the stream. | |
NDataStream | operator+ (const NString &str) |
Sets the stream data. | |
NDataStream | operator+ (const NDataStream &str) |
Appends data to the stream. | |
NDataStream | operator+ (const nint16 val) |
Appends data to the stream. | |
NDataStream | operator+ (const nuint16 val) |
Appends data to the stream. | |
NDataStream | operator+ (const nint32 val) |
Appends data to the stream. | |
NDataStream | operator+ (const nuint32 val) |
Appends data to the stream. | |
NDataStream | operator+ (const nint64 val) |
Appends data to the stream. | |
NDataStream | operator+ (const nuint64 val) |
Appends data to the stream. | |
unsigned char | operator[] (nuint32 pos) |
Converts a byte of the stream data to char. |
Definition at line 38 of file ndatastream.h.
enum ByteOrder |
Byte ordering for manipulating data
Definition at line 43 of file ndatastream.h.
NDataStream | ( | const char * | str | ) |
Copy constructor for NDataStream.
str | A pointer to a null terminated string |
Definition at line 49 of file ndatastream.cpp.
void setByteOrder | ( | NDataStream::ByteOrder | bo | ) |
Sets the bytes in which data will be serialized.
Definition at line 126 of file ndatastream.cpp.
NDataStream::ByteOrder getByteOrder | ( | void | ) | const |
Get the current configured byte order.
Definition at line 130 of file ndatastream.cpp.
NDataStream & set | ( | const void * | src, | |
nuint32 | bytes | |||
) |
Sets the stream data.
src | A pointer to a source of data | |
bytes | Size, in bytes, to be written |
Definition at line 156 of file ndatastream.cpp.
Referenced by NVtype::NVtype(), and NFile::read().
NDataStream & set | ( | const char * | str | ) |
Sets the stream data.
str | A pointer to a null terminated string |
Definition at line 135 of file ndatastream.cpp.
NDataStream & set | ( | const NString & | str | ) |
Sets the stream data.
str | A NString object |
Definition at line 151 of file ndatastream.cpp.
References NString::toChar().
NDataStream & set | ( | const nint16 | val | ) |
Sets the stream data.
val | A 16 bit integer |
Definition at line 198 of file ndatastream.cpp.
NDataStream & set | ( | const nuint16 | val | ) |
Sets the stream data.
val | A 16 bit unsigned integer |
Definition at line 203 of file ndatastream.cpp.
NDataStream & set | ( | const nint32 | val | ) |
Sets the stream data.
val | A 32 bit integer |
Definition at line 209 of file ndatastream.cpp.
NDataStream & set | ( | const nuint32 | val | ) |
Sets the stream data.
val | A 32 bit unsigned integer |
Definition at line 214 of file ndatastream.cpp.
NDataStream & set | ( | const nint64 | val | ) |
Sets the stream data.
val | A 64 bit integer |
Definition at line 219 of file ndatastream.cpp.
NDataStream & set | ( | const nuint64 | val | ) |
Sets the stream data.
val | A 64 bit unsigned integer |
Definition at line 232 of file ndatastream.cpp.
NDataStream & append | ( | const char * | str | ) |
Appends data to the stream.
str | A pointer to a null terminated string |
Definition at line 259 of file ndatastream.cpp.
Referenced by append(), operator+(), operator+=(), NTcpSocket::read(), NFile::read(), NTcpSocket::readLine(), and NFile::readLine().
NDataStream & append | ( | const NString & | str | ) |
Sets the stream data.
str | A NString object |
Definition at line 266 of file ndatastream.cpp.
References append(), and NString::toChar().
NDataStream & append | ( | const void * | src, | |
nuint32 | bytes | |||
) |
Appends data to the stream.
src | A pointer to a source of data | |
bytes | Size, in bytes, to be written |
Definition at line 245 of file ndatastream.cpp.
NDataStream & append | ( | const nint16 | val | ) |
Appends data to the stream.
val | A 16 bit integer |
Definition at line 300 of file ndatastream.cpp.
NDataStream & append | ( | const nuint16 | val | ) |
Appends data to the stream.
val | A 16 bit unsigned integer |
Definition at line 305 of file ndatastream.cpp.
NDataStream & append | ( | const nint32 | val | ) |
Appends data to the stream.
val | A 32 bit integer |
Definition at line 310 of file ndatastream.cpp.
NDataStream & append | ( | const nuint32 | val | ) |
Appends data to the stream.
val | A 32 bit unsigned integer |
Definition at line 315 of file ndatastream.cpp.
NDataStream & append | ( | const nint64 | val | ) |
Appends data to the stream.
val | A 64 bit integer |
Definition at line 320 of file ndatastream.cpp.
NDataStream & append | ( | const nuint64 | val | ) |
Appends data to the stream.
val | A 64 bit unsigned integer |
Definition at line 333 of file ndatastream.cpp.
NString toString | ( | void | ) | const |
Converts the stream data to a NString object.
Definition at line 389 of file ndatastream.cpp.
Referenced by NDataStream(), operator+(), operator+=(), operator=(), NVtype::toString(), and toString().
Converts the stream data to a NString object.
size | Size, in bytes, to be converted |
Definition at line 385 of file ndatastream.cpp.
References toString().
Converts the stream data to a NString object.
start | Position, to start the convertion | |
bytes | Size, in bytes, to be converted |
Definition at line 362 of file ndatastream.cpp.
References NException::BASE, NException::EX_OUT_OF_BOUNDS, and NString::set().
unsigned char toChar | ( | void | ) | const |
Converts the first byte of the stream data to char.
Definition at line 394 of file ndatastream.cpp.
Referenced by NVtype::toChar().
unsigned char toChar | ( | nuint32 | pos | ) | const |
Converts a byte of the stream data to char.
pos | Position of the byte to be converted |
Definition at line 398 of file ndatastream.cpp.
nint16 toInt16 | ( | void | ) | const |
Converts the stream to a 16 bit signed integer.
Definition at line 435 of file ndatastream.cpp.
nint32 toInt32 | ( | void | ) | const |
Converts the stream to a 32 bit signed integer.
Definition at line 442 of file ndatastream.cpp.
Referenced by NVtype::toInt32(), and NVtype::toUInt32().
nint64 toInt64 | ( | void | ) | const |
Converts the stream to a 64 bit signed integer.
Definition at line 448 of file ndatastream.cpp.
Referenced by NVtype::toInt64(), and NVtype::toUInt64().
bool isNull | ( | void | ) | const |
Returns true if the stream is null.
Definition at line 452 of file ndatastream.cpp.
nuint32 size | ( | void | ) | const |
Returns the size of the stream.
Definition at line 460 of file ndatastream.cpp.
Referenced by NShaHash::calculateFile(), NSha1Hash::calculateFile(), NMd5Hash::calculateFile(), NMd4Hash::calculateFile(), NMd2Hash::calculateFile(), NVtype::getSize(), operator!=(), operator==(), NTcpSocket::write(), NFile::write(), and NTcpSocket::writeLine().
const void * data | ( | void | ) | const |
Returns a pointer to the data associated with the stream.
Definition at line 465 of file ndatastream.cpp.
Referenced by NShaHash::calculate(), NSha1Hash::calculate(), NMd5Hash::calculate(), NMd4Hash::calculate(), NMd2Hash::calculate(), NShaHash::calculateFile(), NSha1Hash::calculateFile(), NMd5Hash::calculateFile(), NMd4Hash::calculateFile(), NMd2Hash::calculateFile(), NTcpSocket::write(), NFile::write(), and NTcpSocket::writeLine().
bool operator== | ( | const NDataStream & | rhs | ) | const |
Equality test.
rhs | A NDataStream object to compare to |
Definition at line 470 of file ndatastream.cpp.
bool operator!= | ( | const NDataStream & | rhs | ) | const |
Equality test.
rhs | A NDataStream object to compare to |
Definition at line 482 of file ndatastream.cpp.
NDataStream & operator= | ( | const char * | str | ) |
Sets the stream data.
str | A pointer to a null terminated string |
Definition at line 494 of file ndatastream.cpp.
NDataStream & operator= | ( | const NString & | str | ) |
Sets the stream data.
str | A NString object |
Definition at line 498 of file ndatastream.cpp.
NDataStream & operator= | ( | const NDataStream & | str | ) |
Sets the stream data.
str | A NDataStream object |
Definition at line 502 of file ndatastream.cpp.
References toString().
NDataStream & operator= | ( | const nint16 | val | ) |
Sets the stream data.
val | A 16 bit integer |
Definition at line 506 of file ndatastream.cpp.
NDataStream & operator= | ( | const nuint16 | val | ) |
Sets the stream data.
val | A 16 bit unsigned integer |
Definition at line 510 of file ndatastream.cpp.
NDataStream & operator= | ( | const nint32 | val | ) |
Sets the stream data.
val | A 32 bit integer |
Definition at line 514 of file ndatastream.cpp.
NDataStream & operator= | ( | const nuint32 | val | ) |
Sets the stream data.
val | A 32 bit unsigned integer |
Definition at line 518 of file ndatastream.cpp.
NDataStream & operator= | ( | const nint64 | val | ) |
Sets the stream data.
val | A 64 bit integer |
Definition at line 522 of file ndatastream.cpp.
NDataStream & operator= | ( | const nuint64 | val | ) |
Sets the stream data.
val | A 64 bit unsigned integer |
Definition at line 526 of file ndatastream.cpp.
NDataStream & operator+= | ( | const char * | str | ) |
Appends data to the stream.
str | A pointer to a null terminated string |
Definition at line 530 of file ndatastream.cpp.
References append().
NDataStream & operator+= | ( | const NString & | str | ) |
Sets the stream data.
str | A NString object |
Definition at line 534 of file ndatastream.cpp.
References append().
NDataStream & operator+= | ( | const NDataStream & | str | ) |
Appends data to the stream.
str | A NDataStream object |
Definition at line 538 of file ndatastream.cpp.
References append(), and toString().
NDataStream & operator+= | ( | const nint16 | val | ) |
Appends data to the stream.
val | A 16 bit integer |
Definition at line 542 of file ndatastream.cpp.
References append().
NDataStream & operator+= | ( | const nuint16 | val | ) |
Appends data to the stream.
val | A 16 bit unsigned integer |
Definition at line 546 of file ndatastream.cpp.
References append().
NDataStream & operator+= | ( | const nint32 | val | ) |
Appends data to the stream.
val | A 32 bit integer |
Definition at line 550 of file ndatastream.cpp.
References append().
NDataStream & operator+= | ( | const nuint32 | val | ) |
Appends data to the stream.
val | A 32 bit unsigned integer |
Definition at line 554 of file ndatastream.cpp.
References append().
NDataStream & operator+= | ( | const nint64 | val | ) |
Appends data to the stream.
val | A 64 bit integer |
Definition at line 558 of file ndatastream.cpp.
References append().
NDataStream & operator+= | ( | const nuint64 | val | ) |
Appends data to the stream.
val | A 64 bit unsigned integer |
Definition at line 562 of file ndatastream.cpp.
References append().
NDataStream operator+ | ( | const char * | str | ) |
Appends data to the stream.
str | A pointer to a null terminated string |
Definition at line 566 of file ndatastream.cpp.
References append().
NDataStream operator+ | ( | const NString & | str | ) |
Sets the stream data.
str | A NString object |
Definition at line 570 of file ndatastream.cpp.
References append().
NDataStream operator+ | ( | const NDataStream & | str | ) |
Appends data to the stream.
str | A NDataStream object |
Definition at line 574 of file ndatastream.cpp.
References append(), and toString().
NDataStream operator+ | ( | const nint16 | val | ) |
Appends data to the stream.
val | A 16 bit integer |
Definition at line 578 of file ndatastream.cpp.
References append().
NDataStream operator+ | ( | const nuint16 | val | ) |
Appends data to the stream.
val | A 16 bit unsigned integer |
Definition at line 582 of file ndatastream.cpp.
References append().
NDataStream operator+ | ( | const nint32 | val | ) |
Appends data to the stream.
val | A 32 bit integer |
Definition at line 586 of file ndatastream.cpp.
References append().
NDataStream operator+ | ( | const nuint32 | val | ) |
Appends data to the stream.
val | A 32 bit unsigned integer |
Definition at line 590 of file ndatastream.cpp.
References append().
NDataStream operator+ | ( | const nint64 | val | ) |
Appends data to the stream.
val | A 64 bit integer |
Definition at line 594 of file ndatastream.cpp.
References append().
NDataStream operator+ | ( | const nuint64 | val | ) |
Appends data to the stream.
val | A 64 bit unsigned integer |
Definition at line 598 of file ndatastream.cpp.
References append().
unsigned char operator[] | ( | nuint32 | pos | ) |
Converts a byte of the stream data to char.
pos | Position of the byte to be converted |
Definition at line 602 of file ndatastream.cpp.