cJSON代码阅读(3)——cJSON的数据结构
来源:互联网 发布:windows优化大师8.0 编辑:程序博客网 时间:2024/05/23 12:29
cJSON中主要的数据结构是cJSON结构体:
/* The cJSON structure: */// cJSON对象typedef struct cJSON { // 下一个、上一个json对象struct cJSON *next,*prev;/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ // 字节点 struct cJSON *child;/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ // 对象类型:整形、字符串、浮点、布尔、对象、数组等int type;/* The type of the item, as above. */ // 不同的类型对应的值char *valuestring;/* The item's string, if type==cJSON_String */int valueint;/* The item's number, if type==cJSON_Number */double valuedouble;/* The item's number, if type==cJSON_Number */ // 节点的名字char *string;/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */} cJSON;
json节点的类型有:
/* cJSON Types: */// json节点的类型// 布尔true/false#define cJSON_False 0#define cJSON_True 1// null#define cJSON_NULL 2// 数值整形#define cJSON_Number 3// 字符串#define cJSON_String 4// 数组#define cJSON_Array 5// 对象#define cJSON_Object 6// 节点是否被引用#define cJSON_IsReference 256// json字符串是否为const#define cJSON_StringIsConst 512
内存分配与回收的钩子(默认是系统的malloc和free):
// 节点的分配/回收函数(钩子)typedef struct cJSON_Hooks { void *(*malloc_fn)(size_t sz); void (*free_fn)(void *ptr);} cJSON_Hooks;
0 0
- cJSON代码阅读(3)——cJSON的数据结构
- cJSON代码阅读(2)——cJSON介绍
- cJSON代码阅读(1)——JSON介绍
- cJSON代码阅读(5)——解析JSON字符串
- cJSON代码阅读(6)——解析JSON数值
- cJSON代码阅读(7)——解析JSON数组
- cJSON代码阅读(8)——解析JSON对象
- cJSON代码阅读(4)——解析JSON数据的流程
- cJSON代码阅读(9)——构造json数据的流程
- cJSON代码阅读(10)——把数值构造成JSON格式
- cJSON
- cJSON
- cJSON
- cjson
- cJSON
- cJSON
- cJSON
- cjson源码阅读有感
- mysql在dos界面修改密码
- chcount,iso646.h头文件
- pandas入门
- linux监控网络情况
- 解决win8及8.1安装mysql等msi类型文件2503,2502的问题
- cJSON代码阅读(3)——cJSON的数据结构
- 禁止自动休眠
- 【策略模式】的故事来源(StrategyPattern)
- Maven搭建SpringMVC+Mybatis项目
- VR之头盔镜片畸变补偿
- 遗留问题
- 第四章 使用DML语句更改数据
- Chrome调试js出现Uncaught SyntaxError: Unexpected identifier
- JAVA多线程机制之线程创建