MCPcopy Create free account
hub / github.com/Profactor/cv-plot / writeToStream

Method writeToStream

CvPlot/ext/catch2/inc/catch.hpp:9452–9491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9450 }
9451
9452 void writeToStream( std::ostream &os ) const {
9453 if (!m_exeName.name().empty()) {
9454 os << "usage:\n" << " " << m_exeName.name() << " ";
9455 bool required = true, first = true;
9456 for( auto const &arg : m_args ) {
9457 if (first)
9458 first = false;
9459 else
9460 os << " ";
9461 if( arg.isOptional() && required ) {
9462 os << "[";
9463 required = false;
9464 }
9465 os << "<" << arg.hint() << ">";
9466 if( arg.cardinality() == 0 )
9467 os << " ... ";
9468 }
9469 if( !required )
9470 os << "]";
9471 if( !m_options.empty() )
9472 os << " options";
9473 os << "\n\nwhere options are:" << std::endl;
9474 }
9475
9476 auto rows = getHelpColumns();
9477 size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH;
9478 size_t optWidth = 0;
9479 for( auto const &cols : rows )
9480 optWidth = (std::max)(optWidth, cols.left.size() + 2);
9481
9482 optWidth = (std::min)(optWidth, consoleWidth/2);
9483
9484 for( auto const &cols : rows ) {
9485 auto row =
9486 TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) +
9487 TextFlow::Spacer(4) +
9488 TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth );
9489 os << row << std::endl;
9490 }
9491 }
9492
9493 friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& {
9494 parser.writeToStream( os );

Callers 1

operator<<Method · 0.80

Calls 10

ColumnClass · 0.85
SpacerClass · 0.85
isOptionalMethod · 0.80
hintMethod · 0.80
sizeMethod · 0.80
widthMethod · 0.80
emptyMethod · 0.45
nameMethod · 0.45
cardinalityMethod · 0.45
indentMethod · 0.45

Tested by

no test coverage detected