26#ifndef ROUTER_SRC_REST_MRS_SRC_HELPER_JSON_RAPID_JSON_TO_MAP_H_
27#define ROUTER_SRC_REST_MRS_SRC_HELPER_JSON_RAPID_JSON_TO_MAP_H_
33#include <rapidjson/reader.h>
48 : rapidjson::BaseReaderHandler<rapidjson::UTF8<>,
49 RapidReaderHandlerToMapOfSimpleValues> {
51 using Map = std::map<std::string, std::string>;
54 rapidjson::kParseNumbersAsStringsFlag};
67 return String(
"false", 5,
false);
75 return static_cast<Override &
>(*this).Default();
82 return String(
r.c_str(),
r.length(),
false);
87 return String(
r.c_str(),
r.length(),
false);
92 return String(
r.c_str(),
r.length(),
false);
97 return String(
r.c_str(),
r.length(),
false);
102 return String(
r.c_str(),
r.length(),
false);
121 if (!
keys_.empty()) {
122 auto &b =
keys_.back();
145 if (!
keys_.empty()) {
146 auto &b =
keys_.back();
172template <
typename SubHandler>
174 : rapidjson::BaseReaderHandler<rapidjson::UTF8<>,
175 ExtractSubObjectHandler<SubHandler>> {
177 rapidjson::BaseReaderHandler<rapidjson::UTF8<>,
179 using Ch =
typename Base::Ch;
183 rapidjson::kParseNumbersAsStringsFlag};
260 if (
level_ != 1)
return true;
Definition: rapid_json_to_map.h:175
bool targer_
Definition: rapid_json_to_map.h:284
ExtractSubObjectHandler(const std::string &key, SubHandler &sub_handler)
Definition: rapid_json_to_map.h:187
bool Int64(int64_t v)
Definition: rapid_json_to_map.h:220
SubHandler & sub_handler_
Definition: rapid_json_to_map.h:282
bool Int(int v)
Definition: rapid_json_to_map.h:208
std::string key_
Definition: rapid_json_to_map.h:281
int level_
Definition: rapid_json_to_map.h:283
bool Null()
Definition: rapid_json_to_map.h:190
bool EndObject(rapidjson::SizeType size)
Definition: rapid_json_to_map.h:252
bool Uint64(uint64_t v)
Definition: rapid_json_to_map.h:226
Result get_result()
Definition: rapid_json_to_map.h:278
bool StartArray()
Definition: rapid_json_to_map.h:266
typename SubHandler::Result Result
Definition: rapid_json_to_map.h:185
rapidjson::BaseReaderHandler< rapidjson::UTF8<>, ExtractSubObjectHandler< SubHandler > > Base
Definition: rapid_json_to_map.h:178
bool StartObject()
Definition: rapid_json_to_map.h:246
bool String(const Ch *ch, rapidjson::SizeType size, bool b)
Definition: rapid_json_to_map.h:202
bool Bool(bool value)
Definition: rapid_json_to_map.h:196
bool EndArray(rapidjson::SizeType size)
Definition: rapid_json_to_map.h:272
bool Key(const Ch *str, rapidjson::SizeType len, bool b)
Definition: rapid_json_to_map.h:258
constexpr static rapidjson::ParseFlag k_parse_flags
Definition: rapid_json_to_map.h:182
bool RawNumber(const Ch *str, rapidjson::SizeType len, bool copy)
enabled via kParseNumbersAsStringsFlag, string is not null-terminated (use length)
Definition: rapid_json_to_map.h:240
bool Uint(unsigned v)
Definition: rapid_json_to_map.h:214
typename Base::Ch Ch
Definition: rapid_json_to_map.h:179
bool Double(double v)
Definition: rapid_json_to_map.h:232
This class is a adapter for Reader from RapidJson.
Definition: rapid_json_to_map.h:49
int allowed_levels_
Definition: rapid_json_to_map.h:160
bool Double(double v)
Definition: rapid_json_to_map.h:100
bool StartObject()
Definition: rapid_json_to_map.h:111
bool Bool(bool value)
Definition: rapid_json_to_map.h:64
bool EndObject(rapidjson::SizeType)
Definition: rapid_json_to_map.h:119
bool Uint64(uint64_t v)
Definition: rapid_json_to_map.h:95
int arrays_
Definition: rapid_json_to_map.h:169
bool Uint(unsigned v)
Definition: rapid_json_to_map.h:85
bool Int(int v)
Definition: rapid_json_to_map.h:80
bool Int64(int64_t v)
Definition: rapid_json_to_map.h:90
bool EndArray(rapidjson::SizeType)
Definition: rapid_json_to_map.h:142
constexpr static rapidjson::ParseFlag k_parse_flags
Definition: rapid_json_to_map.h:53
std::string get_current_key() const
Definition: rapid_json_to_map.h:153
Map result_
Definition: rapid_json_to_map.h:167
bool Null()
Definition: rapid_json_to_map.h:62
int level_
Definition: rapid_json_to_map.h:168
KeyValue key_
Definition: rapid_json_to_map.h:166
bool String(const Ch *ch, rapidjson::SizeType size, bool)
Definition: rapid_json_to_map.h:70
RapidReaderHandlerToMapOfSimpleValues(int allowed_levels=1)
Definition: rapid_json_to_map.h:56
Map Result
Definition: rapid_json_to_map.h:52
std::list< KeyValue > keys_
Definition: rapid_json_to_map.h:165
std::map< std::string, std::string > Map
Definition: rapid_json_to_map.h:51
const Map & get_result() const
Definition: rapid_json_to_map.h:59
bool RawNumber(const Ch *str, rapidjson::SizeType len, bool copy)
enabled via kParseNumbersAsStringsFlag, string is not null-terminated (use length)
Definition: rapid_json_to_map.h:107
bool StartArray()
Definition: rapid_json_to_map.h:136
bool Key(const Ch *str, rapidjson::SizeType len, bool)
Definition: rapid_json_to_map.h:129
static std::string to_string(const LEX_STRING &str)
Definition: lex_string.h:50
Define rapidjson::SizeType to be std::uint64_t.
void copy(Shards< COUNT > &dst, const Shards< COUNT > &src) noexcept
Copy the counters, overwrite destination.
Definition: ut0counter.h:354
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1084
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
size_t size(const char *const c)
Definition: base64.h:46
typedef::std::uint64_t SizeType
Definition: my_rapidjson_size_t.h:39
Result
Definition: result.h:34
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
struct result result
Definition: result.h:34
required string key
Definition: replication_asynchronous_connection_failover.proto:60
Definition: rapid_json_to_map.h:161
std::string name
Definition: rapid_json_to_map.h:162
int level
Definition: rapid_json_to_map.h:163