#include "JsonBase.h"
#pragma warning(disable:4996 4098)
using namespace JsonBaseHelper;
JsonBase::JsonBase(void)
{
}
JsonBase::~JsonBase(void)
{
}
void JsonBase::ToWriteEvery(Writer<StringBuffer> &writer, int32_t &val)
{
writer.Int(val);
}
void JsonBase::ToWriteEvery(Writer<StringBuffer> &writer, int64_t &val)
{
writer.Int64(val);
}
void JsonBase::ToWriteEvery(Writer<StringBuffer> &writer, uint32_t &val)
{
writer.Uint(val);
}
void JsonBase::ToWriteEvery(Writer<StringBuffer> &writer, uint64_t &val)
{
writer.Uint64(val);
}
void JsonBase::ToWriteEvery(Writer<StringBuffer> &writer, double &val)
{
writer.Double(val);
}
void JsonBase::ToWriteEvery(Writer<StringBuffer> &writer, bool &val)
{
writer.Bool(val);
}
void JsonBase::ToWriteEvery(Writer<StringBuffer> &writer, std::string &val)
{
writer.String(val.data());
}
void JsonBase::ToWriteEvery(Writer<StringBuffer> &writer, char * val)
{
writer.String(val, strlen(val));
}
void JsonBase::ToParseEvery(const Value &val, int32_t &t)
{
t = val.GetInt();
}
void JsonBase::ToParseEvery(const Value &val, int64_t &t)
{
t = val.GetInt64();
}
void JsonBase::ToParseEvery(const Value &val, uint32_t &t)
{
t = val.GetUint();
}
void JsonBase::ToParseEvery(const Value &val, uint64_t &t)
{
t = val.GetUint64();
}
void JsonBase::ToParseEvery(const Value &val, double &t)
{
t = val.GetDouble();
}
void JsonBase::ToParseEvery(const Value &val, bool &t)
{
t = val.GetBool();
}
void JsonBase::ToParseEvery(const Value &val, std::string &t)
{
t = val.GetString();
}
void JsonBase::ToParseEvery(const Value &val, char t[])
{
int size = ARRAY_SIZE(t);
const char *s = val.GetString();
int len = strlen(s);
strncpy(t, s, std::min(size, len));
}
std::string JsonBase::SerializeJson(JsonBase* pJson)
{
StringBuffer s;
Writer<StringBuffer> writer(s);
pJson->ToWrite(writer);
return s.GetString();
}
void JsonBase::DeserializeJson(JsonBase *p, const std::string &json) {
Document document;
if (json.empty())
{
printf("NULL \n");
return;
}
document.Parse(json.c_str());
const Value &val = document;
p->ParseJson(val);
}
void JsonBase::ToWrite(Writer<StringBuffer> &writer)
{
}
void JsonBase::ParseJson(const Value& val)
{
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
LibJosnSerial.rar (80个子文件)
LibJosnSerial
LibJosnSerial.vcxproj.user 165B
Release
LibJosnSerial.tlog
Lib-link.read.1.tlog 310B
CL.write.1.tlog 364B
CL.read.1.tlog 22KB
CL.command.1.tlog 794B
LibJosnSerial.lastbuildstate 196B
Lib-link.write.1.tlog 248B
Lib.command.1.tlog 288B
LibJosnSerial.pdb 308KB
LibJosnSerial.lastbuildstate 63B
LibJosnSerial.log 471B
LibJosnSerial.Build.CppClean.log 779B
JsonBase.obj 863KB
JsonBase.h 5KB
LibJosnSerial.vcxproj 9KB
JsonBase.cpp 2KB
x64
Debug
vc110.idb 19KB
CL.write.1.tlog 230B
CL.read.1.tlog 504B
LibJosnSerial.unsuccessfulbuild 0B
cl.command.1.tlog 682B
LibJosnSerial.lastbuildstate 56B
LibJosnSerial.log 1KB
LibJosnSerial.vcxproj.filters 3KB
rapidjson
document.h 113KB
reader.h 77KB
prettywriter.h 10KB
allocators.h 10KB
internal
strtod.h 8KB
itoa.h 10KB
pow10.h 4KB
strfunc.h 2KB
regex.h 25KB
diyfp.h 11KB
ieee754.h 3KB
meta.h 6KB
dtoa.h 8KB
biginteger.h 9KB
swap.h 1KB
stack.h 7KB
schema.h 79KB
fwd.h 4KB
ostreamwrapper.h 2KB
encodedstream.h 10KB
error
en.h 4KB
error.h 6KB
encodings.h 28KB
filereadstream.h 3KB
memorybuffer.h 3KB
msinttypes
stdint.h 9KB
inttypes.h 8KB
istreamwrapper.h 4KB
writer.h 23KB
pointer.h 57KB
rapidjson.h 21KB
stream.h 5KB
memorystream.h 3KB
stringbuffer.h 4KB
filewritestream.h 3KB
Debug
Lib-link.read.1.tlog 402B
vc110.idb 347KB
LibJosnSerial.tlog
Lib-link.read.1.tlog 302B
CL.write.1.tlog 484B
CL.read.1.tlog 22KB
CL.command.1.tlog 720B
LibJosnSerial.lastbuildstate 200B
Lib-link.write.1.tlog 222B
Lib.command.1.tlog 290B
CL.write.1.tlog 340B
CL.read.1.tlog 16KB
LibJosnSerial.pdb 420KB
cl.command.1.tlog 620B
LibJosnSerial.lastbuildstate 58B
Lib-link.write.1.tlog 244B
LibJosnSerial.idb 187KB
vc110.pdb 388KB
lib.command.1.tlog 268B
LibJosnSerial.log 1002B
JsonBase.obj 575KB
UniFrameWork
Bin
LibJosnSerial.lib 710KB
共 80 条
- 1
资源评论
- 蓝天上的白云2020-11-04挺不错的资源,谢谢楼主的封装
- 姑苏泥瓦匠2020-08-28封装的不错,谢谢楼主
weixin_41370313
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功