JsonAccess.h file
Namespaces
- namespace Jazz2
- Root namespace of Jazz² Resurrection.
- namespace Jazz2::Utils
- Files written safely, JSON files and ZIP archives, compiled only if
WITH_EDITORorWITH_LEVEL_PACKS. - namespace Jazz2::Utils::JsonAccess
- Reads values from JSON that came from outside the game, without trusting their types.
Functions
- auto Member(const Json::Value& value, const char* key) -> const Json::Value&
- Returns a member of an object, or a null value if it's not an object or has no such member.
-
auto ToInt(const Json::Value& value,
std::
int32_t defaultValue) -> std:: int32_t - Returns an integer value, or the default if it's not a number in range.
-
auto ToUInt(const Json::Value& value,
std::
uint32_t defaultValue) -> std:: uint32_t - Returns an unsigned integer value, or the default if it's not a number in range.
- auto ToFloat(const Json::Value& value, float defaultValue) -> float
- Returns a floating-point value, or the default if it's not a finite number.
- auto ToBool(const Json::Value& value, bool defaultValue) -> bool
- Returns a boolean value, or the default if it's not a boolean.
- auto ToString(const Json::Value& value, StringView defaultValue = {}) -> String
- Returns a string value, or the default if it's not a string.
-
auto GetInt(const Json::Value& object,
const char* key,
std::
int32_t defaultValue) -> std:: int32_t - Returns an integer member of an object, or the default.
-
auto GetUInt(const Json::Value& object,
const char* key,
std::
uint32_t defaultValue) -> std:: uint32_t - Returns an unsigned integer member of an object, or the default.
- auto GetFloat(const Json::Value& object, const char* key, float defaultValue) -> float
- Returns a floating-point member of an object, or the default.
- auto GetBool(const Json::Value& object, const char* key, bool defaultValue) -> bool
- Returns a boolean member of an object, or the default.
- auto GetString(const Json::Value& object, const char* key, StringView defaultValue = {}) -> String
- Returns a string member of an object, or the default.