MCPcopy Create free account
hub / github.com/Samsung/UTopia / isMultilineArray

Method isMultilineArray

external/jsoncpp/jsoncpp.cpp:4614–4639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4612}
4613
4614bool StyledWriter::isMultilineArray(const Value &value) {
4615 ArrayIndex const size = value.size();
4616 bool isMultiLine = size * 3 >= rightMargin_;
4617 childValues_.clear();
4618 for (ArrayIndex index = 0; index < size && !isMultiLine; ++index) {
4619 const Value &childValue = value[index];
4620 isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
4621 !childValue.empty());
4622 }
4623 if (!isMultiLine) // check if line length > max line length
4624 {
4625 childValues_.reserve(size);
4626 addChildValues_ = true;
4627 ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
4628 for (ArrayIndex index = 0; index < size; ++index) {
4629 if (hasCommentForValue(value[index])) {
4630 isMultiLine = true;
4631 }
4632 writeValue(value[index]);
4633 lineLength += static_cast<ArrayIndex>(childValues_[index].length());
4634 }
4635 addChildValues_ = false;
4636 isMultiLine = isMultiLine || lineLength >= rightMargin_;
4637 }
4638 return isMultiLine;
4639}
4640
4641void StyledWriter::pushValue(const String &value) {
4642 if (addChildValues_)

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected