-
Notifications
You must be signed in to change notification settings - Fork 883
v2_0_cpp_unpack_visit
Takatoshi Kondo edited this page May 2, 2016
·
4 revisions
msgpack-c provides unpacking APIs. They convert from msgpack formatted bytes to msgpack::object. And then, using msgpack::object for many purposes. It is similar to DOM(Document Object Model) API for XML. The visitor interface provides more direct access for msgpack formatted bytes like the SAX API for XML. You can define your own visitor and pass it to unpacking APIs for visitor. During unpacking process, an iterator traversing the data. When the iterator meets a msgpack element, a visitor member function that corresponding to the element is called.
struct visitor {
bool visit_nil();
bool visit_boolean(bool v);
bool visit_positive_integer(uint64_t v);
bool visit_negative_integer(int64_t v);
bool visit_float(double v);
bool visit_str(const char* v, uint32_t size);
bool visit_bin(const char* v, uint32_t size);
bool visit_ext(const char* v, uint32_t size);
bool start_array(uint32_t num_elements);
bool start_array_item();
bool end_array_item();
bool end_array();
bool start_map(uint32_t num_kv_pairs);
bool start_map_key();
bool end_map_key();
bool start_map_value();
bool end_map_value();
bool end_map();
void parse_error(size_t parsed_offset, size_t error_offset);
void insufficient_bytes(size_t parsed_offset, size_t error_offset);
};
-
Home
- Q&A
- v2.0.x or later
- v1.1.x - v1.4.x
- v1.0.x