基于 cJSON 的 C++ 版 JSON 库 CJsonObject
- 授权协议: MIT
- 开发语言: C/C++
- 操作系统: 跨平台
- 软件首页: https://gitee.com/Bwar/CJsonObject
- 软件文档: https://my.oschina.net/cqcbw/blog/1844575
软件介绍
CJsonObject 是基于 cJSON 全新开发一个 C++ 版的 JSON 库,CJsonObject 的最大优势是轻量、简单好用,开发效率极高,尤其对多层嵌套json的读取和生成非常高效(大部分json解析库如果要访问多层嵌套json的最里层非常麻烦)。
CJsonObject 比 cJSON 简单易用得多,且只要不是有意不释放内存就不会发生内存泄漏。用 CJsonObject 的好处在于完全不用专门的文档,头文件即文档,看完 Demo 立刻就会用,所有函数都十分通俗易懂,最为关键的一点是解析 JSON 和生成 JSON 的编码效率非常高。
CJsonObject 经过4年超过8个项目的生产环境应用验证其功能稳定性。
许可证:MIT
功能: JSON 解析,JSON 生成
平台: 标准 C/C++ 开发,跨平台
使用说明:将 CJsonObject.hpp、CJsonObject.cpp、cJSON.h、cJSON.c 四个文件加入代码目录,与用户自己的代码一起编译即可。
示例代码:
#include #include #include "../CJsonObject.hpp"
int main()
{
int iValue;
std::string strValue;
neb::CJsonObject oJson("{\"refresh_interval\":60,"
"\"dynamic_loading\":["
"{"
"\"so_path\":\"plugins/User.so\", \"load\":false, \"version\":1,"
"\"cmd\":["
"{\"cmd\":2001, \"class\":\"neb::CmdUserLogin\"},"
"{\"cmd\":2003, \"class\":\"neb::CmdUserLogout\"}"
"],"
"\"module\":["
"{\"path\":\"im/user/login\", \"class\":\"neb::ModuleLogin\"},"
"{\"path\":\"im/user/logout\", \"class\":\"neb::ModuleLogout\"}"
"]"
"},"
"{"
"\"so_path\":\"plugins/ChatMsg.so\", \"load\":false, \"version\":1,"
"\"cmd\":["
"{\"cmd\":2001, \"class\":\"neb::CmdChat\"}"
"],"
"\"module\":[]"
"}"
"]"
"}");
std::cout << oJson.ToString() << std::endl;
std::cout << "-------------------------------------------------------------------" << std::endl;
std::cout << oJson["dynamic_loading"][0]["cmd"][1]("class") << std::endl;
oJson["dynamic_loading"][0]["cmd"][0].Get("cmd", iValue);
std::cout << "iValue = " << iValue << std::endl;
oJson["dynamic_loading"][0]["module"][0].Get("path", strValue);
std::cout << "strValue = " << strValue << std::endl;
std::cout << "-------------------------------------------------------------------" << std::endl;
oJson.AddEmptySubObject("depend");
oJson["depend"].Add("nebula", "https://github.com/Bwar/Nebula");
oJson["depend"].AddEmptySubArray("bootstrap");
oJson["depend"]["bootstrap"].Add("BEACON");
oJson["depend"]["bootstrap"].Add("LOGIC");
oJson["depend"]["bootstrap"].Add("LOGGER");
oJson["depend"]["bootstrap"].Add("INTERFACE");
oJson["depend"]["bootstrap"].Add("ACCESS");
std::cout << oJson.ToString() << std::endl;
std::cout << "-------------------------------------------------------------------" << std::endl;
std::cout << oJson.ToFormattedString() << std::endl;
}
Thirty-three Miniatures
Jiří Matoušek / American Mathematical Socity / 2010-6-18 / USD 24.60
This volume contains a collection of clever mathematical applications of linear algebra, mainly in combinatorics, geometry, and algorithms. Each chapter covers a single main result with motivation and......一起来看看 《Thirty-three Miniatures》 这本书的介绍吧!
