libdballe 5.10
Public Member Functions | Data Fields
dballe::Querybuf Struct Reference

String buffer for composing database queries. More...

#include <querybuf.h>

Public Member Functions

 Querybuf (size_t reserve=512)
void clear ()
 Reset the querybuf to contain the empty string.
void start_list (const char *sep)
 Begin a list of items separated by the given separator.
void appendf (const char *fmt,...) __attribute__((format(printf
 Append a formatted string to the querybuf.
void void append_list (const char *str)
 Append a string to the querybuf, as part of a list.
void append_listf (const char *fmt,...) __attribute__((format(printf
 Append a formatted string to the querybuf, as part of a list.

Data Fields

bool list_first
char list_sep [10]

Detailed Description

String buffer for composing database queries.


Constructor & Destructor Documentation

dballe::Querybuf::Querybuf ( size_t  reserve = 512)
Parameters:
reserveInitial preallocated size for the buffer. If this is chosen wisely, there is no need to reallocate space while composing the query.

Member Function Documentation

void void dballe::Querybuf::append_list ( const char *  str)

Append a string to the querybuf, as part of a list.

This function will prepend str with the current list separator, unless it is the first item added to the list.

Parameters:
strThe string to append
void dballe::Querybuf::append_listf ( const char *  fmt,
  ... 
)

Append a formatted string to the querybuf, as part of a list.

This function will prepend str with the current list separator, unless it is the first item added to the list.

Parameters:
strThe string to append
void dballe::Querybuf::appendf ( const char *  fmt,
  ... 
)

Append a formatted string to the querybuf.

Parameters:
fmtThe string to append, which will be formatted in printf style
void dballe::Querybuf::start_list ( const char *  sep)

Begin a list of items separated by the given separator.

Items are added using append_list().

Parameters:
sepThe separator to add between every list item

The documentation for this struct was generated from the following file: