JSONBase class
Base class to interact with JSON serialization library.
Contents
Derived classes
Public functions
- auto deserializeFromFile(const std::string& filePath) -> bool
- Deserialize from JSON in file helper.
- auto serializeToFile(const std::string& filePath) const -> bool
- Serialize JSON format to file helper.
- auto serialize() const -> std::string virtual
- Serialize JSON writer helper.
- auto deserialize(const std::string& s) -> bool virtual
- Deserialize helper from JSON in string.
- auto deserialize(const rapidjson::Value& obj) -> bool pure virtual
- Serialize JSON writer helper.
Protected functions
- auto initDocument(const std::string& s, rapidjson::Document& doc) const -> bool
- Validate and initialize JSON formatted document.
Function documentation
bool piac:: JSONBase:: deserializeFromFile(const std::string& filePath)
Deserialize from JSON in file helper.
| Parameters | |
|---|---|
| filePath in | Filename containing JSON format to deserialize |
| Returns | True if successful |
bool piac:: JSONBase:: serializeToFile(const std::string& filePath) const
Serialize JSON format to file helper.
| Parameters | |
|---|---|
| filePath in | Filename to write JSON to |
| Returns | True if successful |
std::string piac:: JSONBase:: serialize() const virtual
Serialize JSON writer helper.
| Returns | Serialized JSON data |
|---|
bool piac:: JSONBase:: deserialize(const std::string& s) virtual
Deserialize helper from JSON in string.
| Parameters | |
|---|---|
| s in | String containing JSON format to deserialize |
| Returns | True if successful |
bool piac:: JSONBase:: initDocument(const std::string& s,
rapidjson::Document& doc) const protected
Validate and initialize JSON formatted document.
| Parameters | |
|---|---|
| s in | String containing JSON formatted data |
| doc in/out | JSON document to store data in |
| Returns | True if JSON is valid |