rapidjsonwrapper是对rapidjson的一个简单封装
mkdir build
cd build && cmake ..
含有的功能有如下:
RJSON_DOC(doc) # 定义json document
RJSON_VALUE_OBJ(value) # 定义json object value
RJSON_VALUE_ARRAY(value) # 定义json array value
RJSON_GET_ALLOC(doc, alloc) # 获取document的allocator
RJSON_READ_DOC_FROM_FILE(doc, filepath) # 从指定文件中解析json
RJSON_READ_DOC_FROM_STRING(doc, string_value) # 从字符串中解析json
RJSON_WRITE_DOC_TO_FILE(doc, filepath) # json写入文件中(单行)
RJSON_WRITE_DOC_TO_STRING(doc, string_value) # json写入字符串
RJSON_WRITE_DOC_TO_FILE_PRETTY(doc, filepath) # json以pretty方式写入文件
RJSON_WRITE_DOC_TO_STRING_PRETTY(doc, string_value) # json以pretty方式写入字符串
RJSON_HAS_KEY(rapid_value, key) # 是否存在key的value
RJSON_GET_VALUE(rapid_value, key, value) # 获取某个key对应的value
RJSON_GET_RAPID_VALUE(rapid_value, key, value) # 获取某个key对应的json node
RJSON_ADD_OBJ_VALUE(rapid_value, key, value, alloc) # json添加key-value对
RJSON_ADD_ARRAY_VALUE(rapid_value, value, alloc) # json添加array值