MCPcopy Create free account
hub / github.com/ValveSoftware/Proton / isMultineArray

Method isMultineArray

vrclient_x64/jsoncpp.cpp:4550–4575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4548}
4549
4550bool StyledWriter::isMultineArray(const Value& value) {
4551 int size = value.size();
4552 bool isMultiLine = size * 3 >= rightMargin_;
4553 childValues_.clear();
4554 for (int index = 0; index < size && !isMultiLine; ++index) {
4555 const Value& childValue = value[index];
4556 isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
4557 childValue.size() > 0);
4558 }
4559 if (!isMultiLine) // check if line length > max line length
4560 {
4561 childValues_.reserve(size);
4562 addChildValues_ = true;
4563 int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
4564 for (int index = 0; index < size; ++index) {
4565 if (hasCommentForValue(value[index])) {
4566 isMultiLine = true;
4567 }
4568 writeValue(value[index]);
4569 lineLength += int(childValues_[index].length());
4570 }
4571 addChildValues_ = false;
4572 isMultiLine = isMultiLine || lineLength >= rightMargin_;
4573 }
4574 return isMultiLine;
4575}
4576
4577void StyledWriter::pushValue(const std::string& value) {
4578 if (addChildValues_)

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected