aJsonObject* aJsonClass::createDoubleArray(double *numbers, unsigned char count) { unsigned char i; aJsonObject *n = 0, *p = 0, *a = createArray(); for (i = 0; a && i < count; i++) { n = createItem(numbers[i]); if (!i) a->child = n; else suffixObject(p, n); p = n; } return a; }
aJsonObject* aJsonClass::createStringArray(const char **strings, unsigned char count) { unsigned char i; aJsonObject *n = 0, *p = 0, *a = createArray(); for (i = 0; a && i < count; i++) { n = createItem(strings[i]); if (!i) a->child = n; else suffixObject(p, n); p = n; } return a; }
// Add item to array/object. void aJsonClass::addItemToArray(aJsonObject *array, aJsonObject *item) { aJsonObject *c = array->child; if (!item) return; if (!c) { array->child = item; } else { while (c && c->next) c = c->next; suffixObject(c, item); } }
void MeParams::addItemToObject(const char *string,MeParamObject *item){ if (!item) return; if (item->name) free(item->name); item->name = strdup(string); MeParamObject *c = _root->child; if (!item) return; if (!c) { _root->child = item; } else { while (c && c->next) c = c->next; suffixObject(c, item); } }