I use this very simple class to pass buffers between libraries and the main program. More...
#include <BufferHolder.h>
Public Member Functions | |
BufferHolder () | |
Default constructor. | |
BufferHolder (const char *pstr, int str_size=0) | |
Constructor - Just call Set. | |
void | set (const char *pstr, int str_size=0) |
Set - initialize the Buffer Holder with a buffer or a "C" style string. | |
bool | empty () |
Returns True if BufferHoldr is empty. | |
Public Attributes | |
const char * | pointer |
Pointer to the buffer we need to hold. | |
int | size |
The size of the buffer. |
I use this very simple class to pass buffers between libraries and the main program.
it is just an easy way to transfer buffer that doesn't necessarily end with NULL. The recipient cannot (should not) change the buffer!!! Never!!! Everything is public here.
Note that this class may "point" to NULL, but you will never get a BufferHolder that holds NULL, from Beesnest!
This is the only "implemented" class I use in adapters/engines. Beesnest and the adapters/engines has to use exactly the same base class. However you can inherit from this class if you wish.
Definition at line 26 of file BufferHolder.h.
BufferHolder::BufferHolder | ( | ) | [inline] |
BufferHolder::BufferHolder | ( | const char * | pstr, |
int | str_size = 0 |
||
) | [inline] |
Constructor - Just call Set.
pstr | Pointer to the buffer to hold. |
str_size | Optional, the buffer size. If missing, the size will be the size until the first NULL. |
Definition at line 46 of file BufferHolder.h.
bool BufferHolder::empty | ( | ) | [inline] |
Returns True if BufferHoldr is empty.
Definition at line 65 of file BufferHolder.h.
void BufferHolder::set | ( | const char * | pstr, |
int | str_size = 0 |
||
) | [inline] |
Set - initialize the Buffer Holder with a buffer or a "C" style string.
pstr | Pointer to the buffer to hold. |
str_size | Optional, the buffer size. If missing, the size will be the size until the first NULL. |
Definition at line 56 of file BufferHolder.h.
const char* BufferHolder::pointer |
Pointer to the buffer we need to hold.
Definition at line 31 of file BufferHolder.h.
The size of the buffer.
Definition at line 33 of file BufferHolder.h.