MCPcopy Create free account
hub / github.com/Samsung/ONE / isMultilineArray

Method isMultilineArray

runtime/3rdparty/jsoncpp/jsoncpp.cpp:5011–5039  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5009}
5010
5011bool StyledWriter::isMultilineArray(const Value &value)
5012{
5013 ArrayIndex const size = value.size();
5014 bool isMultiLine = size * 3 >= rightMargin_;
5015 childValues_.clear();
5016 for (ArrayIndex index = 0; index < size && !isMultiLine; ++index)
5017 {
5018 const Value &childValue = value[index];
5019 isMultiLine = ((childValue.isArray() || childValue.isObject()) && !childValue.empty());
5020 }
5021 if (!isMultiLine) // check if line length > max line length
5022 {
5023 childValues_.reserve(size);
5024 addChildValues_ = true;
5025 ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
5026 for (ArrayIndex index = 0; index < size; ++index)
5027 {
5028 if (hasCommentForValue(value[index]))
5029 {
5030 isMultiLine = true;
5031 }
5032 writeValue(value[index]);
5033 lineLength += static_cast<ArrayIndex>(childValues_[index].length());
5034 }
5035 addChildValues_ = false;
5036 isMultiLine = isMultiLine || lineLength >= rightMargin_;
5037 }
5038 return isMultiLine;
5039}
5040
5041void StyledWriter::pushValue(const String &value)
5042{

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected