3#include <CesiumUtility/JsonValue.h>
6#include <rapidjson/fwd.h>
26 static std::optional<double>
37 const rapidjson::Value& tileJson,
38 const std::string& key);
56 const rapidjson::Value& json,
58 const std::string& key);
73 static std::optional<std::vector<double>>
74 getDoubles(
const rapidjson::Value& json, int32_t expectedSize);
86 const rapidjson::Value& json,
87 const std::string& key,
88 const std::string& defaultValue);
98 const rapidjson::Value& json,
99 const std::string& defaultValue);
111 const rapidjson::Value& json,
112 const std::string& key,
113 double defaultValue);
135 const rapidjson::Value& json,
136 const std::string& key,
137 uint32_t defaultValue);
159 const rapidjson::Value& json,
160 const std::string& key,
161 int32_t defaultValue);
183 const rapidjson::Value& json,
184 const std::string& key,
185 uint64_t defaultValue);
207 const rapidjson::Value& json,
208 const std::string& key,
209 int64_t defaultValue);
231 const rapidjson::Value& json,
232 const std::string& key,
251 static std::vector<std::string>
252 getStrings(
const rapidjson::Value& json,
const std::string& key);
261 static std::vector<int64_t>
262 getInt64s(
const rapidjson::Value& json,
const std::string& key);
A collection of helper functions to make reading JSON simpler.
static int32_t getInt32OrDefault(const rapidjson::Value &json, const std::string &key, int32_t defaultValue)
Attempts to obtain a int32_t from the given key on the JSON object, returning a default value if this...
static std::string getStringOrDefault(const rapidjson::Value &json, const std::string &key, const std::string &defaultValue)
Attempts to obtain a string from the given key on the JSON object, returning a default value if this ...
static std::optional< double > getScalarProperty(const rapidjson::Value &tileJson, const std::string &key)
Attempts to read the value at key of tileJson as a double, returning std::nullopt if it wasn't found ...
static bool getBoolOrDefault(const rapidjson::Value &json, bool defaultValue)
Attempts to read json as a bool, returning a default value if this isn't possible.
static uint32_t getUint32OrDefault(const rapidjson::Value &json, uint32_t defaultValue)
Attempts to read json as a uint32_t, returning a default value if this isn't possible.
static std::optional< glm::dmat4x4 > getTransformProperty(const rapidjson::Value &tileJson, const std::string &key)
Attempts to read the value at key of tileJson as a glm::dmat4x4, returning std::nullopt if it wasn't ...
static std::string getStringOrDefault(const rapidjson::Value &json, const std::string &defaultValue)
Attempts to read json as a string, returning a default value if this isn't possible.
static int32_t getInt32OrDefault(const rapidjson::Value &json, int32_t defaultValue)
Attempts to read json as a int32_t, returning a default value if this isn't possible.
static uint32_t getUint32OrDefault(const rapidjson::Value &json, const std::string &key, uint32_t defaultValue)
Attempts to obtain a uint32_t from the given key on the JSON object, returning a default value if thi...
static int64_t getInt64OrDefault(const rapidjson::Value &json, const std::string &key, int64_t defaultValue)
Attempts to obtain a int64_t from the given key on the JSON object, returning a default value if this...
static std::vector< int64_t > getInt64s(const rapidjson::Value &json, const std::string &key)
Attempts to read an int64_t array from the property key of json, returning an empty vector if this is...
static bool getBoolOrDefault(const rapidjson::Value &json, const std::string &key, bool defaultValue)
Attempts to obtain a bool from the given key on the JSON object, returning a default value if this is...
static int64_t getInt64OrDefault(const rapidjson::Value &json, int64_t defaultValue)
Attempts to read json as a int64_t, returning a default value if this isn't possible.
static double getDoubleOrDefault(const rapidjson::Value &json, double defaultValue)
Attempts to read json as a double, returning a default value if this isn't possible.
static std::optional< std::vector< double > > getDoubles(const rapidjson::Value &json, int32_t expectedSize)
Obtains an array of numbers from the given JSON.
static std::optional< std::vector< double > > getDoubles(const rapidjson::Value &json, int32_t expectedSize, const std::string &key)
Obtains an array of numbers from the property that corresponds to the given key in the JSON.
static std::vector< std::string > getStrings(const rapidjson::Value &json, const std::string &key)
Attempts to read an array of strings from the property key of json, returning an empty vector if this...
static uint64_t getUint64OrDefault(const rapidjson::Value &json, const std::string &key, uint64_t defaultValue)
Attempts to obtain a uint64_t from the given key on the JSON object, returning a default value if thi...
static JsonValue toJsonValue(const rapidjson::Value &json)
Converts a rapidjson::Value to a CesiumUtility::JsonValue type.
static uint64_t getUint64OrDefault(const rapidjson::Value &json, uint64_t defaultValue)
Attempts to read json as a uint64_t, returning a default value if this isn't possible.
static double getDoubleOrDefault(const rapidjson::Value &json, const std::string &key, double defaultValue)
Attempts to obtain a double from the given key on the JSON object, returning a default value if this ...
A generic implementation of a value in a JSON structure.
Utility classes for Cesium.