Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
IoBufPrint.h File Reference
#include <BufPrint.h>
#include <IoIntf.h>
#include <BaServerLib.h>
Include dependency graph for IoBufPrint.h:

Go to the source code of this file.

Classes

struct  IoBufPrint
 BufPrint adapter for a writable ResIntf. More...
 

Typedefs

typedef struct IoBufPrint IoBufPrint
 BufPrint adapter for a writable ResIntf. More...
 

Functions

BA_API IoBufPrintIoBufPrint_create (AllocatorIntf *alloc, IoIntf *io, size_t bufSize, const char *name)
 Open a file for writing and allocate a buffered writer. More...
 
BA_API IoBufPrintIoBufPrint_create2 (AllocatorIntf *alloc, size_t bufSize, ResIntfPtr out)
 Allocate a writer for an already open resource. More...
 
BA_API void IoBufPrint_destructor (IoBufPrint *o)
 Flush and release an adapter's owned resource. More...
 

Typedef Documentation

◆ IoBufPrint

typedef struct IoBufPrint IoBufPrint

BufPrint adapter for a writable ResIntf.

Write through the embedded BufPrint and explicitly flush/check its return before destruction when output errors must be observed. Flush consumes its buffered bytes even when the resource write fails; no retry buffer remains.

Function Documentation

◆ IoBufPrint_create()

BA_API IoBufPrint * IoBufPrint_create ( AllocatorIntf alloc,
IoIntf io,
size_t  bufSize,
const char *  name 
)

Open a file for writing and allocate a buffered writer.

Parameters
allocRequired allocator, retained by the caller for final release.
ioRequired borrowed writable I/O, kept alive through destruction.
bufSizeRequested buffer bytes, positive and at most 65535; allocation size arithmetic must not overflow. Allocator-adjusted capacity must also fit U16.
nameRequired NUL-terminated I/O path, used during this call.
Returns
Allocated writer, or NULL for open/allocation failure. OpenRes_WRITE can create/truncate the target before a later allocation failure. On success the adapter closes the opened resource during destruction. After destruction, release the adapter with the same allocator; destruction does not free it.

◆ IoBufPrint_create2()

BA_API IoBufPrint * IoBufPrint_create2 ( AllocatorIntf alloc,
size_t  bufSize,
ResIntfPtr  out 
)

Allocate a writer for an already open resource.

Parameters
allocRequired allocator; caller retains it for final release.
bufSizePositive byte capacity, at most 65535, including any allocator size adjustment. sizeof(IoBufPrint)+bufSize must be representable.
outRequired borrowed writable resource with writeFp installed.
Returns
Allocated writer or NULL on allocation failure. This variant never closes out; the caller closes it after flushing/destroying the adapter.

◆ IoBufPrint_destructor()

BA_API void IoBufPrint_destructor ( IoBufPrint o)

Flush and release an adapter's owned resource.

Parameters
oRequired live adapter, consumed for further writing. An adapter from create closes its resource; one from create2 leaves it open. Flush and close errors are discarded. Release o separately through its allocator.