MySQL 8.4.2
Source Code Documentation
|
Base Json_reader. More...
#include <json_reader.h>
Public Member Functions | |
Json_reader (const std::string schema, const std::string data, const std::string version_key="version", const std::string array_key="elements") | |
Constructor. More... | |
Json_reader (const std::string data) | |
Constructor. More... | |
Json_reader () | |
virtual | ~Json_reader ()=default |
Destructor. More... | |
std::string | version () const |
Get version info. More... | |
size_t | num_elements () const |
Get number of elements in the document. More... | |
virtual bool | get_element (size_t index, meta::Metadata &metadata, data::Data &data, std::unique_ptr< Json_data_extension > &json_data_extension) const |
Fetch element from given position. More... | |
virtual bool | get_elements (output_vector &output) const |
Get all elements. More... | |
bool | valid () const |
Private Attributes | |
rapidjson::Document | document_ |
Data in JSON DOM format. More... | |
const std::string | version_key_ |
Version key. More... | |
const std::string | array_key_ |
user specific elements array key More... | |
bool | valid_ |
Validity of the data. More... | |
Base Json_reader.
Expected format for version 1.0 { "version": "1.0", "elements": [ { "user": "<user_name>", "data_id": "<name>", "data_type": "<data_type>", "data": "<hex_of_data>", "extension": [ ] }, ... ... ] }
keyring_common::json_data::Json_reader::Json_reader | ( | const std::string | schema, |
const std::string | data, | ||
const std::string | version_key = "version" , |
||
const std::string | array_key = "elements" |
||
) |
Constructor.
[in] | schema | JSON schema in string format |
[in] | data | JSON data in string format |
[in] | version_key | JSON schema version information |
[in] | array_key | Key for array of elements |
keyring_common::json_data::Json_reader::Json_reader | ( | const std::string | data | ) |
Constructor.
[in] | data | JSON Data in string format |
Initializes JSON document with given data and sets validity state.
keyring_common::json_data::Json_reader::Json_reader | ( | ) |
|
virtualdefault |
Destructor.
|
virtual |
Fetch element from given position.
[in] | index | Element position |
[out] | metadata | Data identifier |
[out] | data | Data |
[out] | json_data_extension | Backend specific extension |
false | Success |
true | Failure |
|
virtual |
Get all elements.
[out] | output | Output vector |
false | Success |
true | Failure |
size_t keyring_common::json_data::Json_reader::num_elements | ( | ) | const |
Get number of elements in the document.
|
inline |
std::string keyring_common::json_data::Json_reader::version | ( | ) | const |
Get version info.
|
private |
user specific elements array key
|
private |
Data in JSON DOM format.
|
private |
Validity of the data.
|
private |
Version key.