MCPcopy Create free account
hub / github.com/Illumina/paragraph / isMultilineArray

Method isMultilineArray

external/jsoncpp/jsoncpp.cpp:4671–4696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4669}
4670
4671bool StyledWriter::isMultilineArray(const Value& value) {
4672 ArrayIndex const size = value.size();
4673 bool isMultiLine = size * 3 >= rightMargin_;
4674 childValues_.clear();
4675 for (ArrayIndex index = 0; index < size && !isMultiLine; ++index) {
4676 const Value& childValue = value[index];
4677 isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
4678 childValue.size() > 0);
4679 }
4680 if (!isMultiLine) // check if line length > max line length
4681 {
4682 childValues_.reserve(size);
4683 addChildValues_ = true;
4684 ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
4685 for (ArrayIndex index = 0; index < size; ++index) {
4686 if (hasCommentForValue(value[index])) {
4687 isMultiLine = true;
4688 }
4689 writeValue(value[index]);
4690 lineLength += static_cast<ArrayIndex>(childValues_[index].length());
4691 }
4692 addChildValues_ = false;
4693 isMultiLine = isMultiLine || lineLength >= rightMargin_;
4694 }
4695 return isMultiLine;
4696}
4697
4698void StyledWriter::pushValue(const JSONCPP_STRING& value) {
4699 if (addChildValues_)

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected