MistServer  2.5.3-Pro-19-gf5e75b1 ( Generic_64)
Public Member Functions | Private Attributes
Socket::Buffer Class Reference

A buffer made out of std::string objects that can be efficiently read from and written to. More...

#include <socket.h>

Public Member Functions

void append (const std::string &newdata)
 Appends this string to the internal std::deque of std::string objects. More...
 
void append (const std::string &newdata)
 
void append (const char *newdata, const unsigned int newdatasize)
 Appends this data block to the internal std::deque of std::string objects. More...
 
void append (const char *newdata, const unsigned int newdatasize)
 
bool available (unsigned int count)
 Returns true if at least count bytes are available in this buffer. More...
 
bool available (unsigned int count)
 
unsigned int bytes (unsigned int max)
 
unsigned int bytes (unsigned int max)
 Returns either the amount of total bytes available in the buffer or max, whichever is smaller. More...
 
void clear ()
 Completely empties the buffer. More...
 
void clear ()
 
std::string copy (unsigned int count)
 
std::string copy (unsigned int count)
 Copies count bytes from the buffer, returning them by value. More...
 
std::string & get ()
 
std::string & get ()
 Gets a reference to the back of the internal std::deque of std::string objects. More...
 
void prepend (const std::string &newdata)
 
void prepend (const std::string &newdata)
 Prepends this data block to the internal std::deque of std::string objects. More...
 
void prepend (const char *newdata, const unsigned int newdatasize)
 
void prepend (const char *newdata, const unsigned int newdatasize)
 Prepends this data block to the internal std::deque of std::string objects. More...
 
std::string remove (unsigned int count)
 
std::string remove (unsigned int count)
 Removes count bytes from the buffer, returning them by value. More...
 
unsigned int size ()
 Returns the amount of elements in the internal std::deque of std::string objects. More...
 
unsigned int size ()
 

Private Attributes

std::deque< std::string > data
 

Detailed Description

A buffer made out of std::string objects that can be efficiently read from and written to.

Member Function Documentation

void Socket::Buffer::append ( const std::string &  newdata)

Appends this string to the internal std::deque of std::string objects.

It is automatically split every BUFFER_BLOCKSIZE bytes.

void Socket::Buffer::append ( const std::string &  newdata)
void Socket::Buffer::append ( const char *  newdata,
const unsigned int  newdatasize 
)

Appends this data block to the internal std::deque of std::string objects.

It is automatically split every BUFFER_BLOCKSIZE bytes.

void Socket::Buffer::append ( const char *  newdata,
const unsigned int  newdatasize 
)
bool Socket::Buffer::available ( unsigned int  count)

Returns true if at least count bytes are available in this buffer.

bool Socket::Buffer::available ( unsigned int  count)
unsigned int Socket::Buffer::bytes ( unsigned int  max)
unsigned int Socket::Buffer::bytes ( unsigned int  max)

Returns either the amount of total bytes available in the buffer or max, whichever is smaller.

void Socket::Buffer::clear ( )

Completely empties the buffer.

void Socket::Buffer::clear ( )
std::string Socket::Buffer::copy ( unsigned int  count)
std::string Socket::Buffer::copy ( unsigned int  count)

Copies count bytes from the buffer, returning them by value.

Returns an empty string if not all count bytes are available.

std::string& Socket::Buffer::get ( )
std::string & Socket::Buffer::get ( )

Gets a reference to the back of the internal std::deque of std::string objects.

void Socket::Buffer::prepend ( const std::string &  newdata)
void Socket::Buffer::prepend ( const std::string &  newdata)

Prepends this data block to the internal std::deque of std::string objects.

It is not automatically split every BUFFER_BLOCKSIZE bytes.

void Socket::Buffer::prepend ( const char *  newdata,
const unsigned int  newdatasize 
)
void Socket::Buffer::prepend ( const char *  newdata,
const unsigned int  newdatasize 
)

Prepends this data block to the internal std::deque of std::string objects.

It is not automatically split every BUFFER_BLOCKSIZE bytes.

std::string Socket::Buffer::remove ( unsigned int  count)
std::string Socket::Buffer::remove ( unsigned int  count)

Removes count bytes from the buffer, returning them by value.

Returns an empty string if not all count bytes are available.

unsigned int Socket::Buffer::size ( )

Returns the amount of elements in the internal std::deque of std::string objects.

The back is popped as long as it is empty, first - this way this function is guaranteed to return 0 if the buffer is empty.

unsigned int Socket::Buffer::size ( )

Field Documentation

std::deque< std::string > Socket::Buffer::data
private

The documentation for this class was generated from the following files: