Some listener and factory clean-ups

This commit is contained in:
Phil Nash 2017-04-25 20:35:38 +01:00
parent dd78824697
commit a96f25c716
3 changed files with 4 additions and 5 deletions

View File

@ -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;

View File

@ -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 )

View File

@ -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 );