MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / isMultilineArray

Method isMultilineArray

json/jsoncpp.cpp:4722–4747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4720}
4721
4722bool StyledWriter::isMultilineArray(const Value& value) {
4723 ArrayIndex const size = value.size();
4724 bool isMultiLine = size * 3 >= rightMargin_;
4725 childValues_.clear();
4726 for (ArrayIndex index = 0; index < size && !isMultiLine; ++index) {
4727 const Value& childValue = value[index];
4728 isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
4729 childValue.size() > 0);
4730 }
4731 if (!isMultiLine) // check if line length > max line length
4732 {
4733 childValues_.reserve(size);
4734 addChildValues_ = true;
4735 ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
4736 for (ArrayIndex index = 0; index < size; ++index) {
4737 if (hasCommentForValue(value[index])) {
4738 isMultiLine = true;
4739 }
4740 writeValue(value[index]);
4741 lineLength += static_cast<ArrayIndex>(childValues_[index].length());
4742 }
4743 addChildValues_ = false;
4744 isMultiLine = isMultiLine || lineLength >= rightMargin_;
4745 }
4746 return isMultiLine;
4747}
4748
4749void StyledWriter::pushValue(const JSONCPP_STRING& value) {
4750 if (addChildValues_)

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected