#pragma once #include #include #include #include #include using namespace std; class HepuGetSaltRe { private: public: const string cmd = "userSaltGet"; int ackvalue ; string salt; int loginEnc; HepuGetSaltRe(){}; ~HepuGetSaltRe(){}; bool jsonToObject(string& json){ rapidjson::Document doc; doc.Parse(json.c_str()); if(!doc.IsObject()){ return false; } const auto end = doc.MemberEnd(); if(end == doc.FindMember("cmd") || !doc["cmd"].IsString()){ return false; }else{ if(cmd != doc["cmd"].GetString()) return false; } if(end == doc.FindMember("param") || !doc["param"].IsObject()) { return false; }else{ if(end == doc.FindMember("ackvalue") || !doc["ackvalue"].IsInt()) { return false; }else{ ackvalue = doc["ackvalue"].GetInt(); } if(end == doc.FindMember("salt") || !doc["salt"].IsString()) { return false; }else{ salt = doc["salt"].GetString(); } if(end == doc.FindMember("loginEnc") || !doc["loginEnc"].IsInt()) { return false; }else{ loginEnc = doc["loginEnc"].GetInt(); } } return true; } };