MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / isMultineArray

Method isMultineArray

Source/JSON/jsoncpp.cpp:4138–4164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4136}
4137
4138bool StyledWriter::isMultineArray(const Value& value) {
4139 int size = value.size();
4140 bool isMultiLine = size * 3 >= rightMargin_;
4141 childValues_.clear();
4142 for (int index = 0; index < size && !isMultiLine; ++index) {
4143 const Value& childValue = value[index];
4144 isMultiLine =
4145 isMultiLine || ((childValue.isArray() || childValue.isObject()) &&
4146 childValue.size() > 0);
4147 }
4148 if (!isMultiLine) // check if line length > max line length
4149 {
4150 childValues_.reserve(size);
4151 addChildValues_ = true;
4152 int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
4153 for (int index = 0; index < size; ++index) {
4154 if (hasCommentForValue(value[index])) {
4155 isMultiLine = true;
4156 }
4157 writeValue(value[index]);
4158 lineLength += int(childValues_[index].length());
4159 }
4160 addChildValues_ = false;
4161 isMultiLine = isMultiLine || lineLength >= rightMargin_;
4162 }
4163 return isMultiLine;
4164}
4165
4166void StyledWriter::pushValue(const std::string& value) {
4167 if (addChildValues_)

Callers

nothing calls this directly

Calls 6

sizeMethod · 0.45
clearMethod · 0.45
isArrayMethod · 0.45
isObjectMethod · 0.45
reserveMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected