Rename IStreamingReporterPtr => IEventListenerPtr

This reflects the renaming of the reporter/listener base class.
This commit is contained in:
Martin Hořeňovský 2022-04-10 21:50:30 +02:00
parent 73d8fb5bca
commit 4e006a93ff
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
12 changed files with 23 additions and 23 deletions

View File

@ -34,14 +34,14 @@ namespace Catch {
namespace {
const int MaxExitCode = 255;
IStreamingReporterPtr createReporter(std::string const& reporterName, ReporterConfig const& config) {
IEventListenerPtr createReporter(std::string const& reporterName, ReporterConfig const& config) {
auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config);
CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << '\'');
return reporter;
}
IStreamingReporterPtr prepareReporters(Config const* config) {
IEventListenerPtr prepareReporters(Config const* config) {
if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()
&& config->getReporterSpecs().size() == 1) {
auto const& spec = config->getReporterSpecs()[0];
@ -80,7 +80,7 @@ namespace Catch {
class TestGroup {
public:
explicit TestGroup(IStreamingReporterPtr&& reporter, Config const* config):
explicit TestGroup(IEventListenerPtr&& reporter, Config const* config):
m_reporter(reporter.get()),
m_config{config},
m_context{config, CATCH_MOVE(reporter)} {

View File

@ -251,7 +251,7 @@ namespace Catch {
virtual void listTags(std::vector<TagInfo> const& tags) = 0;
};
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
using IEventListenerPtr = Detail::unique_ptr<IEventListener>;
} // end namespace Catch

View File

@ -17,13 +17,13 @@ namespace Catch {
struct ReporterConfig;
struct IConfig;
class IEventListener;
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
using IEventListenerPtr = Detail::unique_ptr<IEventListener>;
struct IReporterFactory {
virtual ~IReporterFactory(); // = default
virtual IStreamingReporterPtr
virtual IEventListenerPtr
create( ReporterConfig const& config ) const = 0;
virtual std::string getDescription() const = 0;
};
@ -32,7 +32,7 @@ namespace Catch {
class EventListenerFactory {
public:
virtual ~EventListenerFactory(); // = default
virtual IStreamingReporterPtr create( IConfig const* config ) const = 0;
virtual IEventListenerPtr create( IConfig const* config ) const = 0;
virtual std::string getDescription() const = 0;
};
} // namespace Catch

View File

@ -20,7 +20,7 @@ namespace Catch {
struct IConfig;
class IEventListener;
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
using IEventListenerPtr = Detail::unique_ptr<IEventListener>;
struct IReporterFactory;
using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;
struct ReporterConfig;
@ -31,7 +31,7 @@ namespace Catch {
using Listeners = std::vector<Detail::unique_ptr<EventListenerFactory>>;
virtual ~IReporterRegistry(); // = default
virtual IStreamingReporterPtr create( std::string const& name, ReporterConfig const& config ) const = 0;
virtual IEventListenerPtr create( std::string const& name, ReporterConfig const& config ) const = 0;
virtual FactoryMap const& getFactories() const = 0;
virtual Listeners const& getListeners() const = 0;
};

View File

@ -37,7 +37,7 @@ namespace Catch {
ReporterRegistry::~ReporterRegistry() = default;
IStreamingReporterPtr ReporterRegistry::create( std::string const& name, ReporterConfig const& config ) const {
IEventListenerPtr ReporterRegistry::create( std::string const& name, ReporterConfig const& config ) const {
auto it = m_factories.find( name );
if( it == m_factories.end() )
return nullptr;

View File

@ -21,7 +21,7 @@ namespace Catch {
ReporterRegistry();
~ReporterRegistry() override; // = default, out of line to allow fwd decl
IStreamingReporterPtr create( std::string const& name, ReporterConfig const& config ) const override;
IEventListenerPtr create( std::string const& name, ReporterConfig const& config ) const override;
void registerReporter( std::string const& name, IReporterFactoryPtr factory );
void registerListener( Detail::unique_ptr<EventListenerFactory> factory );

View File

@ -160,7 +160,7 @@ namespace Catch {
GeneratorTracker::~GeneratorTracker() = default;
}
RunContext::RunContext(IConfig const* _config, IStreamingReporterPtr&& reporter)
RunContext::RunContext(IConfig const* _config, IEventListenerPtr&& reporter)
: m_runInfo(_config->name()),
m_context(getCurrentMutableContext()),
m_config(_config),

View File

@ -36,7 +36,7 @@ namespace Catch {
RunContext( RunContext const& ) = delete;
RunContext& operator =( RunContext const& ) = delete;
explicit RunContext( IConfig const* _config, IStreamingReporterPtr&& reporter );
explicit RunContext( IConfig const* _config, IEventListenerPtr&& reporter );
~RunContext() override;
@ -130,7 +130,7 @@ namespace Catch {
IConfig const* m_config;
Totals m_totals;
IStreamingReporterPtr m_reporter;
IEventListenerPtr m_reporter;
std::vector<MessageInfo> m_messages;
std::vector<ScopedMessage> m_messageScopes; /* Keeps owners of so-called unscoped messages. */
AssertionInfo m_lastAssertionInfo;

View File

@ -21,13 +21,13 @@ namespace Catch {
reporterish.getPreferences().shouldReportAllAssertions;
}
void MultiReporter::addListener( IStreamingReporterPtr&& listener ) {
void MultiReporter::addListener( IEventListenerPtr&& listener ) {
updatePreferences(*listener);
m_reporterLikes.insert(m_reporterLikes.begin() + m_insertedListeners, CATCH_MOVE(listener) );
++m_insertedListeners;
}
void MultiReporter::addReporter( IStreamingReporterPtr&& reporter ) {
void MultiReporter::addReporter( IEventListenerPtr&& reporter ) {
updatePreferences(*reporter);
// We will need to output the captured stdout if there are reporters

View File

@ -19,7 +19,7 @@ namespace Catch {
* All Listeners are stored before all reporters, and individual
* listeners/reporters are stored in order of insertion.
*/
std::vector<IStreamingReporterPtr> m_reporterLikes;
std::vector<IEventListenerPtr> m_reporterLikes;
bool m_haveNoncapturingReporters = false;
// Keep track of how many listeners we have already inserted,
@ -33,8 +33,8 @@ namespace Catch {
IEventListener( config )
{}
void addListener( IStreamingReporterPtr&& listener );
void addReporter( IStreamingReporterPtr&& reporter );
void addListener( IEventListenerPtr&& listener );
void addReporter( IEventListenerPtr&& reporter );
public: // IEventListener

View File

@ -17,12 +17,12 @@
namespace Catch {
class IEventListener;
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
using IEventListenerPtr = Detail::unique_ptr<IEventListener>;
template <typename T>
class ReporterFactory : public IReporterFactory {
IStreamingReporterPtr create( ReporterConfig const& config ) const override {
IEventListenerPtr create( ReporterConfig const& config ) const override {
return Detail::make_unique<T>( config );
}
@ -45,7 +45,7 @@ namespace Catch {
class TypedListenerFactory : public EventListenerFactory {
IStreamingReporterPtr
IEventListenerPtr
create( IConfig const* config ) const override {
return Detail::make_unique<T>(config);
}

View File

@ -281,7 +281,7 @@ TEST_CASE("Multireporter updates ReporterPreferences properly",
namespace {
class TestReporterFactory : public Catch::IReporterFactory {
Catch::IStreamingReporterPtr create( Catch::ReporterConfig const& ) const override {
Catch::IEventListenerPtr create( Catch::ReporterConfig const& ) const override {
CATCH_INTERNAL_ERROR(
"This factory should never create a reporter" );
}