A wrapper over a JSON tree and json I/O utils. More...
#include <JsonWrapper.h>
Public Member Functions | |
| void | init () |
| Initializes an empty object. | |
| void | load (const char *inBuf, int len) |
| Loads json data from given char buffer. More... | |
| void | load (const std::string &in) |
| Loads json data from given string. More... | |
| void | load (std::istream &in) |
| Loads json data from given stream. More... | |
| void | loadFromBinary (std::istream &in) |
| Loads json data from given stream in binary format. More... | |
| void | writeToBinary (std::ostream &out) const |
| Write json data from given stream in binary format. More... | |
| void | clear () |
| Clears data (returns to uninitialized) | |
| void | print (std::ostream &out, bool pretty) const |
| Prints json to out. More... | |
| std::string | getString (const std::string &key) const |
| Retrieves a string value by key name, or a path containing several keys delimited by . More... | |
| int | getInt (const std::string &key) const |
| Retrieves an integer value by key name, or a path containing several keys delimited by . More... | |
| double | getDouble (const std::string &key) const |
| Retrieves an double value by key name, or a path containing several keys delimited by . More... | |
| 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 . More... | |
| void | setInt (const std::string &key, int value) |
| Sets an integer value into a key name, or a path containing several keys delimited by . More... | |
| void | setDouble (const std::string &key, double value) |
| Sets a double value into a key name, or a path containing several keys delimited by . More... | |
| 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. | |
Detailed Description
A wrapper over a JSON tree and json I/O utils.
Member Function Documentation
◆ getDouble()
| double helayers::JsonWrapper::getDouble | ( | const std::string & | key | ) | const |
Retrieves an double value by key name, or a path containing several keys delimited by .
- Parameters
-
[in] key key name or path delimited by .
◆ getInt()
| int helayers::JsonWrapper::getInt | ( | const std::string & | key | ) | const |
Retrieves an integer value by key name, or a path containing several keys delimited by .
- Parameters
-
[in] key key name or path delimited by .
◆ getString()
| string helayers::JsonWrapper::getString | ( | const std::string & | key | ) | const |
Retrieves a string value by key name, or a path containing several keys delimited by .
- Parameters
-
[in] key key name or path delimited by .
◆ load() [1/3]
| void helayers::JsonWrapper::load | ( | const char * | inBuf, |
| int | len | ||
| ) |
Loads json data from given char buffer.
- Parameters
-
[in] inBuf buffer to read from [in] len length of buffer
◆ load() [2/3]
| void helayers::JsonWrapper::load | ( | const std::string & | in | ) |
Loads json data from given string.
- Parameters
-
[in] in string to read from
◆ load() [3/3]
| void helayers::JsonWrapper::load | ( | std::istream & | in | ) |
Loads json data from given stream.
- Parameters
-
[in] in stream to read from
◆ loadFromBinary()
| void helayers::JsonWrapper::loadFromBinary | ( | std::istream & | in | ) |
Loads json data from given stream in binary format.
- Parameters
-
[in] in stream to read from
◆ print()
| void helayers::JsonWrapper::print | ( | std::ostream & | out, |
| bool | pretty | ||
| ) | const |
Prints json to out.
- Parameters
-
[in] out stream to write to [in] pretty flag indicating whether to add indentation
◆ setDouble()
| void helayers::JsonWrapper::setDouble | ( | const std::string & | key, |
| double | value | ||
| ) |
Sets a double value into a key name, or a path containing several keys delimited by .
- Parameters
-
[in] key key name or path delimited by . [in] value the double value to put under the given key
◆ setInt()
| void helayers::JsonWrapper::setInt | ( | const std::string & | key, |
| int | value | ||
| ) |
Sets an integer value into a key name, or a path containing several keys delimited by .
- Parameters
-
[in] key key name or path delimited by . [in] value the integer value to put under the given key
◆ setString()
| void helayers::JsonWrapper::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
-
[in] key key name or path delimited by . [in] value the string value to put under the given key
◆ writeToBinary()
| void helayers::JsonWrapper::writeToBinary | ( | std::ostream & | out | ) | const |
Write json data from given stream in binary format.
- Parameters
-
[in] out stream to write to
The documentation for this class was generated from the following files:
- /opt/IBM/FHE-distro/ML-HElib/src/helayers/hebase/utils/JsonWrapper.h
- /opt/IBM/FHE-distro/ML-HElib/src/helayers/hebase/utils/JsonWrapper.cpp
1.8.17