MCPcopy Create free account
hub / github.com/PlayFab/gsdk / isMultilineArray

Method isMultilineArray

cpp/cppsdk/jsoncpp.cpp:4720–4745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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