#include <ByteInBuffer.h>
Public Member Functions | |
ByteInBuffer (const ByteInBuffer &o) | |
copy constructor: create a new duplicate object. | |
ByteInBuffer (const ByteBuffer &_buff) | |
create a new cursor object | |
void | check_available (unsigned int n) const |
throws a std::underflow_error unless n bytes are available at the cursor | |
size_t | cursor () const |
return the current cursor position | |
bool | cursor_available (unsigned int n) const |
check that n bytes are available after the cursor | |
template<typename Tp> | |
Tp | fetch () |
fetch a single item of the template type Tp from the buffer, advancing the cursor. | |
unsigned char | fetch_unsigned_char () |
unsigned int | fetch_unsigned_int () |
unsigned short | fetch_unsigned_short () |
void | fetchAnyType (class AnyType &v) |
fetch an AnyType value at the current position, the type to fetch must be set previously. | |
void | fetchBytes (ByteBuffer &dest, unsigned int len) |
fetch a number of bytes from the buffer | |
void | fetchBytes (char *dest, unsigned int len) |
fetch a number of bytes from the buffer | |
std::string | fetchLongString () |
fetch a long string prefixed by an unsigned int. | |
std::string | fetchString () |
fetch a short string prefixed by an unsigned char. | |
size_t | remaining () const |
return the number of bytes remaining after the cursor | |
void | rewind () |
reset the cursor |
Definition at line 21 of file ByteInBuffer.h.
VGServer::ByteInBuffer::ByteInBuffer | ( | const ByteBuffer & | _buff | ) | [inline] |
VGServer::ByteInBuffer::ByteInBuffer | ( | const ByteInBuffer & | o | ) | [inline] |
void VGServer::ByteInBuffer::check_available | ( | unsigned int | n | ) | const [inline] |
throws a std::underflow_error unless n bytes are available at the cursor
Definition at line 70 of file ByteInBuffer.h.
References cursor_available().
Referenced by fetch(), fetchBytes(), fetchLongString(), and fetchString().
size_t VGServer::ByteInBuffer::cursor | ( | ) | const [inline] |
bool VGServer::ByteInBuffer::cursor_available | ( | unsigned int | n | ) | const [inline] |
check that n bytes are available after the cursor
Definition at line 66 of file ByteInBuffer.h.
References VGServer::ByteBuffer::size().
Referenced by check_available().
Tp VGServer::ByteInBuffer::fetch | ( | ) | [inline] |
fetch a single item of the template type Tp from the buffer, advancing the cursor.
Be careful with implicit type conversions!
Definition at line 76 of file ByteInBuffer.h.
References check_available(), and VGServer::ByteBuffer::data().
unsigned char VGServer::ByteInBuffer::fetch_unsigned_char | ( | ) | [inline] |
Definition at line 89 of file ByteInBuffer.h.
Referenced by VGServer::GraphParser< Callback >::parse().
unsigned int VGServer::ByteInBuffer::fetch_unsigned_int | ( | ) | [inline] |
Definition at line 95 of file ByteInBuffer.h.
Referenced by VGServer::GraphParser< Callback >::parse().
unsigned short VGServer::ByteInBuffer::fetch_unsigned_short | ( | ) | [inline] |
Definition at line 92 of file ByteInBuffer.h.
void VGServer::ByteInBuffer::fetchAnyType | ( | class AnyType & | v | ) |
fetch an AnyType value at the current position, the type to fetch must be set previously.
Definition at line 11 of file ByteInBuffer.cc.
References VGServer::ATTRTYPE_BOOL, VGServer::ATTRTYPE_BYTE, VGServer::ATTRTYPE_CHAR, VGServer::ATTRTYPE_DOUBLE, VGServer::ATTRTYPE_DWORD, VGServer::ATTRTYPE_FLOAT, VGServer::ATTRTYPE_INTEGER, VGServer::ATTRTYPE_INVALID, VGServer::ATTRTYPE_LONG, VGServer::ATTRTYPE_LONGSTRING, VGServer::ATTRTYPE_QWORD, VGServer::ATTRTYPE_SHORT, VGServer::ATTRTYPE_STRING, VGServer::ATTRTYPE_WORD, fetchLongString(), and fetchString().
void VGServer::ByteInBuffer::fetchBytes | ( | ByteBuffer & | dest, | |
unsigned int | len | |||
) | [inline] |
fetch a number of bytes from the buffer
Definition at line 132 of file ByteInBuffer.h.
References VGServer::ByteBuffer::assign_copy(), check_available(), and VGServer::ByteBuffer::data().
void VGServer::ByteInBuffer::fetchBytes | ( | char * | dest, | |
unsigned int | len | |||
) | [inline] |
fetch a number of bytes from the buffer
Definition at line 123 of file ByteInBuffer.h.
References check_available(), and VGServer::ByteBuffer::data().
std::string VGServer::ByteInBuffer::fetchLongString | ( | ) | [inline] |
fetch a long string prefixed by an unsigned int.
Definition at line 111 of file ByteInBuffer.h.
References check_available(), and VGServer::ByteBuffer::data().
Referenced by fetchAnyType().
std::string VGServer::ByteInBuffer::fetchString | ( | ) | [inline] |
fetch a short string prefixed by an unsigned char.
Definition at line 99 of file ByteInBuffer.h.
References check_available(), and VGServer::ByteBuffer::data().
Referenced by fetchAnyType(), and VGServer::GraphParser< Callback >::parse().
size_t VGServer::ByteInBuffer::remaining | ( | ) | const [inline] |
return the number of bytes remaining after the cursor
Definition at line 62 of file ByteInBuffer.h.
References VGServer::ByteBuffer::size().
Referenced by VGServer::GraphParser< Callback >::parse().
void VGServer::ByteInBuffer::rewind | ( | ) | [inline] |