6 #ifndef __SAUTOBUF__H__
7 #define __SAUTOBUF__H__
9 #include <utilities-def.h>
43 operator char *()
const;
49 char* operator ->()
const;
56 const char & operator[] (
int i)
const;
63 char & operator[] (
int i);
void Free()
Frees the managed buffer. The buffer will be set to nullptr after being freed.
void Attach(char *pBuf, size_t size)
Attaches an external buffer to the SAutoBuf object. The buffer will not be freed by the SAutoBuf obje...
char * Allocate(size_t nElements)
Allocates a buffer of the specified size. If a buffer is already allocated, it will be freed first.
size_t size()
Returns the size of the managed buffer.
SAutoBuf()
Default constructor. Initializes an empty buffer.
char * Detach()
Detaches the managed buffer from the SAutoBuf object. The caller is responsible for freeing the buffe...