Beispiel #1
0
void JsonArray::writeTo(JsonWriter &writer) const {
  writer.beginArray();

  const node_type *child = _firstNode;
  while (child) {
    child->content.writeTo(writer);

    child = child->next;
    if (!child) break;

    writer.writeComma();
  }

  writer.endArray();
}
Beispiel #2
0
size_t JsonArray::writeTo(JsonWriter &writer) const {
  size_t written = 0;
  if((written = writer.beginArray()) == 0)
    return 0;

  const node_type *child = _firstNode;
  size_t total = written;
  while (child) {
    if((written = child->content.writeTo(writer)) == 0) break;
    total += written;

    child = child->next;
    if (!child) break;

    if((written = writer.writeComma()) == 0) break;
    total += written;
  }

  if(written)
    total += writer.endArray();
  return total;
}