#include <GContainers.h>
Public Member Functions | |
GBytePipe (int PreAlloc=0) | |
Constructor. | |
virtual | ~GBytePipe () |
Desructor. | |
virtual bool | IsEmpty () |
Returns true if the container is empty. | |
virtual void | Empty () |
Empties the container freeing any memory used. | |
virtual void * | New (int AddBytes=0) |
virtual int64 | Peek (uchar *Ptr, int Size) |
virtual int64 | Peek (GStreamI *Str, int Size) |
int | StringAt (char *Str) |
int64 | GetSize () |
Gets the total bytes in the container. | |
int | Read (void *Buffer, int Size, int Flags=0) |
Reads bytes off the start of the container. | |
int | Write (const void *Buffer, int Size, int Flags=0) |
Writes bytes to the end of the container. | |
int | Pop (short &i) |
Reads a 2 byte integer from the start. | |
int | Pop (int &i) |
Reads a 4 byte integer from the start. | |
int | Pop (double &i) |
Reads a double from the start. | |
int | Push (short i) |
Writes a 2 byte int to the end. | |
int | Push (int i) |
Writes a 2 byte int to the end. | |
int | Push (double i) |
Writes a double to the end. | |
Classes | |
struct | Block |
Allows data to be buffered in separate memory blocks and then written to a continuous block for processing. Works as a first in first out que. You can (and should) provide a suitable PreAlloc size to the constructor. This can reduce the number of blocks of memory being used (and their associated alloc/free time and tracking overhead) in high volume situations.
GBytePipe::GBytePipe | ( | int | PreAlloc = 0 |
) |
Constructor.
PreAlloc | Sets the block size, which means allocating ahead and then joining together smaller inserts into 1 continuous block. |
void * GBytePipe::New | ( | int | AddBytes = 0 |
) | [virtual] |
Returns a dynamically allocated block that contains all the data in the container in a continuous block.
AddBytes | If this is > 0 then the function add's the specified number of bytes containing the value 0 on the end of the block. This is useful for NULL terminating strings or adding buffer space on the end of the block returned. |
References GetSize(), and Read().
Referenced by Html2::GHtml2::GetSelection(), GHtml::GetSelection(), GMemStream::GMemStream(), LgiNewConvertCp(), GStringPipe::NewStr(), and GStringPipe::NewStrW().
int64 GBytePipe::Peek | ( | uchar * | Ptr, | |
int | Size | |||
) | [virtual] |
Reads data from the start of the container without removing it from the que. Returns the bytes copied.
Ptr | Buffer for output |
Size | Bytes to look at |
References GetSize(), GBytePipe::Block::Next, GBytePipe::Block::Ptr(), and GBytePipe::Block::Size.
Reads data from the start of the container without removing it from the que. Returns the bytes copied.
Str | Buffer for output |
Size | Bytes to look at |
References GetSize(), GBytePipe::Block::Next, GBytePipe::Block::Ptr(), GBytePipe::Block::Size, and GStreamI::Write().
int GBytePipe::StringAt | ( | char * | Str | ) |
Looks for a sub-string in the buffered data
References GBytePipe::Block::Next, GBytePipe::Block::Ptr(), and GBytePipe::Block::Used.