msgpack::parser< VisitorHolder, ReferencedBufferHook > Class Template Reference

Parsing class for a stream deserialization. More...

`#include <parse.hpp>`

Inheritance diagram for msgpack::parser< VisitorHolder, ReferencedBufferHook >:

## Public Member Functions

| parser (ReferencedBufferHook &hook, std::size_t initial_buffer_size=MSGPACK_UNPACKER_INIT_BUFFER_SIZE)
| Constructor. More...
| parser (this_type &&other)
this_type & | operator= (this_type &&other)
| ~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 ()
| parser (const this_type &)=delete
this_type & | operator= (const this_type &)=delete
Public Member Functions inherited from msgpack::detail::context< VisitorHolder >
| context (unpack_reference_func f, void *user_data, unpack_limit const &limit)
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)
| context ()
void | init ()
parse_return | execute (const char *data, std::size_t len, std::size_t &off)
template<>
void | check_ext_size (std::size_t size)

## Protected Member Functions

char * | get_raw_buffer ()

## Detailed Description

### template<typename VisitorHolder, typename ReferencedBufferHook>
class msgpack::parser< VisitorHolder, ReferencedBufferHook >

Parsing class for a stream deserialization.

## Constructor & Destructor Documentation

## parser() [1/3]

template<typename VisitorHolder , typename ReferencedBufferHook>

msgpack::parser< VisitorHolder, ReferencedBufferHook >::parser | ( | ReferencedBufferHook & | hook,
|  | std::size_t | initial_buffer_size = `MSGPACK_UNPACKER_INIT_BUFFER_SIZE`
| ) |  |

inline

Constructor.

Parameters

  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.

## parser() [2/3]

template<typename VisitorHolder , typename ReferencedBufferHook>

msgpack::parser< VisitorHolder, ReferencedBufferHook >::parser | ( | this_type && | other | ) |

inline

## ~parser()

template<typename VisitorHolder , typename ReferencedBufferHook >

msgpack::parser< VisitorHolder, ReferencedBufferHook >::~parser | ( |  | ) |

inline

## parser() [3/3]

template<typename VisitorHolder, typename ReferencedBufferHook>

msgpack::parser< VisitorHolder, ReferencedBufferHook >::parser | ( | const this_type & |  | ) |

delete

## Member Function Documentation

## buffer()

template<typename VisitorHolder , typename ReferencedBufferHook >

char * msgpack::parser< VisitorHolder, ReferencedBufferHook >::buffer | ( |  | ) |

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

## buffer_capacity()

template<typename VisitorHolder , typename ReferencedBufferHook >

std::size_t msgpack::parser< VisitorHolder, ReferencedBufferHook >::buffer_capacity | ( |  | ) | const

inline

Get buffer capacity.

Returns
  The memory size that you can write.

See: https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_unpacker#msgpack-controls-a-buffer

## buffer_consumed()

template<typename VisitorHolder , typename ReferencedBufferHook >

void msgpack::parser< VisitorHolder, ReferencedBufferHook >::buffer_consumed | ( | std::size_t | size | ) |

inline

Notify a buffer consumed information to msgpack::unpacker.

Parameters

  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

## get_raw_buffer()

template<typename VisitorHolder, typename ReferencedBufferHook>

char* msgpack::parser< VisitorHolder, ReferencedBufferHook >::get_raw_buffer | ( |  | ) |

inline protected

## message_size()

template<typename VisitorHolder , typename ReferencedBufferHook >

std::size_t msgpack::parser< VisitorHolder, ReferencedBufferHook >::message_size | ( |  | ) | const

inline

Get message size.

Returns
  Returns parsed_size() + nonparsed_size()

## next()

template<typename VisitorHolder , typename ReferencedBufferHook >

bool msgpack::parser< VisitorHolder, ReferencedBufferHook >::next | ( |  | ) |

inline

Unpack one msgpack::object.

Returns
  If one msgpack::object is unpacked, then return true, if msgpack::object is incomplete and additional data is required, then return false. If data format is invalid, throw msgpack::parse_error.

See: https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_unpacker#msgpack-controls-a-buffer

## nonparsed_buffer()

template<typename VisitorHolder , typename ReferencedBufferHook >

char * msgpack::parser< VisitorHolder, ReferencedBufferHook >::nonparsed_buffer | ( |  | ) |

inline

Get the address that is not parsed in the buffer.

Returns
  Address of the buffer that is not parsed

This function is usable when non-MessagePack message follows after MessagePack message.

## nonparsed_size()

template<typename VisitorHolder , typename ReferencedBufferHook >

std::size_t msgpack::parser< VisitorHolder, ReferencedBufferHook >::nonparsed_size | ( |  | ) | const

inline

Get the size of the buffer that is not parsed.

Returns
  Size of the buffer that is not parsed

This function is usable when non-MessagePack message follows after MessagePack message.

## operator=() [1/2]

template<typename VisitorHolder , typename ReferencedBufferHook >

parser< VisitorHolder, ReferencedBufferHook > & msgpack::parser< VisitorHolder, ReferencedBufferHook >::operator= | ( | this_type && | other | ) |

inline

## operator=() [2/2]

template<typename VisitorHolder, typename ReferencedBufferHook>

this_type& msgpack::parser< VisitorHolder, ReferencedBufferHook >::operator= | ( | const this_type & |  | ) |

delete

## parsed_size()

template<typename VisitorHolder , typename ReferencedBufferHook >

std::size_t msgpack::parser< VisitorHolder, ReferencedBufferHook >::parsed_size | ( |  | ) | const

inline

Get parsed message size.

Returns
  Parsed message size.

This function is usable when non-MessagePack message follows after MessagePack message.

## remove_nonparsed_buffer()

template<typename VisitorHolder , typename ReferencedBufferHook >

void msgpack::parser< VisitorHolder, ReferencedBufferHook >::remove_nonparsed_buffer | ( |  | ) |

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.

## reserve_buffer()

template<typename VisitorHolder , typename ReferencedBufferHook >

void msgpack::parser< VisitorHolder, ReferencedBufferHook >::reserve_buffer | ( | std::size_t | size = `MSGPACK_UNPACKER_RESERVE_SIZE` | ) |

inline

Reserve a buffer memory.

Parameters

  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

## reset()

template<typename VisitorHolder , typename ReferencedBufferHook >

void msgpack::parser< VisitorHolder, ReferencedBufferHook >::reset | ( |  | ) |

inline

## skip_nonparsed_buffer()

template<typename VisitorHolder , typename ReferencedBufferHook >

void msgpack::parser< VisitorHolder, ReferencedBufferHook >::skip_nonparsed_buffer | ( | std::size_t | size | ) |

inline

Skip the specified size of non-parsed buffer.

Parameters

  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.

The documentation for this class was generated from the following file:

- /build/msgpack-c-9A5dfz/msgpack-c-2.1.5/include/msgpack/v2/parse.hpp