MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / isMultilineArray

Method isMultilineArray

edrav2/eprj/jsoncpp/src/lib_json/json_writer.cpp:547–572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

545}
546
547bool StyledWriter::isMultilineArray(const Value& value) {
548 ArrayIndex const size = value.size();
549 bool isMultiLine = size * 3 >= rightMargin_;
550 childValues_.clear();
551 for (ArrayIndex index = 0; index < size && !isMultiLine; ++index) {
552 const Value& childValue = value[index];
553 isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
554 !childValue.empty());
555 }
556 if (!isMultiLine) // check if line length > max line length
557 {
558 childValues_.reserve(size);
559 addChildValues_ = true;
560 ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
561 for (ArrayIndex index = 0; index < size; ++index) {
562 if (hasCommentForValue(value[index])) {
563 isMultiLine = true;
564 }
565 writeValue(value[index]);
566 lineLength += static_cast<ArrayIndex>(childValues_[index].length());
567 }
568 addChildValues_ = false;
569 isMultiLine = isMultiLine || lineLength >= rightMargin_;
570 }
571 return isMultiLine;
572}
573
574void StyledWriter::pushValue(const JSONCPP_STRING& value) {
575 if (addChildValues_)

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected