MCPcopy Create free account
hub / github.com/Tencent/rapidjson / ParseMessages

Function ParseMessages

example/messagereader/messagereader.cpp:75–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73#endif
74
75static void ParseMessages(const char* json, MessageMap& messages) {
76 Reader reader;
77 MessageHandler handler;
78 StringStream ss(json);
79 if (reader.Parse(ss, handler))
80 messages.swap(handler.messages_); // Only change it if success.
81 else {
82 ParseErrorCode e = reader.GetParseErrorCode();
83 size_t o = reader.GetErrorOffset();
84 cout << "Error: " << GetParseError_En(e) << endl;;
85 cout << " at offset " << o << " near '" << string(json).substr(o, 10) << "...'" << endl;
86 }
87}
88
89int main() {
90 MessageMap messages;

Callers 1

mainFunction · 0.85

Calls 4

swapMethod · 0.80
ParseMethod · 0.45
GetParseErrorCodeMethod · 0.45
GetErrorOffsetMethod · 0.45

Tested by

no test coverage detected