Example #1
0
cJSON *cJSON_CreateDoubleArray(const double *numbers,int count)	{int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
Example #2
0
/* Add item to array/object. */
void   cJSON_AddItemToArray(cJSON *array, cJSON *item)						{cJSON *c=array->child;if (!item) return; if (!c) {array->child=item;} else {while (c && c->next) c=c->next; suffix_object(c,item);}}
Example #3
0
cJSON *cJSON_CreateStringArray(const char **strings,int count)	{int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateString(strings[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
Example #4
0
/* Create Arrays: */
cJSON *cJSON_CreateIntArray(int64_t *numbers,int32_t count)		{int32_t i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateNumber((double)numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
Example #5
0
SWITCH_DECLARE(cJSON *)cJSON_CreateFloatArray(float *numbers,int count)			{int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
Example #6
0
cJSON *cJSON_CreateFloatArray(const float *numbers,int count)	{int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!n){cJSON_Delete(a);return 0;}if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
Example #7
0
cJSON *cJSON_CreateFloatArray(mp_pool_t *pool,float *numbers,int count)			{int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray(pool);for(i=0;a && i<count;i++){n=cJSON_CreateNumber(pool,numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
Example #8
0
/* Add item to array/object. */
void   shjson_AddItemToArray(shjson_t *array, shjson_t *item)						{shjson_t *c=array->child;if (!item) return; if (!c) {array->child=item;} else {while (c && c->next) c=c->next; suffix_object(c,item);}}
Example #9
0
shjson_t *shjson_CreateFloatArray(const float *numbers,int count)	{int i;shjson_t *n=0,*p=0,*a=shjson_CreateArray();for(i=0;a && i<count;i++){n=shjson_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
Example #10
0
/* Create Arrays: */
CSON *CSON_CreateIntArray(int *numbers,int count)				{int i;CSON *n=0,*p=0,*a=CSON_CreateArray();for(i=0;a && i<count;i++){n=CSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
Example #11
0
/* Create Arrays: */
cJSON *cJSON_CreateIntArray(const int *numbers,int count, ngx_pool_t *pool)		{int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray(pool);for(i=0;a && i<count;i++){n=cJSON_CreateNumber(numbers[i], pool);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
Example #12
0
// Create Arrays:
cJSON *cJSON_CreateIntArray(long long *numbers,int count)			{int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateInt(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
Example #13
0
JSON *tr50_json_create_string_array(const char **strings, int count) { int i; JSON *n = 0, *p = 0, *a = tr50_json_create_array(); for (i = 0; i<count; i++) { n = tr50_json_create_string(strings[i]); if (!i)a->child = n; else suffix_object(p, n); p = n; }return a; }
Example #14
0
JSON *tr50_json_create_double_array(double *numbers, int count) { int i; JSON *n = 0, *p = 0, *a = tr50_json_create_array(); for (i = 0; i<count; i++) { n = tr50_json_create_number(numbers[i]); if (!i)a->child = n; else suffix_object(p, n); p = n; }return a; }
Example #15
0
// Create Arrays:
JSON *tr50_json_create_bool_array(char *numbers, int count) { int i; JSON *n = 0, *p = 0, *a = tr50_json_create_array(); for (i = 0; i<count; i++) { n = numbers[i] ? tr50_json_create_true() : tr50_json_create_false(); if (!i)a->child = n; else suffix_object(p, n); p = n; }return a; }
Example #16
0
// Add item to array/object.
void	tr50_json_add_item_to_array(JSON *array, JSON *item) { JSON *c = array->child; if (!c) { array->child = item; } else { while (c && c->next) c = c->next; suffix_object(c, item); } }