Electroneum
capitalize.cpp File Reference
#include "rapidjson/reader.h"
#include "rapidjson/writer.h"
#include "rapidjson/filereadstream.h"
#include "rapidjson/filewritestream.h"
#include "rapidjson/error/en.h"
#include <vector>
#include <cctype>
Include dependency graph for capitalize.cpp:

Go to the source code of this file.

Classes

struct  CapitalizeFilter< OutputHandler >
 

Functions

int main (int, char *[])
 

Function Documentation

◆ main()

int main ( int  ,
char *  [] 
)

Definition at line 48 of file capitalize.cpp.

48  {
49  // Prepare JSON reader and input stream.
50  Reader reader;
51  char readBuffer[65536];
52  FileReadStream is(stdin, readBuffer, sizeof(readBuffer));
53 
54  // Prepare JSON writer and output stream.
55  char writeBuffer[65536];
56  FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
57  Writer<FileWriteStream> writer(os);
58 
59  // JSON reader parse from the input stream and let writer generate the output.
61  if (!reader.Parse(is, filter)) {
62  fprintf(stderr, "\nError(%u): %s\n", static_cast<unsigned>(reader.GetErrorOffset()), GetParseError_En(reader.GetParseErrorCode()));
63  return 1;
64  }
65 
66  return 0;
67 }
JSON writer.
Definition: fwd.h:95
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
Definition: reader.h:557
File byte stream for input using fread().
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
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: