diff --git a/v2_0_cpp_visitor.md b/v2_0_cpp_visitor.md index e849d25..b09a450 100644 --- a/v2_0_cpp_visitor.md +++ b/v2_0_cpp_visitor.md @@ -208,3 +208,27 @@ They are similar to unpack APIs. When you call a parse function, then the parse function callback the visitor that you passed. If parsing process is successfully finished, then the parse function returns true, otherwise returns false. If the visitor's visit function returns false, then the parse function returns false. +You can use visitors with stream interface like an unpacker. + +```C++ +template +class parser +``` + +`VisitorHolder` need to have a function named `visitor()` that returns a reference of the visitor object that satisfies the visitor concept. + +`parser` has the same public member functions as unpacker except `bool next()`. +`unpacker` has the following member functions named `next`: + +```C++ + bool next(msgpack::object_handle& result, bool& referenced); + bool next(msgpack::object_handle& result); +``` + +`parser` has the follwoing member function named `next` + +```C++ + bool next(); +``` + +When you call `next()` then parse one MessagePack formatted data. \ No newline at end of file