MCPcopy Create free account
hub / github.com/cuberite/cuberite / isMultineArray

Method isMultineArray

lib/jsoncpp/src/lib_json/json_writer.cpp:404–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402
403
404bool
405StyledWriter::isMultineArray( const Value &value )
406{
407 int size = value.size();
408 bool isMultiLine = size*3 >= rightMargin_ ;
409 childValues_.clear();
410 for ( int index =0; index < size && !isMultiLine; ++index )
411 {
412 const Value &childValue = value[index];
413 isMultiLine = isMultiLine ||
414 ( (childValue.isArray() || childValue.isObject()) &&
415 childValue.size() > 0 );
416 }
417 if ( !isMultiLine ) // check if line length > max line length
418 {
419 childValues_.reserve( size );
420 addChildValues_ = true;
421 int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]'
422 for ( int index =0; index < size && !isMultiLine; ++index )
423 {
424 writeValue( value[index] );
425 lineLength += int( childValues_[index].length() );
426 isMultiLine = isMultiLine && hasCommentForValue( value[index] );
427 }
428 addChildValues_ = false;
429 isMultiLine = isMultiLine || lineLength >= rightMargin_;
430 }
431 return isMultiLine;
432}
433
434
435void

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