Barracuda Application Server C/C++ Reference
NO
|
40 #include <HttpServer.h>
41 #include <BaServerLib.h>
52 typedef void (*DynBuffer_OnAllocError)(
struct DynBuffer* o,
int eCode);
71 DynBuffer_OnAllocError onAllocError=0);
110 int expand(
int sizeNeeded);
146 DynBuffer_OnAllocError onAllocError;
154 BA_API
void DynBuffer_constructor(
DynBuffer* o,
int startSize,
int expandSize,
156 DynBuffer_OnAllocError onAllocError);
157 #define DynBuffer_destructor(o) DynBuffer_release(o)
158 BA_API
void DynBuffer_release(
DynBuffer* o);
159 BA_API
char* DynBuffer_getBuf(
DynBuffer* o);
160 #define DynBuffer_getBufSize(o) BufPrint_getBufSize((BufPrint*)(o))
161 #define DynBuffer_getCurPtr(o) (((BufPrint*)(o))->buf+((BufPrint*)(o))->cursor)
162 #define DynBuffer_incrementCursor(o,nBytes) ((BufPrint*)(o))->cursor+=nBytes
163 #define DynBuffer_getECode(o) ((o)->expandSize < 0 ? (o)->expandSize : 0)
164 BA_API
int DynBuffer_expand(
DynBuffer* o,
int sizeNeeded);
165 BA_API
const char* DynBuffer_ecode2str(
int eCode);
169 inline DynBuffer::DynBuffer(
171 DynBuffer_OnAllocError onAllocError) {
172 DynBuffer_constructor(
this, startSize, expandSize, alloc, onAllocError); }
174 DynBuffer_destructor(
this); }
176 DynBuffer_release(
this); }
178 return DynBuffer_getBuf(
this); }
180 return DynBuffer_getBufSize(
this); }
182 return DynBuffer_getECode(
this); }
184 return DynBuffer_expand(
this, sizeNeeded); }
186 return DynBuffer_getCurPtr(
this); }
188 DynBuffer_incrementCursor(
this, nBytes); }
190 return DynBuffer_ecode2str(eCode); }
char * getCurPtr()
Return a pointer to the internal cursor position in the internal dynamic buffer.
Definition: DynBuffer.h:185
Memory allocation and deallocation Interface class.
Definition: AllocatorIntf.h:83
char * getBuf()
Returns a pointer to the internal buffer.
Definition: DynBuffer.h:177
void incrementCursor(int nBytes)
Increments the internal cursor position.
Definition: DynBuffer.h:187
A dynamic buffer.
Definition: DynBuffer.h:60
void release()
terminate the internal dynamic buffer by calling free
Definition: DynBuffer.h:175
static const char * ecode2str(int eCode)
Convert error code to string.
Definition: DynBuffer.h:189
The BufPrint class, which implements an ANSI compatible printf method, is a base class used by severa...
Definition: BufPrint.h:122
int getECode()
Returns the error code if memory allocation failed.
Definition: DynBuffer.h:181
~DynBuffer()
destructor.
Definition: DynBuffer.h:173
int expand(int sizeNeeded)
force buffer to expand.
Definition: DynBuffer.h:183
U32 getBufSize()
Returns current size of internal formatted data.
Definition: DynBuffer.h:179