MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / writeToStream

Method writeToStream

extern/Catch2/catch.hpp:9536–9575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9534 }
9535
9536 void writeToStream( std::ostream &os ) const {
9537 if (!m_exeName.name().empty()) {
9538 os << "usage:\n" << " " << m_exeName.name() << " ";
9539 bool required = true, first = true;
9540 for( auto const &arg : m_args ) {
9541 if (first)
9542 first = false;
9543 else
9544 os << " ";
9545 if( arg.isOptional() && required ) {
9546 os << "[";
9547 required = false;
9548 }
9549 os << "<" << arg.hint() << ">";
9550 if( arg.cardinality() == 0 )
9551 os << " ... ";
9552 }
9553 if( !required )
9554 os << "]";
9555 if( !m_options.empty() )
9556 os << " options";
9557 os << "\n\nwhere options are:" << std::endl;
9558 }
9559
9560 auto rows = getHelpColumns();
9561 size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH;
9562 size_t optWidth = 0;
9563 for( auto const &cols : rows )
9564 optWidth = (std::max)(optWidth, cols.left.size() + 2);
9565
9566 optWidth = (std::min)(optWidth, consoleWidth/2);
9567
9568 for( auto const &cols : rows ) {
9569 auto row =
9570 TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) +
9571 TextFlow::Spacer(4) +
9572 TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth );
9573 os << row << std::endl;
9574 }
9575 }
9576
9577 friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& {
9578 parser.writeToStream( os );

Callers 1

operator<<Method · 0.80

Calls 10

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

Tested by

no test coverage detected