MySQL 9.0.0
Source Code Documentation
keyring_common::json_data::Json_writer Class Reference

#include <json_writer.h>

Public Member Functions

 Json_writer (const std::string &data={}, const std::string &version="1.0", const std::string &version_key="version", const std::string &array_key="elements")
 Constructor. More...
 
virtual ~Json_writer ()=default
 Destructor. More...
 
bool set_data (const std::string &data)
 
std::string to_string () const
 Get string representation of the JSON document. More...
 
virtual bool add_element (const meta::Metadata &metadata, const data::Data &data, Json_data_extension &)
 Add an element. More...
 
virtual bool remove_element (const meta::Metadata &metadata, const Json_data_extension &)
 Remove an element. More...
 
size_t num_elements () const
 Number of elements stored. More...
 
bool valid () const
 Validity of the document. More...
 

Private Attributes

rapidjson::Document document_
 Data in JSON DOM format. More...
 
const std::string version_key_
 Version information. More...
 
const std::string array_key_
 Elements array name. More...
 
bool valid_
 Document validity. More...
 

Constructor & Destructor Documentation

◆ Json_writer()

keyring_common::json_data::Json_writer::Json_writer ( const std::string &  data = {},
const std::string &  version = "1.0",
const std::string &  version_key = "version",
const std::string &  array_key = "elements" 
)

Constructor.

Parameters
[in]dataJSON data
[in]versionVersion information
[in]version_keyWriter version key
[in]array_keyKey to array that stores all elements

◆ ~Json_writer()

virtual keyring_common::json_data::Json_writer::~Json_writer ( )
virtualdefault

Destructor.

Member Function Documentation

◆ add_element()

bool keyring_common::json_data::Json_writer::add_element ( const meta::Metadata metadata,
const data::Data data,
Json_data_extension  
)
virtual

Add an element.

Parameters
[in]metadataData identifier
[in]dataData
Returns
status of insertion
Return values
falseSuccess
trueFailure

◆ num_elements()

size_t keyring_common::json_data::Json_writer::num_elements ( ) const

Number of elements stored.

Get number of elements in the document.

Returns
number elements in the document

◆ remove_element()

bool keyring_common::json_data::Json_writer::remove_element ( const meta::Metadata metadata,
const Json_data_extension  
)
virtual

Remove an element.

Parameters
[in]metadataData identifier
Returns
status of removal
Return values
falseSuccess
trueFailure

◆ set_data()

bool keyring_common::json_data::Json_writer::set_data ( const std::string &  data)

◆ to_string()

std::string keyring_common::json_data::Json_writer::to_string ( ) const

Get string representation of the JSON document.

◆ valid()

bool keyring_common::json_data::Json_writer::valid ( ) const
inline

Validity of the document.

Member Data Documentation

◆ array_key_

const std::string keyring_common::json_data::Json_writer::array_key_
private

Elements array name.

◆ document_

rapidjson::Document keyring_common::json_data::Json_writer::document_
private

Data in JSON DOM format.

◆ valid_

bool keyring_common::json_data::Json_writer::valid_
private

Document validity.

◆ version_key_

const std::string keyring_common::json_data::Json_writer::version_key_
private

Version information.


The documentation for this class was generated from the following files: