diff --git a/v_2_0_cpp_x3_parse.md b/v_2_0_cpp_x3_parse.md index d95d905..5bbb134 100644 --- a/v_2_0_cpp_x3_parse.md +++ b/v_2_0_cpp_x3_parse.md @@ -1 +1,59 @@ -# Iterator based parser/unpacker using Spirit.X3 (experimental) \ No newline at end of file +# Iterator based parser/unpacker using Spirit.X3 (experimental) + +## What is this? +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. + +## How to use? + +Define `MSGPACK_USE_X3_PARSE` before including `msgpack.hpp`. It is usually defined via a compiler option such as `-DMSGPACK_USE_X3_PARSE`. + +## Requirements + +* Boost 1.61.0 or later +* C++14 support. + +## APIs + +```cpp +template +inline bool parse(Iterator&& begin, Iterator&& end, Visitor&& vis); +``` + +```cpp +template +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 +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 +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 +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()); + +https://github.com/redboltz/msgpack-c/blob/x3_parse/include/msgpack/v2/x3_parse.hpp#L846 +