Barracuda Application Server C/C++ Reference
NO
BufPrint Struct Reference

Detailed Description

The BufPrint class, which implements an ANSI compatible printf method, is a base class used by several other classes.

This class does not allocate memory for the buffer. Thus, any class using BufPrint must provide a buffer BufPrint can use. The output from printf is formatted in the buffer passed into the constructor. BufPrint calls the callback function BufPrint_Flush when the buffer is full. See BufPrint_Flush for additional details.

#include <BufPrint.h>

Inheritance diagram for BufPrint:

Public Member Functions

 BufPrint (void *userData=0, BufPrint_Flush flush=0)
 BufPrint constructor. More...
 
 BufPrint (char *buf, int size, void *userData=0, BufPrint_Flush flush=0)
 BufPrint constructor. More...
 
void * getUserData ()
 Returns the user data pointer set in the constructor.
 
int vprintf (const char *fmt, va_list argList)
 The printf function's format is identical to the standard ANSI vprintf function. More...
 
int printf (const char *fmt,...)
 The printf function's format is identical to the standard ANSI printf function, but with the following extensions: More...
 
int baputc (int c)
 print character (wrapper for BufPrint_putc)
 
int write (const void *data, int len)
 Write data to the buffer. More...
 
int write (const char *buf)
 Used for sending a zero terminated string to the client. More...
 
void setBuf (char *buf, int size)
 Set the buffer used by BufPrint. More...
 
char * getBuf ()
 Returns a pointer to the internal buffer. More...
 
U32 getBufSize ()
 Returns current size of internal formatted data.
 
void erase ()
 resets the cursor, thus erasing the data in the buffer
 
int flush ()
 Flush buffer.
 
int b64Encode (const void *data, S32 slen)
 Encode binary data as Base64. More...
 
int b64urlEncode (const void *source, S32 slen, bool padding)
 Encode binary data as Base64url. More...
 
int jsonString (const char *str)
 Print and escape a string such that a browser can run the JavaScript 'eval' function and produce a string identical to the string the 'str' argument points to. More...