protobuf-c-text
Library to generate & parse text format protobufs in C.
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups
Functions
Functions to generate text format proto bufs
Collaboration diagram for Functions to generate text format proto bufs:

Functions

static char * esc_str (char *src, int len, ProtobufCAllocator *allocator)
 Escape string. More...
 
static void protobuf_c_text_to_string_internal (ReturnString *rs, int level, ProtobufCMessage *m, const ProtobufCMessageDescriptor *d, ProtobufCAllocator *allocator)
 Internal function to back API function. More...
 

Detailed Description

Function Documentation

static char* esc_str ( char *  src,
int  len,
ProtobufCAllocator *  allocator 
)
static

Escape string.

Add escape characters to strings for problematic characters.

Parameters
[in]srcThe unescaped string to process.
[in]lenLength of src. Note that src might have ASCII NULs so strlen() isn't good enough here.
[in]allocatorallocator functions.
Returns
The fully escaped string, or NULL if there has been an allocation error.

Definition at line 105 of file generate.c.

References PBC_ALLOC.

Referenced by protobuf_c_text_to_string_internal().

Here is the caller graph for this function:

static void protobuf_c_text_to_string_internal ( ReturnString rs,
int  level,
ProtobufCMessage *  m,
const ProtobufCMessageDescriptor *  d,
ProtobufCAllocator *  allocator 
)
static

Internal function to back API function.

Has a few extra params to better enable recursion. This function gets called for each nested message as the ProtobufCMessage struct is traversed.

Parameters
[in,out]rsThe string being built up for the text format protobuf.
[in]levelIndent level - increments in 2's.
[in]mThe ProtobufCMessage being serialised.
[in]dThe descriptor for the ProtobufCMessage.
[in]allocatorallocator functions.

Definition at line 176 of file generate.c.

References esc_str(), ReturnString::malloc_err, PBC_FREE, rs_append(), ReturnString::s, and STRUCT_MEMBER.

Referenced by protobuf_c_text_to_string().

Here is the call graph for this function:

Here is the caller graph for this function: