-
Notifications
You must be signed in to change notification settings - Fork 903
v_2_0_cpp_x3_parse
It is a new parser using Boost.Spirit.X3(experimental). Boost.Spirit.X3 is experimental feature, so the iterator based parser/unpacker is also an experimental feature.
Here is the parser code.
See https://github.com/redboltz/msgpack-c/blob/x3_parse/include/msgpack/v2/x3_parse.hpp
It is quite small. It is completely separete from existing parser/unpacker. The existing parser/unpacker takes the pointer and the size of buffer, but iterator based unpacker/parser takes begin/end iterator pair.
Define MSGPACK_USE_X3_PARSE
before including msgpack.hpp
. It is usually defined via a compiler option such as -DMSGPACK_USE_X3_PARSE
.
- Boost 1.61.0 or later
- C++14 support.
template <typename Iterator, typename Visitor>
inline bool parse(Iterator&& begin, Iterator&& end, Visitor&& vis);
Visitor
need to satisfy visitor concept.
If begin
is non-const lvalue, then it will be updated after successfully parsed.
See an example.
template <typename Iterator>
msgpack::object_handle unpack(
Iterator&& begin, Iterator&& end,
bool& referenced,
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
unpack_limit const& limit = unpack_limit());
template <typename Iterator>
msgpack::object_handle unpack(
Iterator&& begin, Iterator&& end,
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
unpack_limit const& limit = unpack_limit());
template <typename Iterator>
msgpack::object unpack(
msgpack::zone& z,
Iterator&& begin, Iterator&& end,
bool& referenced,
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
unpack_limit const& limit = unpack_limit());
template <typename Iterator>
msgpack::object unpack(
msgpack::zone& z,
Iterator&& begin, Iterator&& end,
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
unpack_limit const& limit = unpack_limit());
They are similar to https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_unpacker#client-controls-a-buffer. The APIs take a pair of iterators instead of data and len.
See an example.
-
Home
- Q&A
- v2.0.x or later
- v1.1.x - v1.4.x
- v1.0.x