GClasses
GClasses::GBlobIncoming Class Reference

Detailed Description

This class is for deserializing blobs. It takes care of Endianness issues and protects against buffer overruns. This class would be particularly useful for writing a network protocol.

#include <GBlob.h>

Public Member Functions

 GBlobIncoming ()
 
 GBlobIncoming (unsigned char *pBuffer, size_t nSize, bool bDeleteBuffer)
 
 ~GBlobIncoming ()
 
void get (unsigned char *pData, size_t nSize)
 Pops a blob from the buffer (throws if buffer is too small) More...
 
void get (wchar_t *pwc)
 Pops a single wide char from the buffer (throws if buffer is too small) More...
 
void get (char *pc)
 Pops a single char from the buffer (throws if buffer is too small) More...
 
void get (int *pn)
 Pops an int from the buffer (throws if buffer is too small) More...
 
void get (unsigned int *pui)
 Pops an unsigned int from the buffer (throws if buffer is too small) More...
 
void get (unsigned long long *pull)
 Pops a 64-bit unsigned int from the buffer (throws if buffer is too small) More...
 
void get (unsigned char *puc)
 Pops an unsigned char from the buffer (throws if buffer is too small) More...
 
void get (float *pf)
 Pops a float from the buffer (throws if buffer is too small) More...
 
void get (double *pd)
 Pops a double from the buffer (throws if buffer is too small) More...
 
void get (std::string *pOutString)
 Pops a string from the buffer. More...
 
unsigned char * getBlob ()
 
size_t getBlobSize ()
 
size_t getPos ()
 
void peek (size_t nIndex, unsigned char *pData, size_t nSize)
 Retrieves bytes from within the buffer. More...
 
void setBlob (unsigned char *pBuffer, size_t nSize, bool bDeleteBuffer)
 
void setPos (size_t pos)
 

Protected Attributes

bool m_bDeleteBuffer
 
size_t m_nBufferPos
 
size_t m_nBufferSize
 
unsigned char * m_pBuffer
 

Constructor & Destructor Documentation

GClasses::GBlobIncoming::GBlobIncoming ( )
GClasses::GBlobIncoming::GBlobIncoming ( unsigned char *  pBuffer,
size_t  nSize,
bool  bDeleteBuffer 
)
GClasses::GBlobIncoming::~GBlobIncoming ( )

Member Function Documentation

void GClasses::GBlobIncoming::get ( unsigned char *  pData,
size_t  nSize 
)

Pops a blob from the buffer (throws if buffer is too small)

void GClasses::GBlobIncoming::get ( wchar_t *  pwc)

Pops a single wide char from the buffer (throws if buffer is too small)

void GClasses::GBlobIncoming::get ( char *  pc)

Pops a single char from the buffer (throws if buffer is too small)

void GClasses::GBlobIncoming::get ( int *  pn)

Pops an int from the buffer (throws if buffer is too small)

void GClasses::GBlobIncoming::get ( unsigned int *  pui)

Pops an unsigned int from the buffer (throws if buffer is too small)

void GClasses::GBlobIncoming::get ( unsigned long long *  pull)

Pops a 64-bit unsigned int from the buffer (throws if buffer is too small)

void GClasses::GBlobIncoming::get ( unsigned char *  puc)

Pops an unsigned char from the buffer (throws if buffer is too small)

void GClasses::GBlobIncoming::get ( float *  pf)

Pops a float from the buffer (throws if buffer is too small)

void GClasses::GBlobIncoming::get ( double *  pd)

Pops a double from the buffer (throws if buffer is too small)

void GClasses::GBlobIncoming::get ( std::string *  pOutString)

Pops a string from the buffer.

unsigned char* GClasses::GBlobIncoming::getBlob ( )
inline
size_t GClasses::GBlobIncoming::getBlobSize ( )
inline
size_t GClasses::GBlobIncoming::getPos ( )
inline
void GClasses::GBlobIncoming::peek ( size_t  nIndex,
unsigned char *  pData,
size_t  nSize 
)

Retrieves bytes from within the buffer.

void GClasses::GBlobIncoming::setBlob ( unsigned char *  pBuffer,
size_t  nSize,
bool  bDeleteBuffer 
)
void GClasses::GBlobIncoming::setPos ( size_t  pos)
inline

Member Data Documentation

bool GClasses::GBlobIncoming::m_bDeleteBuffer
protected
size_t GClasses::GBlobIncoming::m_nBufferPos
protected
size_t GClasses::GBlobIncoming::m_nBufferSize
protected
unsigned char* GClasses::GBlobIncoming::m_pBuffer
protected