#include <config_reader.h>
|
template<typename P , typename T > |
bool | get_element_inner (const P &parent, const std::string &element_name, T &element_value) |
| Get an element value. More...
|
|
◆ Config_reader()
keyring_common::config::Config_reader::Config_reader |
( |
std::string |
config_file_path | ) |
|
|
explicit |
Constructor.
Reads JSON from config file and stores it in memory.
- Parameters
-
[in] | config_file_path | Full path to configuration file |
◆ get_element() [1/3]
bool keyring_common::config::Config_reader::get_element |
( |
const Config_object & |
parent, |
|
|
const std::string & |
element_name, |
|
|
Config_object & |
element_value |
|
) |
| |
|
inline |
Get an object element value from parent element of JSON document.
- Parameters
-
[in] | parent | parent element |
[in] | element_name | Name of the element being searched |
[out] | element_value | Object element |
- Returns
- status of search operation
- Return values
-
false | Success. Refer to element_value |
true | Failure. |
◆ get_element() [2/3]
bool keyring_common::config::Config_reader::get_element |
( |
const std::string & |
element_name, |
|
|
Config_object & |
element_value |
|
) |
| |
|
inline |
Get an object element from top level of JSON document.
- Parameters
-
[in] | element_name | Name of the element being searched |
[out] | element_value | Object element |
- Returns
- status of search operation
- Return values
-
false | Success. Refer to element_value |
true | Failure. |
◆ get_element() [3/3]
template<typename T >
bool keyring_common::config::Config_reader::get_element |
( |
const std::string & |
element_name, |
|
|
T & |
element_value, |
|
|
const Config_object & |
parent = nullptr |
|
) |
| |
|
inline |
Get an element value from parent element or top level of JSON document.
- Template Parameters
-
T | Type of the element value |
Assumption: Type is compatible with Get() function and type of element is matching with template argument.
- Parameters
-
[in] | element_name | Name of the element being searched |
[out] | element_value | Value of the element |
[in] | parent | Parent element, if null top level is being searched |
- Returns
- status of search operation
- Return values
-
false | Success. Refer to element_value |
true | Failure. |
◆ get_element_inner()
template<typename
P , typename T >
bool keyring_common::config::Config_reader::get_element_inner |
( |
const P & |
parent, |
|
|
const std::string & |
element_name, |
|
|
T & |
element_value |
|
) |
| |
|
inlineprivate |
Get an element value.
- Template Parameters
-
P | Type of the parent |
T | Type of the element value |
Assumption: Type is compatible with Get() function and type of element is matching with template argument.
- Parameters
-
[in] | parent | parent element |
[in] | element_name | Name of the element being searched |
[out] | element_value | Value of the element |
- Returns
- status of search operation
- Return values
-
false | Success. Refer to element_value |
true | Failure. |
◆ is_valid()
bool keyring_common::config::Config_reader::is_valid |
( |
std::string & |
err | ) |
const |
|
inline |
Check if the object is valid, in particular if there was no parse error.
- Parameters
-
[out] | err | when not valid: cause of invalidity |
- Returns
- validity status
- Return values
-
false | object not valid, an error occured while creation |
true | object is valid |
◆ config_file_path_
std::string keyring_common::config::Config_reader::config_file_path_ |
|
private |
◆ data_
rapidjson::Document keyring_common::config::Config_reader::data_ |
|
private |
Configuration data in JSON.
◆ err_
std::string keyring_common::config::Config_reader::err_ |
|
private |
When not valid: cause of invalidity of configuration data.
◆ valid_
bool keyring_common::config::Config_reader::valid_ |
|
private |
Validity of configuration data.
The documentation for this class was generated from the following files: