MessagePack for C++
|
Unpacking class for a stream deserialization. More...
#include <unpack.hpp>
Public Member Functions | |
unpacker (unpack_reference_func f=&unpacker::default_reference_func, void *user_data=nullptr, std::size_t initial_buffer_size=MSGPACK_UNPACKER_INIT_BUFFER_SIZE, unpack_limit const &limit=unpack_limit()) | |
Constructor. More... | |
unpacker (unpacker &&other) | |
unpacker & | operator= (unpacker &&other) |
~unpacker () | |
void | reserve_buffer (std::size_t size=MSGPACK_UNPACKER_RESERVE_SIZE) |
Reserve a buffer memory. More... | |
char * | buffer () |
Get buffer pointer. More... | |
std::size_t | buffer_capacity () const |
Get buffer capacity. More... | |
void | buffer_consumed (std::size_t size) |
Notify a buffer consumed information to msgpack::unpacker. More... | |
bool | next (msgpack::object_handle *result) |
Unpack one msgpack::object. [obsolete]. More... | |
bool | next (msgpack::object_handle &result, bool &referenced) |
Unpack one msgpack::object. More... | |
bool | next (msgpack::object_handle &result) |
Unpack one msgpack::object. More... | |
std::size_t | message_size () const |
Get message size. More... | |
bool | execute () |
msgpack::object const & | data () |
msgpack::zone * | release_zone () |
void | reset_zone () |
void | reset () |
std::size_t | parsed_size () const |
Get parsed message size. More... | |
char * | nonparsed_buffer () |
Get the address that is not parsed in the buffer. More... | |
std::size_t | nonparsed_size () const |
Get the size of the buffer that is not parsed. More... | |
void | skip_nonparsed_buffer (std::size_t size) |
Skip the specified size of non-parsed buffer. More... | |
void | remove_nonparsed_buffer () |
Remove nonparsed buffer and reset the current position as a new start point. More... | |
unpacker (unpack_reference_func f=&unpacker::default_reference_func, void *user_data=nullptr, std::size_t initial_buffer_size=MSGPACK_UNPACKER_INIT_BUFFER_SIZE, unpack_limit const &limit=unpack_limit()) | |
detail::create_object_visitor & | visitor () |
bool | next (msgpack::object_handle &result, bool &referenced) |
Unpack one msgpack::object. More... | |
bool | next (msgpack::object_handle &result) |
Unpack one msgpack::object. More... | |
msgpack::zone * | release_zone () |
void | reset_zone () |
bool | flush_zone () |
![]() | |
parser (zone_push_finalizer &hook, std::size_t initial_buffer_size=MSGPACK_UNPACKER_INIT_BUFFER_SIZE) | |
Constructor. More... | |
parser (this_type &&other) | |
parser (const this_type &)=delete | |
this_type & | operator= (this_type &&other) |
this_type & | operator= (const this_type &)=delete |
~parser () | |
void | reserve_buffer (std::size_t size=MSGPACK_UNPACKER_RESERVE_SIZE) |
Reserve a buffer memory. More... | |
char * | buffer () |
Get buffer pointer. More... | |
std::size_t | buffer_capacity () const |
Get buffer capacity. More... | |
void | buffer_consumed (std::size_t size) |
Notify a buffer consumed information to msgpack::unpacker. More... | |
bool | next () |
Unpack one msgpack::object. More... | |
std::size_t | message_size () const |
Get message size. More... | |
std::size_t | parsed_size () const |
Get parsed message size. More... | |
char * | nonparsed_buffer () |
Get the address that is not parsed in the buffer. More... | |
std::size_t | nonparsed_size () const |
Get the size of the buffer that is not parsed. More... | |
void | skip_nonparsed_buffer (std::size_t size) |
Skip the specified size of non-parsed buffer. More... | |
void | remove_nonparsed_buffer () |
Remove nonparsed buffer and reset the current position as a new start point. More... | |
void | reset () |
![]() | |
context (unpack_reference_func f, void *user_data, unpack_limit const &limit) | |
context () | |
void | init () |
void | init () |
msgpack::object const & | data () const |
unpack_user & | user () |
unpack_user const & | user () const |
int | execute (const char *data, std::size_t len, std::size_t &off) |
unpack_return | execute (const char *data, std::size_t len, std::size_t &off) |
![]() | |
create_object_visitor (unpack_reference_func f, void *user_data, unpack_limit const &limit) | |
create_object_visitor (create_object_visitor &&other) | |
create_object_visitor & | operator= (create_object_visitor &&other) |
void | init () |
msgpack::object const & | data () const |
msgpack::zone const & | zone () const |
msgpack::zone & | zone () |
void | set_zone (msgpack::zone &zone) |
bool | referenced () const |
void | set_referenced (bool referenced) |
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, size_t) |
void | insufficient_bytes (size_t, size_t) |
Additional Inherited Members | |
![]() | |
unpack_reference_func | m_func |
void * | m_user_data |
unpack_limit | m_limit |
msgpack::object | m_obj |
std::vector< msgpack::object * > | m_stack |
msgpack::zone * | m_zone |
bool | m_referenced |
![]() | |
char * | get_raw_buffer () |
Unpacking class for a stream deserialization.
|
inline |
Constructor.
referenced | If the unpacked object contains reference of the buffer, then set as true, otherwise false. |
f | A judging function that msgpack::object refer to the buffer. |
user_data | This parameter is passed to f. |
initial_buffer_size | The memory size to allocate when unpacker is constructed. |
limit | The size limit information of msgpack::object. |
References buffer(), COUNTER_SIZE, msgpack::detail::context< VisitorHolder >::init(), msgpack::detail::init_count(), msgpack::detail::unpack_user::set_referenced(), msgpack::detail::unpack_user::set_zone(), and msgpack::detail::context< VisitorHolder >::user().
Referenced by operator=().
|
inline |
|
inline |
References msgpack::detail::decr_count().
Referenced by operator=().
|
inline |
|
inline |
Get buffer pointer.
You need to care about the memory is enable between buffer() and buffer() + buffer_capacity() See: https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_unpacker#msgpack-controls-a-buffer
Referenced by unpacker().
|
inline |
Get buffer capacity.
See: https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_unpacker#msgpack-controls-a-buffer
|
inline |
Notify a buffer consumed information to msgpack::unpacker.
size | The size of memory that you consumed. |
After copying the data to the memory that is pointed by buffer(), you need to call the function to notify how many bytes are consumed. Then you can call next() functions.
See: https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_unpacker#msgpack-controls-a-buffer
|
inline |
for backward compatibility
References msgpack::detail::context< VisitorHolder >::data().
Referenced by next().
|
inline |
for backward compatibility
References msgpack::detail::context< VisitorHolder >::execute().
bool msgpack::unpacker::flush_zone | ( | ) |
|
inline |
Get message size.
|
inline |
Unpack one msgpack::object. [obsolete].
result | The object that contains unpacked data. |
See: https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_unpacker#msgpack-controls-a-buffer This function is obsolete. Use the reference inteface version of next() function instead of the pointer interface version.
References msgpack::parser< unpacker, zone_push_finalizer >::next().
|
inline |
Unpack one msgpack::object.
result | The object that contains unpacked data. |
referenced | If the unpacked object contains reference of the buffer, then set as true, otherwise false. |
See: https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_unpacker#msgpack-controls-a-buffer
References data(), msgpack::detail::unpack_user::referenced(), release_zone(), reset(), msgpack::object_handle::set(), msgpack::detail::context< VisitorHolder >::user(), and msgpack::object_handle::zone().
|
inline |
Unpack one msgpack::object.
result | The object that contains unpacked data. |
See: https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_unpacker#msgpack-controls-a-buffer
References msgpack::parser< unpacker, zone_push_finalizer >::next(), and msgpack::detail::create_object_visitor::referenced().
bool msgpack::unpacker::next | ( | msgpack::object_handle & | result, |
bool & | referenced | ||
) |
Unpack one msgpack::object.
result | The object that contains unpacked data. |
referenced | If the unpacked object contains reference of the buffer, then set as true, otherwise false. |
See: https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_unpacker#msgpack-controls-a-buffer
bool msgpack::unpacker::next | ( | msgpack::object_handle & | result | ) |
Unpack one msgpack::object.
result | The object that contains unpacked data. |
See: https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_unpacker#msgpack-controls-a-buffer
|
inline |
Get the address that is not parsed in the buffer.
This function is usable when non-MessagePack message follows after MessagePack message.
|
inline |
Get the size of the buffer that is not parsed.
This function is usable when non-MessagePack message follows after MessagePack message.
References msgpack::move(), unpacker(), and ~unpacker().
|
inline |
Get parsed message size.
This function is usable when non-MessagePack message follows after MessagePack message.
|
inline |
for backward compatibility
References msgpack::detail::unpack_user::set_zone(), and msgpack::detail::context< VisitorHolder >::user().
msgpack::zone* msgpack::unpacker::release_zone | ( | ) |
|
inline |
Remove nonparsed buffer and reset the current position as a new start point.
This function is usable when non-MessagePack message follows after MessagePack message.
|
inline |
Reserve a buffer memory.
size | The size of allocating memory. |
After returning this function, buffer_capacity() returns at least 'size'. See: https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_unpacker#msgpack-controls-a-buffer
References COUNTER_SIZE, msgpack::detail::decr_count(), msgpack::detail::get_count(), msgpack::detail::init_count(), msgpack::detail::unpack_user::referenced(), msgpack::detail::unpack_user::set_referenced(), and msgpack::detail::context< VisitorHolder >::user().
|
inline |
for backward compatibility
References msgpack::detail::context< VisitorHolder >::init().
Referenced by next().
|
inline |
for backward compatibility
References msgpack::detail::decr_count(), msgpack::detail::incr_count(), msgpack::detail::unpack_user::referenced(), msgpack::detail::unpack_user::set_referenced(), and msgpack::detail::context< VisitorHolder >::user().
Referenced by visitor().
void msgpack::unpacker::reset_zone | ( | ) |
|
inline |
Skip the specified size of non-parsed buffer.
size | to skip |
Note that the `size' argument must be smaller than nonparsed_size(). This function is usable when non-MessagePack message follows after MessagePack message.
|
inline |
References msgpack::detail::context< VisitorHolder >::data(), msgpack::detail::decr_count(), msgpack::parser< VisitorHolder, ReferencedBufferHook >::get_raw_buffer(), msgpack::detail::incr_count(), msgpack::move(), msgpack::parser< unpacker, zone_push_finalizer >::next(), msgpack::parser< VisitorHolder, ReferencedBufferHook >::next(), msgpack::detail::create_object_visitor::referenced(), release_zone(), msgpack::parser< VisitorHolder, ReferencedBufferHook >::reset(), reset_zone(), msgpack::object_handle::set(), msgpack::unpack(), msgpack::UNPACK_EXTRA_BYTES, msgpack::detail::unpack_imp(), msgpack::UNPACK_SUCCESS, and msgpack::object_handle::zone().