mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 23:36:11 +01:00
Some listener and factory clean-ups
This commit is contained in:
parent
dd78824697
commit
a96f25c716
@ -42,7 +42,7 @@ namespace Catch {
|
||||
return reporter;
|
||||
}
|
||||
Ptr<IStreamingReporter> addListeners( IConfigPtr const& config, Ptr<IStreamingReporter> reporters ) {
|
||||
IReporterRegistry::Listeners listeners = getRegistryHub().getReporterRegistry().getListeners();
|
||||
auto const& listeners = getRegistryHub().getReporterRegistry().getListeners();
|
||||
for( auto const& listener : listeners )
|
||||
reporters = addReporter(reporters, listener->create( ReporterConfig( config ) ) );
|
||||
return reporters;
|
||||
|
@ -123,12 +123,11 @@ namespace Catch {
|
||||
inline std::size_t listReporters( Config const& /*config*/ ) {
|
||||
Catch::cout() << "Available reporters:\n";
|
||||
IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
|
||||
IReporterRegistry::FactoryMap::const_iterator itBegin = factories.begin(), itEnd = factories.end(), it;
|
||||
std::size_t maxNameLen = 0;
|
||||
for( auto const factoryKvp : getRegistryHub().getReporterRegistry().getFactories() )
|
||||
for( auto const& factoryKvp : getRegistryHub().getReporterRegistry().getFactories() )
|
||||
maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() );
|
||||
|
||||
for( auto const factoryKvp : getRegistryHub().getReporterRegistry().getFactories() ) {
|
||||
for( auto const& factoryKvp : getRegistryHub().getReporterRegistry().getFactories() ) {
|
||||
Text wrapper( factoryKvp.second->getDescription(), TextAttributes()
|
||||
.setInitialIndent( 0 )
|
||||
.setIndent( 7+maxNameLen )
|
||||
|
@ -28,7 +28,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) {
|
||||
m_factories.insert( std::make_pair( name, factory ) );
|
||||
m_factories.insert( { name, factory } );
|
||||
}
|
||||
void registerListener( IReporterFactoryPtr const& factory ) {
|
||||
m_listeners.push_back( factory );
|
||||
|
Loading…
Reference in New Issue
Block a user