Serializer#
Configure#
-
struct ntl_serializer#
Structure to assisti null-terminated list serialization.
Public Members
-
struct ntl_str_delimiter *delimiter#
optional string delimiters
-
ntl_elem_serializer elem_to_buf#
the callback for serializing and appending each NTL element to
buf
elem_to_buf(NULL,0,p)
calculates the size needed to serializer pelem_to_buf(buf,n,p)
serialize p to a bufferelem_to_buf
should return a negative value for any errors
-
struct ntl_str_delimiter *delimiter#
-
struct ntl_str_delimiter#
Configure serialized NTL string delimiters.
Serialize NTL to buffer#
-
size_t ntl_to_buf2(char *buf, size_t size, struct ntl_serializer *serializer)#
Behaves similarly to snprintf(), serialize a NTL
p
to string.ntl_to_buf(NULL,0,...)
return the number of bytes (excluding \0) needed to serialize pntl_to_buf(buf,n,...)
serialize p to buf and return the number of bytes written excluding \0- Parameters:
buf – the buffer to store the serialized NTL
size – the buffer size
serializer – the serializer config structure
- Returns:
the amount written to
buf
in bytes
-
size_t ntl_to_abuf2(char **buf_p, struct ntl_serializer *serializer)#
Analogous ntl_to_buf(), but will create a buffer thats large enough to hold the output (including the null byte ‘\0’)
Note
buf_p
should be free’d accordingly after done being used- Parameters:
buf_p – the buffer to be created (expects a
char*
address)serializer – the serializer config structure
- Returns:
the amount written to
buf_p
in bytes