MCPcopy Create free account
hub / github.com/SOUI2/soui / isMultilineArray

Method isMultilineArray

third-part/jsoncpp/src/lib_json/json_writer.cpp:527–552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525}
526
527bool StyledWriter::isMultilineArray(const Value& value) {
528 ArrayIndex const size = value.size();
529 bool isMultiLine = size * 3 >= rightMargin_;
530 childValues_.clear();
531 for (ArrayIndex index = 0; index < size && !isMultiLine; ++index) {
532 const Value& childValue = value[index];
533 isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
534 childValue.size() > 0);
535 }
536 if (!isMultiLine) // check if line length > max line length
537 {
538 childValues_.reserve(size);
539 addChildValues_ = true;
540 ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
541 for (ArrayIndex index = 0; index < size; ++index) {
542 if (hasCommentForValue(value[index])) {
543 isMultiLine = true;
544 }
545 writeValue(value[index]);
546 lineLength += static_cast<ArrayIndex>(childValues_[index].length());
547 }
548 addChildValues_ = false;
549 isMultiLine = isMultiLine || lineLength >= rightMargin_;
550 }
551 return isMultiLine;
552}
553
554void StyledWriter::pushValue(const JSONCPP_STRING& value) {
555 if (addChildValues_)

Callers

nothing calls this directly

Calls 6

isObjectMethod · 0.80
sizeMethod · 0.45
clearMethod · 0.45
isArrayMethod · 0.45
reserveMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected