MCPcopy Create free account
hub / github.com/Illumina/hap.py / isMultineArray

Method isMultineArray

external/jsoncpp/jsoncpp.cpp:3406–3429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3404}
3405
3406bool StyledWriter::isMultineArray(const Value &value) {
3407 int size = value.size();
3408 bool isMultiLine = size * 3 >= rightMargin_;
3409 childValues_.clear();
3410 for (int index = 0; index < size && !isMultiLine; ++index) {
3411 const Value &childValue = value[index];
3412 isMultiLine =
3413 isMultiLine || ((childValue.isArray() || childValue.isObject()) &&
3414 childValue.size() > 0);
3415 }
3416 if (!isMultiLine) // check if line length > max line length
3417 {
3418 childValues_.reserve(size);
3419 addChildValues_ = true;
3420 int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
3421 for (int index = 0; index < size; ++index) {
3422 writeValue(value[index]);
3423 lineLength += int(childValues_[index].length());
3424 }
3425 addChildValues_ = false;
3426 isMultiLine = isMultiLine || lineLength >= rightMargin_;
3427 }
3428 return isMultiLine;
3429}
3430
3431void StyledWriter::pushValue(const std::string &value) {
3432 if (addChildValues_)

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.80
clearMethod · 0.80
isArrayMethod · 0.80
isObjectMethod · 0.80

Tested by

no test coverage detected