From 75fe8ba67491a3a49b0db6a39270fcdc119c88f8 Mon Sep 17 00:00:00 2001 From: Takatoshi Kondo Date: Thu, 26 May 2016 20:43:46 +0900 Subject: [PATCH] Updated v2_0_cpp_visitor (markdown) --- v2_0_cpp_visitor.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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. +