Electroneum
pretty.cpp File Reference
Include dependency graph for pretty.cpp:

Go to the source code of this file.

Functions

int main (int, char *[])
 

Function Documentation

◆ main()

int main ( int  ,
char *  [] 
)

Definition at line 12 of file pretty.cpp.

12  {
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));
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 }
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
Definition: reader.h:557
File byte stream for input using fread().
Writer with indentation and spacing.
Definition: fwd.h:100
RAPIDJSON_NAMESPACE_BEGIN const RAPIDJSON_ERROR_CHARTYPE * GetParseError_En(ParseErrorCode parseErrorCode)
Maps error code of parsing into error message.
Definition: en.h:36
ParseErrorCode GetParseErrorCode() const
Get the ParseErrorCode of last parsing.
Definition: reader.h:683
Validate encoding of JSON strings.
Definition: reader.h:148
size_t GetErrorOffset() const
Get the position of last parsing error in input, 0 otherwise.
Definition: reader.h:686
Wrapper of C file stream for output using fwrite().
Here is the call graph for this function: