mirror of
https://github.com/msgpack/msgpack-c
synced 2026-06-08 16:11:40 +00:00
Updated v2_0_cpp_visitor (markdown)
@@ -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 <typename VisitorHolder, typename ReferencedBufferHook>
|
||||
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.
|
||||
Reference in New Issue
Block a user