mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Migrated IStreamingReporter from Ptr to std::shared_ptr
This commit is contained in:
@@ -204,7 +204,7 @@ namespace Catch
|
||||
|
||||
class MultipleReporters;
|
||||
|
||||
struct IStreamingReporter : IShared {
|
||||
struct IStreamingReporter {
|
||||
virtual ~IStreamingReporter();
|
||||
|
||||
// Implementing class must also provide the following static method:
|
||||
@@ -234,11 +234,11 @@ namespace Catch
|
||||
|
||||
virtual MultipleReporters* tryAsMulti() { return nullptr; }
|
||||
};
|
||||
|
||||
using IStreamingReporterPtr = std::shared_ptr<IStreamingReporter>;
|
||||
|
||||
struct IReporterFactory {
|
||||
virtual ~IReporterFactory();
|
||||
virtual IStreamingReporter* create( ReporterConfig const& config ) const = 0;
|
||||
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0;
|
||||
virtual std::string getDescription() const = 0;
|
||||
};
|
||||
using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;
|
||||
@@ -248,12 +248,12 @@ namespace Catch
|
||||
using Listeners = std::vector<IReporterFactoryPtr>;
|
||||
|
||||
virtual ~IReporterRegistry();
|
||||
virtual IStreamingReporter* create( std::string const& name, IConfigPtr const& config ) const = 0;
|
||||
virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0;
|
||||
virtual FactoryMap const& getFactories() const = 0;
|
||||
virtual Listeners const& getListeners() const = 0;
|
||||
};
|
||||
|
||||
Ptr<IStreamingReporter> addReporter( Ptr<IStreamingReporter> const& existingReporter, Ptr<IStreamingReporter> const& additionalReporter );
|
||||
IStreamingReporterPtr addReporter( IStreamingReporterPtr const& existingReporter, IStreamingReporterPtr const& additionalReporter );
|
||||
|
||||
}
|
||||
|
||||
|
@@ -17,8 +17,8 @@ namespace Catch {
|
||||
|
||||
class ReporterFactory : public IReporterFactory {
|
||||
|
||||
virtual IStreamingReporter* create( ReporterConfig const& config ) const {
|
||||
return new T( config );
|
||||
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const {
|
||||
return std::make_shared<T>( config );
|
||||
}
|
||||
|
||||
virtual std::string getDescription() const {
|
||||
@@ -38,8 +38,8 @@ namespace Catch {
|
||||
|
||||
class ListenerFactory : public IReporterFactory {
|
||||
|
||||
virtual IStreamingReporter* create( ReporterConfig const& config ) const {
|
||||
return new T( config );
|
||||
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const {
|
||||
return std::make_shared<T>( config );
|
||||
}
|
||||
virtual std::string getDescription() const {
|
||||
return std::string();
|
||||
|
@@ -20,7 +20,7 @@ namespace Catch {
|
||||
|
||||
virtual ~ReporterRegistry() override {}
|
||||
|
||||
virtual IStreamingReporter* create( std::string const& name, IConfigPtr const& config ) const override {
|
||||
virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override {
|
||||
FactoryMap::const_iterator it = m_factories.find( name );
|
||||
if( it == m_factories.end() )
|
||||
return nullptr;
|
||||
|
@@ -59,7 +59,7 @@ namespace Catch {
|
||||
|
||||
public:
|
||||
|
||||
explicit RunContext( IConfigPtr const& _config, Ptr<IStreamingReporter> const& reporter )
|
||||
explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr const& reporter )
|
||||
: m_runInfo( _config->name() ),
|
||||
m_context( getCurrentMutableContext() ),
|
||||
m_config( _config ),
|
||||
@@ -355,7 +355,7 @@ namespace Catch {
|
||||
|
||||
IConfigPtr m_config;
|
||||
Totals m_totals;
|
||||
Ptr<IStreamingReporter> m_reporter;
|
||||
IStreamingReporterPtr m_reporter;
|
||||
std::vector<MessageInfo> m_messages;
|
||||
AssertionInfo m_lastAssertionInfo;
|
||||
std::vector<SectionEndInfo> m_unfinishedSections;
|
||||
|
Reference in New Issue
Block a user