A front-end utility class aimed to simplify the use of RapidJSON tools.
#include <utility/YiRapidJSONUtility.h>
Public Member Functions | |
| virtual | ~CYIRapidJSONUtility () |
Static Public Member Functions | |
| static std::unique_ptr< yi::rapidjson::Document > | CreateDocumentFromString (const CYIString &rJsonString, CYIParsingError &rParsingError) |
| static std::unique_ptr< yi::rapidjson::Document > | CreateDocumentFromFile (const CYIString &rFilePath, CYIParsingError &rParsingError) |
| static CYIString | CreateStringFromDocument (const yi::rapidjson::Document &rDocument) |
| static bool | GetBooleanField (const yi::rapidjson::Value *pValue, const char *pFieldName, bool *pFieldData, CYIParsingError &rParsingError) |
| static bool | GetIntegerField (const yi::rapidjson::Value *pValue, const char *pFieldName, int32_t *pFieldData, CYIParsingError &rParsingError) |
| static bool | GetLongField (const yi::rapidjson::Value *pValue, const char *pFieldName, int64_t *pFieldData, CYIParsingError &rParsingError) |
| static bool | GetUnsignedLongField (const yi::rapidjson::Value *pValue, const char *pFieldName, uint64_t *pFieldData, CYIParsingError &rParsingError) |
| static bool | GetStringField (const yi::rapidjson::Value *pValue, const char *pFieldName, CYIString &rFieldData, CYIParsingError &rParsingError) |
| static bool | GetFloatField (const yi::rapidjson::Value *pValue, const char *pFieldName, float *pFieldData, CYIParsingError &rParsingError) |
| static bool | GetDateField (const yi::rapidjson::Value *pValue, const char *pFieldName, CYIDateTime &rFieldData, CYIParsingError &rParsingError) |
| static bool | IsNullField (const yi::rapidjson::Value *pValue, const char *pFieldName, bool *pbFieldIsNull, CYIParsingError &rParsingError) |
| static bool | AddBooleanField (yi::rapidjson::Document *pDocument, const CYIString &rFieldName, bool bValue) |
| static bool | AddIntegerField (yi::rapidjson::Document *pDocument, const CYIString &rFieldName, int32_t nValue) |
| static bool | AddLongField (yi::rapidjson::Document *pDocument, const CYIString &rFieldName, int64_t nValue) |
| static bool | AddUnsignedLongField (yi::rapidjson::Document *pDocument, const CYIString &rField, uint64_t uValue) |
| static bool | AddFloatField (yi::rapidjson::Document *pDocument, const CYIString &rFieldName, float fValue) |
| static bool | AddObjectField (yi::rapidjson::Document *pDocument, const CYIString &rFieldName, yi::rapidjson::Value &rValue) |
| static bool | AddStringField (yi::rapidjson::Document *pDocument, const CYIString &rFieldName, const CYIString &rValue) |
|
virtual |
|
static |
Adds a new boolean field, bValue, to the RapidJSON pDocument for the given rFieldName.
|
static |
Adds a new float field, fValue, to the RapidJSON pDocument for the given rFieldName.
|
static |
Adds a new integer field, nValue, to the RapidJSON pDocument for the given rFieldName.
|
static |
Adds a new long field, nValue, to the RapidJSON pDocument for the given rFieldName.
|
static |
Adds a new RapidJSon object field, rValue, to the RapidJSON pDocument for the given rFieldName.
|
static |
Adds a new CYIString field, rValue, to the RapidJSON pDocument for the given rFieldName.
|
static |
Adds a new unsigned long field, nValue, to the RapidJSON pDocument for the given rFieldName.
|
static |
Creates a new RapidJSON Document object containing the parsed data from the file at the given rFilePath. Parsing errors will be returned in rParsingError.
|
static |
Creates a new RapidJSON Document object containing the parsed data from the given rJsonString. Parsing errors will be returned in rParsingError.
|
static |
Returns a CYIString representation of the RapidJSON Document.
|
static |
Retrieves pFieldData as a boolean given a RapidJSON pValue and a pFieldName. In addition to reading Boolean data type, Number values of 1 and 0 and String values of "1", "0", "true" and "false" are all successfully read. pFieldData is only modified if parsing is successful (and function returns true) Returns false on error with rParsingError populated with error information from the last parsing error. Json value 'null' also returns false.
|
static |
Retrieves pFieldData as a CYIDateTime given a RapidJSON pValue and a pFieldName. pFieldData is only modified if parsing is successful (and function returns true) Returns false on error with rParsingError populated with error information from the last parsing error. Json value 'null' also returns false.
|
static |
Retrieves pFieldData as a float given a RapidJSON pValue and a pFieldName. In addition to reading Number data type, also reads String values containing a numeric value. pFieldData is only modified if parsing is successful (and function returns true) Returns false on error with rParsingError populated with error information from the last parsing error. Json value 'null' also returns false.
|
static |
Retrieves pFieldData as an integer given a RapidJSON pValue and a pFieldName. In addition to reading Number data type, also reads String values containing a numeric value. pFieldData is only modified if parsing is successful (and function returns true) Returns false on error with rParsingError populated with error information from the last parsing error. Json value 'null' also returns false.
|
static |
Retrieves pFieldData as a long given a RapidJSON pValue and a pFieldName. In addition to reading Number data type, also reads String values containing a numeric value. pFieldData is only modified if parsing is successful (and function returns true) Returns false on error with rParsingError populated with error information from the last parsing error. Json value 'null' also returns false.
|
static |
Retrieves pFieldData as a CYIString given a RapidJSON pValue and a pFieldName. pFieldData is only modified if parsing is successful (and function returns true) Returns false on error with rParsingError populated with error information from the last parsing error. Json value 'null' also returns false.
|
static |
Retrieves pFieldData as an unsigned long given a RapidJSON pValue and a pFieldName. In addition to reading Number data type, also reads String values containing a numeric value. pFieldData is only modified if parsing is successful (and function returns true) Returns false on error with rParsingError populated with error information from the last parsing error. Json value 'null' also returns false.
|
static |
Sets pbFieldIsNull to true if the pFieldName contained within the RapidJSON pValue is null and false otherwise. Returns true when parsing the field succeeded and false otherwise. When false is returned rParsingError will be populated.