All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Macros | Functions
as_string_builder.h File Reference
#include <aerospike/as_std.h>
+ Include dependency graph for as_string_builder.h:

Go to the source code of this file.

Data Structures

struct  as_string_builder
 

Macros

#define as_string_builder_inita(__sb, __capacity, __resize)
 

Functions

AS_EXTERN bool as_string_builder_append (as_string_builder *sb, const char *value)
 
AS_EXTERN bool as_string_builder_append_bytes (as_string_builder *sb, uint8_t *src, uint32_t size)
 
AS_EXTERN bool as_string_builder_append_char (as_string_builder *sb, char value)
 
AS_EXTERN bool as_string_builder_append_int (as_string_builder *sb, int val)
 
static bool as_string_builder_append_newline (as_string_builder *sb)
 
AS_EXTERN bool as_string_builder_append_uint (as_string_builder *sb, uint32_t val)
 
static void as_string_builder_assign (as_string_builder *sb, uint32_t buffer_size, char *buffer)
 
AS_EXTERN void as_string_builder_destroy (as_string_builder *sb)
 
AS_EXTERN void as_string_builder_init (as_string_builder *sb, uint32_t capacity, bool resize)
 
static void as_string_builder_reset (as_string_builder *sb)
 

Macro Definition Documentation

#define as_string_builder_inita (   __sb,
  __capacity,
  __resize 
)
Value:
(__sb)->data = alloca(__capacity);\
(__sb)->data[0] = 0;\
(__sb)->capacity = (__capacity);\
(__sb)->length = 0;\
(__sb)->resize = (__resize);\
(__sb)->free = false;
uint8_t data[0]
Definition: as_proto.h:38

Initialize string builder with a stack allocated buffer.

Definition at line 66 of file as_string_builder.h.

Function Documentation

AS_EXTERN bool as_string_builder_append ( as_string_builder sb,
const char *  value 
)

Append null terminated string value to string buffer. Returns if successful or not.

AS_EXTERN bool as_string_builder_append_bytes ( as_string_builder sb,
uint8_t *  src,
uint32_t  size 
)

Append bytes in hex format to string buffer. Returns if successful or not.

AS_EXTERN bool as_string_builder_append_char ( as_string_builder sb,
char  value 
)

Append a single character to string buffer. Returns if successful or not.

AS_EXTERN bool as_string_builder_append_int ( as_string_builder sb,
int  val 
)

Append integer to string buffer. Returns if successful or not.

static bool as_string_builder_append_newline ( as_string_builder sb)
inlinestatic

Append newline to string buffer. Returns if successful or not.

Definition at line 155 of file as_string_builder.h.

References as_string_builder_append_char().

AS_EXTERN bool as_string_builder_append_uint ( as_string_builder sb,
uint32_t  val 
)

Append unsigned integer to string buffer. Returns if successful or not.

static void as_string_builder_assign ( as_string_builder sb,
uint32_t  buffer_size,
char *  buffer 
)
inlinestatic

Assign external buffer to string builder. External buffers are not resized.

Definition at line 88 of file as_string_builder.h.

References as_string_builder::capacity, as_string_builder::data, as_string_builder::free, as_string_builder::length, and as_string_builder::resize.

AS_EXTERN void as_string_builder_destroy ( as_string_builder sb)

Free the resources allocated to the buffer.

AS_EXTERN void as_string_builder_init ( as_string_builder sb,
uint32_t  capacity,
bool  resize 
)

Initialize string builder with a heap allocated buffer.

static void as_string_builder_reset ( as_string_builder sb)
inlinestatic

Initialize to empty string from current state. Capacity remains unchanged.

Definition at line 109 of file as_string_builder.h.

References as_string_builder::data, and as_string_builder::length.