Updated v2_0_cpp_visitor (markdown)

Takatoshi Kondo
2016-05-26 20:43:46 +09:00
parent e7f533be8c
commit 75fe8ba674
+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.