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

Method isMultineArray

src/jsoncpp.cpp:4551–4576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected