diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index bec6a8c..e16e3c9 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -18,6 +18,7 @@ set(EXAMPLES serialize simpledom simplereader + simplepullreader simplewriter tutorial) diff --git a/example/simplepullreader/simplepullreader.cpp b/example/simplepullreader/simplepullreader.cpp index 0cce08b..af8d5a7 100644 --- a/example/simplepullreader/simplepullreader.cpp +++ b/example/simplepullreader/simplepullreader.cpp @@ -9,19 +9,19 @@ struct MyHandler { std::string data; bool Null() { type = "Null"; data.clear(); return true; } - bool Bool(bool b) { type = "Bool"; data = b? "true": "false"; return true; } - bool Int(int i) { type = "Int"; data = std::to_string(i); return true; } - bool Uint(unsigned u) { type = "Uint"; data = std::to_string(u); return true; } - bool Int64(int64_t i) { type = "Int64"; data = std::to_string(i); return true; } - bool Uint64(uint64_t u) { type = "Uint64"; data = std::to_string(u); return true; } - bool Double(double d) { type = "Double"; data = std::to_string(d); return true; } - bool RawNumber(const char* str, SizeType length, bool) { type = "Number"; data = std::string(str, length); return true; } - bool String(const char* str, SizeType length, bool) { type = "String" data = std::string(str, length); return true; } + bool Bool(bool b) { type = "Bool:"; data = b? "true": "false"; return true; } + bool Int(int i) { type = "Int:"; data = std::to_string(i); return true; } + bool Uint(unsigned u) { type = "Uint:"; data = std::to_string(u); return true; } + bool Int64(int64_t i) { type = "Int64:"; data = std::to_string(i); return true; } + bool Uint64(uint64_t u) { type = "Uint64:"; data = std::to_string(u); return true; } + bool Double(double d) { type = "Double:"; data = std::to_string(d); return true; } + bool RawNumber(const char* str, SizeType length, bool) { type = "Number:"; data = std::string(str, length); return true; } + bool String(const char* str, SizeType length, bool) { type = "String:"; data = std::string(str, length); return true; } bool StartObject() { type = "StartObject"; data.clear(); return true; } - bool Key(const char* str, SizeType length, bool) { type = "Key" data = std::string(str, length); return true; } - bool EndObject(SizeType memberCount) { type = "EndObject"; data = std::to_string(memberCount); return true; } + bool Key(const char* str, SizeType length, bool) { type = "Key:"; data = std::string(str, length); return true; } + bool EndObject(SizeType memberCount) { type = "EndObject:"; data = std::to_string(memberCount); return true; } bool StartArray() { type = "StartArray"; data.clear(); return true; } - bool EndArray(SizeType elementCount) { type = "EndArray"; data = std::to_string(elementCount); return true; } + bool EndArray(SizeType elementCount) { type = "EndArray:"; data = std::to_string(elementCount); return true; } }; int main() { @@ -33,7 +33,7 @@ int main() { reader.IterativeParseInit(); while (!reader.IterativeParseComplete()) { reader.IterativeParseNext(ss, handler); - cout << handler.type << ": " << handler.data << endl; + cout << handler.type << handler.data << endl; } return 0;