mirror of
https://github.com/SunnyQjm/MIRCertificationManager.git
synced 2026-10-05 01:15:41 +08:00
add: 添加通信消息定义,解析和处理
This commit is contained in:
1 parent
41c0e99dc3
commit
f65bc6575e
14 files changed
+560
-14
No files matched your search
@@ -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];
|
||||
}
|
||||
Reference in new issue
Block a user