diff --git a/include/internal/catch_interfaces_registry_hub.h b/include/internal/catch_interfaces_registry_hub.h index 5e0a7f01..9a42fbad 100644 --- a/include/internal/catch_interfaces_registry_hub.h +++ b/include/internal/catch_interfaces_registry_hub.h @@ -22,6 +22,8 @@ namespace Catch { struct IReporterFactory; struct ITagAliasRegistry; + using IReporterFactoryPtr = std::shared_ptr; + struct IRegistryHub { virtual ~IRegistryHub(); @@ -34,8 +36,8 @@ namespace Catch { struct IMutableRegistryHub { virtual ~IMutableRegistryHub(); - virtual void registerReporter( std::string const& name, Ptr const& factory ) = 0; - virtual void registerListener( Ptr const& factory ) = 0; + virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0; + virtual void registerListener( IReporterFactoryPtr const& factory ) = 0; virtual void registerTest( TestCase const& testInfo ) = 0; virtual void registerTranslator( const IExceptionTranslator* translator ) = 0; virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0; diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index 07524b93..6a38528b 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -236,15 +236,16 @@ namespace Catch }; - struct IReporterFactory : IShared { + struct IReporterFactory { virtual ~IReporterFactory(); virtual IStreamingReporter* create( ReporterConfig const& config ) const = 0; virtual std::string getDescription() const = 0; }; + using IReporterFactoryPtr = std::shared_ptr; struct IReporterRegistry { - typedef std::map > FactoryMap; - typedef std::vector > Listeners; + using FactoryMap = std::map; + using Listeners = std::vector; virtual ~IReporterRegistry(); virtual IStreamingReporter* create( std::string const& name, IConfigPtr const& config ) const = 0; diff --git a/include/internal/catch_registry_hub.hpp b/include/internal/catch_registry_hub.hpp index b9e42b72..d51306fd 100644 --- a/include/internal/catch_registry_hub.hpp +++ b/include/internal/catch_registry_hub.hpp @@ -42,10 +42,10 @@ namespace Catch { public: // IMutableRegistryHub - virtual void registerReporter( std::string const& name, Ptr const& factory ) override { + virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override { m_reporterRegistry.registerReporter( name, factory ); } - virtual void registerListener( Ptr const& factory ) override { + virtual void registerListener( IReporterFactoryPtr const& factory ) override { m_reporterRegistry.registerListener( factory ); } virtual void registerTest( TestCase const& testInfo ) override { diff --git a/include/internal/catch_reporter_registrars.hpp b/include/internal/catch_reporter_registrars.hpp index b12bbc6b..086c5df2 100644 --- a/include/internal/catch_reporter_registrars.hpp +++ b/include/internal/catch_reporter_registrars.hpp @@ -15,7 +15,7 @@ namespace Catch { template class ReporterRegistrar { - class ReporterFactory : public SharedImpl { + class ReporterFactory : public IReporterFactory { virtual IStreamingReporter* create( ReporterConfig const& config ) const { return new T( config ); @@ -29,14 +29,14 @@ namespace Catch { public: ReporterRegistrar( std::string const& name ) { - getMutableRegistryHub().registerReporter( name, new ReporterFactory() ); + getMutableRegistryHub().registerReporter( name, std::make_shared() ); } }; template class ListenerRegistrar { - class ListenerFactory : public SharedImpl { + class ListenerFactory : public IReporterFactory { virtual IStreamingReporter* create( ReporterConfig const& config ) const { return new T( config ); @@ -49,7 +49,7 @@ namespace Catch { public: ListenerRegistrar() { - getMutableRegistryHub().registerListener( new ListenerFactory() ); + getMutableRegistryHub().registerListener( std::make_shared() ); } }; } diff --git a/include/internal/catch_reporter_registry.hpp b/include/internal/catch_reporter_registry.hpp index ad212437..3d503321 100644 --- a/include/internal/catch_reporter_registry.hpp +++ b/include/internal/catch_reporter_registry.hpp @@ -27,10 +27,10 @@ namespace Catch { return it->second->create( ReporterConfig( config ) ); } - void registerReporter( std::string const& name, Ptr const& factory ) { + void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) { m_factories.insert( std::make_pair( name, factory ) ); } - void registerListener( Ptr const& factory ) { + void registerListener( IReporterFactoryPtr const& factory ) { m_listeners.push_back( factory ); }