Outline the actual registering of listener factories to cpp file

This commit is contained in:
Martin Hořeňovský 2023-03-15 15:35:03 +01:00
parent 62167d756e
commit 72f3ce4db5
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 8 additions and 2 deletions

View File

@ -26,5 +26,10 @@ namespace Catch {
} }
} }
void registerListenerImpl( Detail::unique_ptr<EventListenerFactory> listenerFactory ) {
getMutableRegistryHub().registerListener( CATCH_MOVE(listenerFactory) );
}
} // namespace Detail } // namespace Detail
} // namespace Catch } // namespace Catch

View File

@ -36,7 +36,8 @@ namespace Catch {
//! independent on the reporter's concrete type //! independent on the reporter's concrete type
void registerReporterImpl( std::string const& name, void registerReporterImpl( std::string const& name,
IReporterFactoryPtr reporterPtr ); IReporterFactoryPtr reporterPtr );
//! Actually registers the factory, independent on listener's concrete type
void registerListenerImpl( Detail::unique_ptr<EventListenerFactory> listenerFactory );
} // namespace Detail } // namespace Detail
class IEventListener; class IEventListener;
@ -97,7 +98,7 @@ namespace Catch {
public: public:
ListenerRegistrar(StringRef listenerName) { ListenerRegistrar(StringRef listenerName) {
getMutableRegistryHub().registerListener( Detail::make_unique<TypedListenerFactory>(listenerName) ); registerListenerImpl( Detail::make_unique<TypedListenerFactory>(listenerName) );
} }
}; };
} }