ubjsc
0.4-dev
Enterprise-grade C library for manipulating UBJSON
|
Bytestream writer and pretty-printer of ubjson primitives. More...
Go to the source code of this file.
Data Structures | |
struct | ubjs_writer_context |
User-provided context - callbacks and userdata. More... | |
Typedefs | |
typedef struct ubjs_writer | ubjs_writer |
Writer itself. | |
typedef struct ubjs_writer_context | ubjs_writer_context |
User-provided context - callbacks and userdata. | |
typedef void(* | ubjs_writer_context_would_write) (ubjs_writer_context *this, uint8_t *data, unsigned int length) |
Callback when writer produced bytes out of a primitive. More... | |
typedef void(* | ubjs_writer_context_would_print) (ubjs_writer_context *this, char *data, unsigned int length) |
Callback when writer produced pretty-printed version of a primitive. More... | |
typedef void(* | ubjs_writer_context_free) (ubjs_writer_context *this) |
Callback when writer is about to be free-d. More... | |
Functions | |
UBJS_EXPORT ubjs_result | ubjs_writer_new (ubjs_library *lib, ubjs_writer **pthis, ubjs_writer_context *context) |
Creates new writer. More... | |
UBJS_EXPORT ubjs_result | ubjs_writer_free (ubjs_writer **pthis) |
Frees the writer. More... | |
UBJS_EXPORT ubjs_result | ubjs_writer_get_context (ubjs_writer *this, ubjs_writer_context **pcontext) |
Gets user context from the writer. More... | |
UBJS_EXPORT ubjs_result | ubjs_writer_write (ubjs_writer *this, ubjs_prmtv *object) |
Writes a bytestream out of a primitive. More... | |
UBJS_EXPORT ubjs_result | ubjs_writer_print (ubjs_writer *this, ubjs_prmtv *object) |
Pretty-prints out of a primitive. More... | |
Bytestream writer and pretty-printer of ubjson primitives.
This file describes ubjs_writer structure, that writes ubjson primitives to bytestreams and also pretty-prints'em.
typedef void(* ubjs_writer_context_free) (ubjs_writer_context *this) |
Callback when writer is about to be free-d.
Here you can cleanup your userdata.
this | Context object you passed to ubjs_writer_new. |
typedef void(* ubjs_writer_context_would_print) (ubjs_writer_context *this, char *data, unsigned int length) |
Callback when writer produced pretty-printed version of a primitive.
this | Context object you passed to ubjs_writer_new. |
data | Outgoing printf()-ready data. |
len | Length of the data. |
typedef void(* ubjs_writer_context_would_write) (ubjs_writer_context *this, uint8_t *data, unsigned int length) |
Callback when writer produced bytes out of a primitive.
this | Context object you passed to ubjs_writer_new. |
data | Outgoing data. |
len | Length of the data. |
UBJS_EXPORT ubjs_result ubjs_writer_free | ( | ubjs_writer ** | pthis | ) |
UBJS_EXPORT ubjs_result ubjs_writer_get_context | ( | ubjs_writer * | this, |
ubjs_writer_context ** | pcontext | ||
) |
UBJS_EXPORT ubjs_result ubjs_writer_new | ( | ubjs_library * | lib, |
ubjs_writer ** | pthis, | ||
ubjs_writer_context * | context | ||
) |
UBJS_EXPORT ubjs_result ubjs_writer_print | ( | ubjs_writer * | this, |
ubjs_prmtv * | object | ||
) |
Pretty-prints out of a primitive.
This produces the callback to context->would_print with fresh pretty-printout.
this | Writer. |
object | Primitive. |
References MARKER_CHAR, MARKER_FALSE, MARKER_FLOAT32, MARKER_FLOAT64, MARKER_HPN, MARKER_INT16, MARKER_INT32, MARKER_INT64, MARKER_INT8, MARKER_NOOP, MARKER_NULL, MARKER_STR, MARKER_TRUE, MARKER_UINT8, ubjs_prmtv_char_get(), ubjs_prmtv_false(), ubjs_prmtv_float32_get(), ubjs_prmtv_float64_get(), ubjs_prmtv_free(), ubjs_prmtv_hpn_copy_text(), ubjs_prmtv_hpn_get_length(), ubjs_prmtv_int16_get(), ubjs_prmtv_int32_get(), ubjs_prmtv_int64_get(), ubjs_prmtv_int8_get(), ubjs_prmtv_is_char(), ubjs_prmtv_is_float32(), ubjs_prmtv_is_float64(), ubjs_prmtv_is_hpn(), ubjs_prmtv_is_int16(), ubjs_prmtv_is_int32(), ubjs_prmtv_is_int64(), ubjs_prmtv_is_int8(), ubjs_prmtv_is_str(), ubjs_prmtv_is_uint8(), ubjs_prmtv_noop(), ubjs_prmtv_null(), ubjs_prmtv_str_copy_text(), ubjs_prmtv_str_get_length(), ubjs_prmtv_true(), ubjs_prmtv_uint(), ubjs_prmtv_uint8_get(), UFALSE, UR_ERROR, and UR_OK.
UBJS_EXPORT ubjs_result ubjs_writer_write | ( | ubjs_writer * | this, |
ubjs_prmtv * | object | ||
) |