33 #ifndef _IDENTT_QUERY_PROTOJSON_HPP_ 34 #define _IDENTT_QUERY_PROTOJSON_HPP_ 38 #include <google/protobuf/descriptor.h> 39 #include <google/protobuf/message.h> 43 #ifndef IDENTT_ERR_INVALID_ARG 44 #define IDENTT_ERR_INVALID_ARG -1 47 #ifndef IDENTT_ERR_INVALID_PB 48 #define IDENTT_ERR_INVALID_PB -2 51 #ifndef IDENTT_ERR_UNKNOWN_FIELD 52 #define IDENTT_ERR_UNKNOWN_FIELD -3 55 #ifndef IDENTT_ERR_INVALID_JSON 56 #define IDENTT_ERR_INVALID_JSON -4 59 #define RAPIDJSON_HAS_STDSTRING 1 60 #define RAPIDJSON_ASSERT(x) if(!(x)) throw identt::BadJsonException(); 80 void pb2json(
const google::protobuf::Message* msg, std::string& str);
136 int json2pb(
const std::string& json, google::protobuf::Message* msg, std::string& err);
164 std::string
arr2json(std::vector<JsonElem> data);
178 std::string
err2json(
const std::string errorcode,
const std::string error);
183 #endif // _IDENTT_QUERY_PROTOJSON_HPP_
rapidjson::Value * pb2jsonobject(const google::protobuf::Message *msg)
pb2jsonobject : Convert protobuf to json object
Definition: ProtoJson.cc:427
Allocator AllocatorType
Allocator type from template parameter.
Definition: document.h:553
void pb2json(const google::protobuf::Message *msg, std::string &str)
pb2json : Convert protobuf to json
Definition: ProtoJson.cc:415
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2060
std::string arr2json(std::vector< JsonElem > data)
arr2json : Generate a Json for array
Definition: CryptoBase.hpp:49
std::string err2json(const std::string errorcode, const std::string error)
err2json : Generate a Json for Error Message
Definition: ProtoJson.cc:511
int json2pb(const std::string &json, google::protobuf::Message *msg, std::string &err)
json2pb : Convert json to protobuf
Definition: ProtoJson.cc:446
int jsonobject2pb(const rapidjson::Value *json, google::protobuf::Message *msg, std::string &err)
jsonobject2pb : Convert json object to protobuf
Definition: ProtoJson.cc:462
void json2string(const rapidjson::Value *json, std::string &str)
json2string : Convert json to string
Definition: ProtoJson.cc:403