46 #include <sys/types.h> 66 typedef enum bson_binary_subtype {
69 } bson_binary_subtype_t;
74 #define BSON_MAXNAME 32 79 #define BSON_BUF_INCREMENT 128 87 bson_binary_subtype_t subtype;
285 size_t size,
const void *data);
__EXPORT int bson_encoder_init_buf(bson_encoder_t encoder, void *buf, unsigned bufsize)
Initialze the encoder for writing to a buffer.
Definition: tinybson.cpp:460
__EXPORT int bson_encoder_append_double(bson_encoder_t encoder, const char *name, double value)
Append a double to the encoded stream.
Definition: tinybson.cpp:580
__EXPORT size_t bson_decoder_data_pending(bson_decoder_t decoder)
Report copyable data size.
Definition: tinybson.cpp:331
Encoder state structure.
Definition: tinybson.h:173
Definition: tinybson.h:104
#define BSON_MAXNAME
Maximum node name length.
Definition: tinybson.h:74
struct bson_node_s * bson_node_t
Node structure passed to the callback.
Node structure passed to the callback.
Definition: tinybson.h:84
__EXPORT int bson_encoder_init_file(bson_encoder_t encoder, int fd)
Initialze the encoder for writing to a file.
Definition: tinybson.cpp:429
int(* bson_decoder_callback)(bson_decoder_t decoder, void *priv, bson_node_t node)
Node callback.
Definition: tinybson.h:102
__EXPORT void * bson_encoder_buf_data(bson_encoder_t encoder)
Get a pointer to the encoded object buffer.
Definition: tinybson.cpp:527
__EXPORT int bson_decoder_copy_data(bson_decoder_t decoder, void *buf)
Copy node data.
Definition: tinybson.cpp:312
__EXPORT int bson_encoder_fini(bson_encoder_t encoder)
Finalise the encoded stream.
Definition: tinybson.cpp:484
__EXPORT int bson_decoder_init_buf(bson_decoder_t decoder, void *buf, unsigned bufsize, bson_decoder_callback callback, void *priv)
Initialise the decoder to read from a buffer in memory.
Definition: tinybson.cpp:137
__EXPORT int bson_decoder_init_file(bson_decoder_t decoder, int fd, bson_decoder_callback callback, void *priv)
Initialise the decoder to read from a file.
Definition: tinybson.cpp:114
struct bson_encoder_s * bson_encoder_t
Encoder state structure.
bson_type_t
subset of the BSON node types we might care about
Definition: tinybson.h:51
__EXPORT int bson_encoder_init_buf_file(bson_encoder_t encoder, int fd, void *buf, unsigned bufsize)
Initialze the encoder for writing to a file.
Definition: tinybson.cpp:443
__EXPORT int bson_encoder_append_binary(bson_encoder_t encoder, const char *name, bson_binary_subtype_t subtype, size_t size, const void *data)
Append a binary blob to the encoded stream.
Definition: tinybson.cpp:614
__EXPORT int bson_encoder_append_string(bson_encoder_t encoder, const char *name, const char *string)
Append a string to the encoded stream.
Definition: tinybson.cpp:595
__EXPORT int bson_encoder_buf_size(bson_encoder_t encoder)
Fetch the size of the encoded object; only valid for buffer operations.
Definition: tinybson.cpp:515
__EXPORT int bson_encoder_append_int(bson_encoder_t encoder, const char *name, int64_t value)
Append an integer to the encoded stream.
Definition: tinybson.cpp:552
__EXPORT int bson_encoder_append_bool(bson_encoder_t encoder, const char *name, bool value)
Append a boolean to the encoded stream.
Definition: tinybson.cpp:538
__EXPORT int bson_decoder_next(bson_decoder_t decoder)
Process the next node from the stream and invoke the callback.
Definition: tinybson.cpp:180