MCPcopy Create free account
hub / github.com/Kitware/VTK / isMultilineArray

Method isMultilineArray

ThirdParty/jsoncpp/vtkjsoncpp/jsoncpp.cpp:4646–4671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4644}
4645
4646bool StyledWriter::isMultilineArray(const Value& value) {
4647 ArrayIndex const size = value.size();
4648 bool isMultiLine = size * 3 >= rightMargin_;
4649 childValues_.clear();
4650 for (ArrayIndex index = 0; index < size && !isMultiLine; ++index) {
4651 const Value& childValue = value[index];
4652 isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
4653 !childValue.empty());
4654 }
4655 if (!isMultiLine) // check if line length > max line length
4656 {
4657 childValues_.reserve(size);
4658 addChildValues_ = true;
4659 ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
4660 for (ArrayIndex index = 0; index < size; ++index) {
4661 if (hasCommentForValue(value[index])) {
4662 isMultiLine = true;
4663 }
4664 writeValue(value[index]);
4665 lineLength += static_cast<ArrayIndex>(childValues_[index].length());
4666 }
4667 addChildValues_ = false;
4668 isMultiLine = isMultiLine || lineLength >= rightMargin_;
4669 }
4670 return isMultiLine;
4671}
4672
4673void StyledWriter::pushValue(const String& value) {
4674 if (addChildValues_)

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected