MCPcopy Create free account
hub / github.com/cinder/Cinder / isMultineArray

Method isMultineArray

src/jsoncpp/jsoncpp.cpp:3387–3410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3385}
3386
3387bool StyledWriter::isMultineArray(const Value& value) {
3388 int size = value.size();
3389 bool isMultiLine = size * 3 >= rightMargin_;
3390 childValues_.clear();
3391 for (int index = 0; index < size && !isMultiLine; ++index) {
3392 const Value& childValue = value[index];
3393 isMultiLine =
3394 isMultiLine || ((childValue.isArray() || childValue.isObject()) &&
3395 childValue.size() > 0);
3396 }
3397 if (!isMultiLine) // check if line length > max line length
3398 {
3399 childValues_.reserve(size);
3400 addChildValues_ = true;
3401 int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
3402 for (int index = 0; index < size; ++index) {
3403 writeValue(value[index]);
3404 lineLength += int(childValues_[index].length());
3405 }
3406 addChildValues_ = false;
3407 isMultiLine = isMultiLine || lineLength >= rightMargin_;
3408 }
3409 return isMultiLine;
3410}
3411
3412void StyledWriter::pushValue(const std::string& value) {
3413 if (addChildValues_)

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected