MCPcopy Create free account
hub / github.com/cinder/Cinder / writeArrayValue

Method writeArrayValue

src/jsoncpp/jsoncpp.cpp:3344–3385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3342}
3343
3344void StyledWriter::writeArrayValue(const Value& value) {
3345 unsigned size = value.size();
3346 if (size == 0)
3347 pushValue("[]");
3348 else {
3349 bool isArrayMultiLine = isMultineArray(value);
3350 if (isArrayMultiLine) {
3351 writeWithIndent("[");
3352 indent();
3353 bool hasChildValue = !childValues_.empty();
3354 unsigned index = 0;
3355 for (;;) {
3356 const Value& childValue = value[index];
3357 writeCommentBeforeValue(childValue);
3358 if (hasChildValue)
3359 writeWithIndent(childValues_[index]);
3360 else {
3361 writeIndent();
3362 writeValue(childValue);
3363 }
3364 if (++index == size) {
3365 writeCommentAfterValueOnSameLine(childValue);
3366 break;
3367 }
3368 document_ += ',';
3369 writeCommentAfterValueOnSameLine(childValue);
3370 }
3371 unindent();
3372 writeWithIndent("]");
3373 } else // output on a single line
3374 {
3375 assert(childValues_.size() == size);
3376 document_ += "[ ";
3377 for (unsigned index = 0; index < size; ++index) {
3378 if (index > 0)
3379 document_ += ", ";
3380 document_ += childValues_[index];
3381 }
3382 document_ += " ]";
3383 }
3384 }
3385}
3386
3387bool StyledWriter::isMultineArray(const Value& value) {
3388 int size = value.size();

Callers

nothing calls this directly

Calls 3

assertFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected