减少接口
This commit is contained in:
parent
af950ec919
commit
fc20724c12
26
inc/cson.h
26
inc/cson.h
|
@ -192,7 +192,7 @@ typedef void* (*loop_func_t)(void* pData, const reflect_item_t* tbl);
|
||||||
*
|
*
|
||||||
* @return void.
|
* @return void.
|
||||||
*/
|
*/
|
||||||
void csonLoopProperty(void* obj, const reflect_item_t* tbl, loop_func_t func);
|
void csonLoopProperty(void* obj, const reflect_item_t* tbl, loop_func_t func);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief convert json string to struct object.
|
* @brief convert json string to struct object.
|
||||||
|
@ -237,31 +237,10 @@ void csonPrintProperty(void* pData, const reflect_item_t* tbl);
|
||||||
void csonFreePointer(void* list, const reflect_item_t* tbl);
|
void csonFreePointer(void* list, const reflect_item_t* tbl);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for Multidimensional array support
|
for Multidimensional array support
|
||||||
*/
|
*/
|
||||||
typedef size_t cson_array_size_t;
|
typedef size_t cson_array_size_t;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief get array memory.
|
|
||||||
*
|
|
||||||
* @param count: count of array item
|
|
||||||
* @param sizePerItem: bytes per array time
|
|
||||||
*
|
|
||||||
* @return void*.
|
|
||||||
* @attention Array header information is implied, so don't use malloc directly.
|
|
||||||
*/
|
|
||||||
void* csonArrayAlloc(cson_array_size_t count, cson_array_size_t sizePerItem);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief free array memory.
|
|
||||||
*
|
|
||||||
* @param ptr: array memory to be free.
|
|
||||||
*
|
|
||||||
* @return void.
|
|
||||||
* @attention Array header information is implied, so don't use free directly.
|
|
||||||
*/
|
|
||||||
void csonArrayFree(void* ptr);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief fast alloc multi-dimen array
|
* @brief fast alloc multi-dimen array
|
||||||
*
|
*
|
||||||
|
@ -277,6 +256,7 @@ void* csonAllocMultiDimenArray(int dimen, cson_array_size_t* sizePerDimen, size_
|
||||||
* @brief the description of multidimensional array.
|
* @brief the description of multidimensional array.
|
||||||
*/
|
*/
|
||||||
void csonFreeMultiDimenArray(void* p);
|
void csonFreeMultiDimenArray(void* p);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
cson_array_size_t size;
|
cson_array_size_t size;
|
||||||
cson_array_size_t cap;
|
cson_array_size_t cap;
|
||||||
|
|
|
@ -175,6 +175,9 @@ static void* parseJsonMDArrayTail(cson_t jo_tmp, const reflect_item_t* tbl, int
|
||||||
static void csonLoopPropertyMDArraySub(void* pProperty, const reflect_item_t* tbl, int i, int dimen, loop_func_t func);
|
static void csonLoopPropertyMDArraySub(void* pProperty, const reflect_item_t* tbl, int i, int dimen, loop_func_t func);
|
||||||
static int invalidCountField(const reflect_item_t* tbl);
|
static int invalidCountField(const reflect_item_t* tbl);
|
||||||
|
|
||||||
|
static void csonArrayFree(void* ptr);
|
||||||
|
static void* csonArrayAlloc(cson_array_size_t count, cson_array_size_t sizePerItem);
|
||||||
|
|
||||||
int csonStruct2JsonStr(char** jstr, void* input, const reflect_item_t* tbl)
|
int csonStruct2JsonStr(char** jstr, void* input, const reflect_item_t* tbl)
|
||||||
{
|
{
|
||||||
cson_t jsonPack = cson_object();
|
cson_t jsonPack = cson_object();
|
||||||
|
|
Loading…
Reference in New Issue