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=MSGPACK_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... | |
Unpacking class for a stream deserialization.
|
inline |
Constructor.
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 |
References MSGPACK_NULLPTR.
|
inline |
References msgpack::detail::decr_count().
Referenced by operator=().
|
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
References msgpack::type::size().
|
inline |
for backward compatibility
References msgpack::detail::context< VisitorHolder >::data().
Referenced by next().
|
inline |
for backward compatibility
|
inline |
Get message size.
|
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 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. [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.
Referenced by next().
|
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 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_NULLPTR, msgpack::detail::unpack_user::set_zone(), and msgpack::detail::context< VisitorHolder >::user().
Referenced by next().
|
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 msgpack::type::size().
|
inline |
for backward compatibility
References msgpack::detail::context< VisitorHolder >::init().
Referenced by next().
|
inline |
for backward compatibility
|
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.
References msgpack::type::size().