25 #ifndef QUERYENGINE_JSONACCESSORS_H
26 #define QUERYENGINE_JSONACCESSORS_H
30 #include <rapidjson/document.h>
33 inline const rapidjson::Value&
field(
const rapidjson::Value& obj,
34 const char field[]) noexcept {
35 CHECK(obj.IsObject());
36 const auto field_it = obj.FindMember(
field);
37 CHECK(field_it != obj.MemberEnd());
38 return field_it->value;
41 inline const int64_t
json_i64(
const rapidjson::Value& obj) noexcept {
43 return obj.GetInt64();
46 inline const std::string
json_str(
const rapidjson::Value& obj) noexcept {
47 CHECK(obj.IsString());
48 return obj.GetString();
51 inline const bool json_bool(
const rapidjson::Value& obj) noexcept {
56 inline const double json_double(
const rapidjson::Value& obj) noexcept {
57 CHECK(obj.IsDouble());
58 return obj.GetDouble();
61 #endif // QUERYENGINE_JSONACCESSORS_H
const bool json_bool(const rapidjson::Value &obj) noexcept
const std::string json_str(const rapidjson::Value &obj) noexcept
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
const int64_t json_i64(const rapidjson::Value &obj) noexcept
const double json_double(const rapidjson::Value &obj) noexcept