add: 添加通信消息定义,解析和处理

This commit is contained in:
SunnyQjm committed 2020-06-02 09:53:26 +08:00
1 parent 41c0e99dc3
commit f65bc6575e
14 files changed
+560 -14

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
//
// Created by mingj on 18-12-22.
//
#include "JsonCppUtil.h"
JsonCppUtil::JsonCppUtil(const string &jsonStr) {
Json::Reader reader;
//将根节点解析到root当中
reader.parse(jsonStr, this->root);
}
string JsonCppUtil::getString(const string &key) {
return root[key].asString();
}
int JsonCppUtil::getInt(const string &key) {
return root[key].asInt();
}
unsigned long long JsonCppUtil::getull(const string &key) {
return root[key].asUInt64();
}
bool JsonCppUtil::getBool(const string &key) {
return root[key].asBool();
}
double JsonCppUtil::getDouble(const string &key) {
return root[key].asDouble();
}
Json::Value JsonCppUtil::get(const string &key) {
return root[key];
}