MCPcopy Create free account
hub / github.com/audeering/opensmile / writeToStream

Method writeToStream

progsrc/include/tests/catch2/catch.hpp:9525–9564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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