MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / isMultineArray

Method isMultineArray

src/share/jsoncpp/jsoncpp.cpp:4596–4621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4594}
4595
4596bool StyledWriter::isMultineArray(const Value& value) {
4597 ArrayIndex const size = value.size();
4598 bool isMultiLine = size * 3 >= rightMargin_;
4599 childValues_.clear();
4600 for (ArrayIndex index = 0; index < size && !isMultiLine; ++index) {
4601 const Value& childValue = value[index];
4602 isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
4603 childValue.size() > 0);
4604 }
4605 if (!isMultiLine) // check if line length > max line length
4606 {
4607 childValues_.reserve(size);
4608 addChildValues_ = true;
4609 ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
4610 for (ArrayIndex index = 0; index < size; ++index) {
4611 if (hasCommentForValue(value[index])) {
4612 isMultiLine = true;
4613 }
4614 writeValue(value[index]);
4615 lineLength += static_cast<ArrayIndex>(childValues_[index].length());
4616 }
4617 addChildValues_ = false;
4618 isMultiLine = isMultiLine || lineLength >= rightMargin_;
4619 }
4620 return isMultiLine;
4621}
4622
4623void StyledWriter::pushValue(const JSONCPP_STRING& value) {
4624 if (addChildValues_)

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected