24#ifndef JSON_WRITER_INCLUDED
25#define JSON_WRITER_INCLUDED
31#include <rapidjson/document.h>
32#include <rapidjson/stringbuffer.h>
33#include <rapidjson/writer.h>
45 const std::string &version_key =
"version",
46 const std::string &array_key =
"elements");
51 bool set_data(
const std::string &data);
99 virtual bool set_property(
const std::string &property_key,
100 const std::string &property);
Sensitive data storage.
Definition: data.h:39
Definition: json_writer.h:42
const std::string version_key_
Version information.
Definition: json_writer.h:106
virtual bool set_property(const std::string &property_key, const std::string &property)
Set a property in the main JSON object.
Definition: json_writer.cc:153
bool valid() const
Validity of the document.
Definition: json_writer.h:84
bool set_data(const std::string &data)
Definition: json_writer.cc:63
virtual ~Json_writer()=default
Destructor.
const std::string array_key_
Elements array name.
Definition: json_writer.h:108
rapidjson::Document document_
Data in JSON DOM format.
Definition: json_writer.h:104
size_t num_elements() const
Number of elements stored.
Definition: json_writer.cc:148
virtual bool add_element(const meta::Metadata &metadata, const data::Data &data, Json_data_extension &)
Add an element.
Definition: json_writer.cc:78
std::string to_string() const
Get string representation of the JSON document.
Definition: json_writer.cc:69
bool valid_
Document validity.
Definition: json_writer.h:110
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.
Definition: json_writer.cc:38
virtual bool remove_element(const meta::Metadata &metadata, const Json_data_extension &)
Remove an element.
Definition: json_writer.cc:122
Define rapidjson::SizeType to be std::uint64_t.
required uint64 version
Definition: replication_group_member_actions.proto:41