12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #pragma once
- #include <iostream>
- #include <rapidjson/document.h>
- #include <rapidjson/rapidjson.h>
- #include <rapidjson/stringbuffer.h>
- #include <rapidjson/writer.h>
- using namespace std;
- class RecLoginMsg
- {
- public:
- std::string code = "0";
- std::string msg = "HeartBeat";
-
- public:
- RecLoginMsg(){}
- ~RecLoginMsg(){}
- /**
- * @description: json转换为object
- * @param {*}
- * @return {*}
- */
- bool jsonToObject(const rapidjson::Value& object){
- const auto end = object.MemberEnd();
- if(end == object.FindMember("code") || !object["code"].IsString()){
- return false;
- }
- else{
- code = object["code"].GetString();
- }
- if(end == object.FindMember("msg") || !object["msg"].IsString()){
- return false;
- }
- else{
- msg = object["msg"].GetString();
- }
- return true;
- }
-
- };
|