Rename base reporter iface IStreamingReporter -> IEventListener

This commit is contained in:
Martin Hořeňovský 2022-03-06 15:37:16 +01:00
parent f9facc1881
commit 4dd5e2eece
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
13 changed files with 32 additions and 33 deletions

View File

@ -120,7 +120,7 @@ namespace Catch {
private:
IStreamingReporter* m_reporter;
IEventListener* m_reporter;
Config const* m_config;
RunContext m_context;
std::set<TestCaseHandle const*> m_tests;

View File

@ -78,6 +78,6 @@ namespace Catch {
aborting( _aborting )
{}
IStreamingReporter::~IStreamingReporter() = default;
IEventListener::~IEventListener() = default;
} // end namespace Catch

View File

@ -150,7 +150,7 @@ namespace Catch {
};
//! The common base for all reporters and event listeners
struct IStreamingReporter {
class IEventListener {
protected:
//! Derived classes can set up their preferences here
ReporterPreferences m_preferences;
@ -158,9 +158,9 @@ namespace Catch {
IConfig const* m_config;
public:
IStreamingReporter( IConfig const* config ): m_config( config ) {}
IEventListener( IConfig const* config ): m_config( config ) {}
virtual ~IStreamingReporter(); // = default;
virtual ~IEventListener(); // = default;
// Implementing class must also provide the following static methods:
// static std::string getDescription();
@ -230,7 +230,7 @@ namespace Catch {
virtual void listTags(std::vector<TagInfo> const& tags) = 0;
};
using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
} // end namespace Catch

View File

@ -15,8 +15,8 @@
namespace Catch {
struct ReporterConfig;
struct IStreamingReporter;
using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
class IEventListener;
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
struct IReporterFactory {

View File

@ -19,8 +19,8 @@ namespace Catch {
struct IConfig;
struct IStreamingReporter;
using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
class IEventListener;
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
struct IReporterFactory;
using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;
struct ReporterConfig;

View File

@ -23,13 +23,13 @@
namespace Catch {
namespace {
void listTests(IStreamingReporter& reporter, IConfig const& config) {
void listTests(IEventListener& reporter, IConfig const& config) {
auto const& testSpec = config.testSpec();
auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
reporter.listTests(matchedTestCases);
}
void listTags(IStreamingReporter& reporter, IConfig const& config) {
void listTags(IEventListener& reporter, IConfig const& config) {
auto const& testSpec = config.testSpec();
std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
@ -51,7 +51,7 @@ namespace Catch {
reporter.listTags(infos);
}
void listReporters(IStreamingReporter& reporter) {
void listReporters(IEventListener& reporter) {
std::vector<ReporterDescription> descriptions;
IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
@ -86,7 +86,7 @@ namespace Catch {
return out;
}
bool list( IStreamingReporter& reporter, Config const& config ) {
bool list( IEventListener& reporter, Config const& config ) {
bool listed = false;
if (config.listTests()) {
listed = true;

View File

@ -16,7 +16,7 @@
namespace Catch {
struct IStreamingReporter;
class IEventListener;
class Config;
@ -32,7 +32,7 @@ namespace Catch {
std::size_t count = 0;
};
bool list( IStreamingReporter& reporter, Config const& config );
bool list( IEventListener& reporter, Config const& config );
} // end namespace Catch

View File

@ -59,7 +59,7 @@ namespace Catch {
* performance. **Accessing the assertion expansions if it wasn't stored is
* UB.**
*/
class CumulativeReporterBase : public IStreamingReporter {
class CumulativeReporterBase : public IEventListener {
public:
template<typename T, typename ChildNodeT>
struct Node {
@ -90,7 +90,7 @@ namespace Catch {
using TestRunNode = Node<TestRunStats, TestCaseNode>;
CumulativeReporterBase( ReporterConfig const& _config ):
IStreamingReporter( _config.fullConfig() ),
IEventListener( _config.fullConfig() ),
m_stream( _config.stream() ) {}
~CumulativeReporterBase() override;

View File

@ -13,16 +13,16 @@
namespace Catch {
/**
* Base class identifying listeners.
* Base class to simplify implementing listeners.
*
* Provides empty default implementation for all IStreamingReporter member
* functions, so that listeners implementations can pick which
* Provides empty default implementation for all IEventListener member
* functions, so that a listener implementation can pick which
* member functions it actually cares about.
*/
class EventListenerBase : public IStreamingReporter {
class EventListenerBase : public IEventListener {
public:
EventListenerBase( ReporterConfig const& config ):
IStreamingReporter( config.fullConfig() ) {}
IEventListener( config.fullConfig() ) {}
void reportInvalidTestSpec( StringRef unmatchedSpec ) override;
void fatalErrorEncountered( StringRef error ) override;
@ -52,7 +52,6 @@ namespace Catch {
void testCaseEnded( TestCaseStats const& testCaseStats ) override;
void testRunEnded( TestRunStats const& testRunStats ) override;
void skipTest( TestCaseInfo const& testInfo ) override;
};
} // end namespace Catch

View File

@ -14,7 +14,7 @@
#include <cassert>
namespace Catch {
void MultiReporter::updatePreferences(IStreamingReporter const& reporterish) {
void MultiReporter::updatePreferences(IEventListener const& reporterish) {
m_preferences.shouldRedirectStdOut |=
reporterish.getPreferences().shouldRedirectStdOut;
m_preferences.shouldReportAllAssertions |=

View File

@ -12,7 +12,7 @@
namespace Catch {
class MultiReporter final : public IStreamingReporter {
class MultiReporter final : public IEventListener {
/*
* Stores all added reporters and listeners
*
@ -26,17 +26,17 @@ namespace Catch {
// so that we can insert them into the main vector at the right place
size_t m_insertedListeners = 0;
void updatePreferences(IStreamingReporter const& reporterish);
void updatePreferences(IEventListener const& reporterish);
public:
MultiReporter( IConfig const* config ):
IStreamingReporter( config )
IEventListener( config )
{}
void addListener( IStreamingReporterPtr&& listener );
void addReporter( IStreamingReporterPtr&& reporter );
public: // IStreamingReporter
public: // IEventListener
void noMatchingTestCases( StringRef unmatchedSpec ) override;
void fatalErrorEncountered( StringRef error ) override;

View File

@ -16,8 +16,8 @@
namespace Catch {
struct IStreamingReporter;
using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
class IEventListener;
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
template <typename T>
class ReporterFactory : public IReporterFactory {

View File

@ -16,10 +16,10 @@
namespace Catch {
class StreamingReporterBase : public IStreamingReporter {
class StreamingReporterBase : public IEventListener {
public:
StreamingReporterBase( ReporterConfig const& _config ):
IStreamingReporter( _config.fullConfig() ),
IEventListener( _config.fullConfig() ),
m_stream( _config.stream() ) {}