Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
jsonx.cpp File Reference
#include "rapidjson/reader.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/filereadstream.h"
#include "rapidjson/filewritestream.h"
#include "rapidjson/error/en.h"
#include <cstdio>
Include dependency graph for jsonx.cpp:

Go to the source code of this file.

Classes

class  JsonxWriter< OutputStream >
 

Functions

int main (int, char *[])
 

Function Documentation

◆ main()

int main ( int ,
char * [] )

Definition at line 189 of file jsonx.cpp.

189 {
190 // Prepare JSON reader and input stream.
191 Reader reader;
192 char readBuffer[65536];
193 FileReadStream is(stdin, readBuffer, sizeof(readBuffer));
194
195 // Prepare JSON writer and output stream.
196 char writeBuffer[65536];
197 FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
199
200 // JSON reader parse from the input stream and let writer generate the output.
201 if (!reader.Parse(is, writer)) {
202 fprintf(stderr, "\nError(%u): %s\n", static_cast<unsigned>(reader.GetErrorOffset()), GetParseError_En(reader.GetParseErrorCode()));
203 return 1;
204 }
205
206 return 0;
207}
File byte stream for input using fread().
Wrapper of C file stream for output using fwrite().
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
Definition reader.h:557
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
os_t os
RAPIDJSON_NAMESPACE_BEGIN const RAPIDJSON_ERROR_CHARTYPE * GetParseError_En(ParseErrorCode parseErrorCode)
Maps error code of parsing into error message.
Definition en.h:36
Here is the call graph for this function: