JsonWrapper#
Currently, this API is unsupported in Python
-
class JsonWrapper#
A wrapper over a JSON tree and json I/O utils.
Public Functions
-
~JsonWrapper()#
-
void init()#
Initializes an empty object.
-
void load(const char *inBuf, int len)#
Loads json data from given char buffer.
- Parameters:
inBuf – [in] buffer to read from
len – [in] length of buffer
-
void load(const std::string &in)#
Loads json data from given string.
- Parameters:
in – [in] string to read from
-
void load(std::istream &in)#
Loads json data from given stream.
- Parameters:
in – [in] stream to read from
-
void loadFromBinary(std::istream &in)#
Loads json data from given stream in binary format.
- Parameters:
in – [in] stream to read from
-
void writeToBinary(std::ostream &out) const#
Write json data from given stream in binary format.
- Parameters:
out – [in] stream to write to
-
void clear()#
Clears data (returns to uninitialized)
-
void print(std::ostream &out, bool pretty) const#
Prints json to out.
- Parameters:
out – [in] stream to write to
pretty – [in] flag indicating whether to add indentation
-
std::string getString(const std::string &key) const#
Retrieves a string value by key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
-
int getInt(const std::string &key) const#
Retrieves an integer value by key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
-
DimInt getDimInt(const std::string &key) const#
Retrieves a DimInt value by key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
-
int64_t getInt64(const std::string &key) const#
Retrieves an int64 value by key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
-
double getDouble(const std::string &key) const#
Retrieves an double value by key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
-
bool getBool(const std::string &key) const#
Retrieves a bool value by key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
-
std::vector<int> getIntArray(const std::string &key) const#
Retrieves an int array value by key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
-
std::vector<double> getDoubleArray(const std::string &key) const#
Retrieves a double array value by key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
-
void setString(const std::string &key, const std::string &value)#
Sets a string value into a key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
value – [in] the string value to put under the given key
-
void setInt(const std::string &key, int value)#
Sets an integer value into a key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
value – [in] the integer value to put under the given key
-
void setDimImt(const std::string &key, DimInt value)#
Sets a DimInt value into a key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
value – [in] the DimInt value to put under the given key
-
void setInt64(const std::string &key, int64_t value)#
Sets an int64 value into a key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
value – [in] the int64 value to put under the given key
-
void setDouble(const std::string &key, double value)#
Sets a double value into a key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
value – [in] the double value to put under the given key
-
void setBool(const std::string &key, bool value)#
Sets a bool value into a key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
value – [in] the bool value to put under the given key
-
void setIntArray(const std::string &key, std::vector<int> value)#
Sets an int array value into a key name, or a path containing several keys delimited by .
- Parameters:
key – [in] key name or path delimited by .
value – [in] the bool value to put under the given key
-
bool doesKeyExist(const std::string &key) const#
Returns an indication for whether a key name, or a path containing several keys delimited by .
exists
- Parameters:
key – [in] key name or path delimited by .
-
std::string toString() const#
Returns a string containing this json data.
-
bool isInitialized() const#
Returns true if this object is initialized (was loaded).
-
JsonSubtree getRoot() const#
Returns JsonSubtree object with the subtree being the root of the JSON structure.
-
std::map<std::string, int64_t> getAsIntMap() const#
Returns a map with all the integer values of the JSON (flatten)
-
std::vector<std::string> getAllKeys() const#
Returns a vector containing all keys of the JSON.
-
~JsonWrapper()#