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

Function main

example/pretty/pretty.cpp:12–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace rapidjson;
11
12int main(int, char*[]) {
13 // Prepare reader and input stream.
14 Reader reader;
15 char readBuffer[65536];
16 FileReadStream is(stdin, readBuffer, sizeof(readBuffer));
17
18 // Prepare writer and output stream.
19 char writeBuffer[65536];
20 FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
21 PrettyWriter<FileWriteStream> writer(os);
22
23 // JSON reader parse from the input stream and let writer generate the output.
24 if (!reader.Parse<kParseValidateEncodingFlag>(is, writer)) {
25 fprintf(stderr, "\nError(%u): %s\n", static_cast<unsigned>(reader.GetErrorOffset()), GetParseError_En(reader.GetParseErrorCode()));
26 return 1;
27 }
28
29 return 0;
30}

Callers

nothing calls this directly

Calls 2

GetErrorOffsetMethod · 0.45
GetParseErrorCodeMethod · 0.45

Tested by

no test coverage detected