diff --git a/v2_0_cpp_visitor.md b/v2_0_cpp_visitor.md index bc6663c..e849d25 100644 --- a/v2_0_cpp_visitor.md +++ b/v2_0_cpp_visitor.md @@ -192,4 +192,19 @@ int main() assert(ret); assert("{\"key\":[42,null,true]}" == json_like); } -``` \ No newline at end of file +``` + +## Parse API +In order to use visitor interface, you need to call parse APIs. Here are parse APIs: + +```C++ +template +bool parse(const char* data, size_t len, size_t& off, Visitor& v); +template +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. +