Migrated IReporterFactory to std::shared_ptr

This commit is contained in:
Phil Nash
2017-04-25 20:28:53 +01:00
parent 338ba6b9ba
commit dd78824697
5 changed files with 16 additions and 13 deletions

View File

@@ -15,7 +15,7 @@ namespace Catch {
template<typename T>
class ReporterRegistrar {
class ReporterFactory : public SharedImpl<IReporterFactory> {
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<ReporterFactory>() );
}
};
template<typename T>
class ListenerRegistrar {
class ListenerFactory : public SharedImpl<IReporterFactory> {
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<ListenerFactory>() );
}
};
}