A front-end utility class aimed to simplify the use of RapidJSON tools.
#include <utility/YiRapidJSONUtility.h>
Public Member Functions | |
virtual | ~CYIRapidJSONUtility ()=default |
Static Public Member Functions | |
static CYIString | TypeToString (yi::rapidjson::Type type) |
static std::unique_ptr< yi::rapidjson::Document > | CreateDocumentFromString (const CYIString &rJsonString, CYIParsingError &rParsingError) |
static yi::rapidjson::Document | CreateMoveableDocumentFromString (const CYIString &rJsonString, CYIParsingError &rParsingError) |
static std::unique_ptr< yi::rapidjson::Document > | CreateDocumentFromFile (const CYIString &rFilePath, CYIParsingError &rParsingError) |
static yi::rapidjson::Document | CreateMoveableDocumentFromFile (const CYIString &rFilePath, CYIParsingError &rParsingError) |
static CYIString | CreateStringFromDocument (const yi::rapidjson::Document &rDocument) |
template<typename Encoding , typename Allocator > | |
static CYIString | CreateStringFromValue (const yi::rapidjson::GenericValue< Encoding, Allocator > &rGenericValue) |
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 *pFieldIsNull, CYIParsingError &rParsingError) |
static bool | AddBooleanField (yi::rapidjson::Document *pDocument, const CYIString &rFieldName, bool value) |
static bool | AddIntegerField (yi::rapidjson::Document *pDocument, const CYIString &rFieldName, int32_t value) |
static bool | AddLongField (yi::rapidjson::Document *pDocument, const CYIString &rFieldName, int64_t value) |
static bool | AddUnsignedLongField (yi::rapidjson::Document *pDocument, const CYIString &rField, uint64_t value) |
static bool | AddFloatField (yi::rapidjson::Document *pDocument, const CYIString &rFieldName, float value) |
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) |
|
virtualdefault |
|
static |
Adds a new boolean field, value, to the RapidJSON pDocument for the given rFieldName.
|
static |
Adds a new float field, value, to the RapidJSON pDocument for the given rFieldName.
|
static |
Adds a new integer field, value, to the RapidJSON pDocument for the given rFieldName.
|
static |
Adds a new long field, value, 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, value, 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 |
Creates a RapidJSON Document containing the parsed data from the file at the given rFilePath. Parsing errors will be returned in rParsingError.
|
static |
Creates a RapidJSON Document 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 |
Returns a CYIString representation of the RapidJSON GenericValue.
|
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 pFieldIsNull 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.
|
static |
Returns a string representation of the RapidJSON value type.