mirror of
https://github.com/msgpack/msgpack-c
synced 2026-06-08 16:11:40 +00:00
Updated v2_0_cpp_visitor (markdown)
+16
-1
@@ -192,4 +192,19 @@ int main()
|
||||
assert(ret);
|
||||
assert("{\"key\":[42,null,true]}" == json_like);
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
## Parse API
|
||||
In order to use visitor interface, you need to call parse APIs. Here are parse APIs:
|
||||
|
||||
```C++
|
||||
template <typename Visitor>
|
||||
bool parse(const char* data, size_t len, size_t& off, Visitor& v);
|
||||
template <typename Visitor>
|
||||
bool parse(const char* data, size_t len, Visitor& v);
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user