mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
converted IStreamingReporter to unique_ptr
This commit is contained in:
@@ -232,9 +232,9 @@ namespace Catch
|
||||
|
||||
virtual void skipTest( TestCaseInfo const& testInfo ) = 0;
|
||||
|
||||
virtual MultipleReporters* tryAsMulti() { return nullptr; }
|
||||
virtual bool isMulti() const { return false; }
|
||||
};
|
||||
using IStreamingReporterPtr = std::shared_ptr<IStreamingReporter>;
|
||||
using IStreamingReporterPtr = std::unique_ptr<IStreamingReporter>;
|
||||
|
||||
struct IReporterFactory {
|
||||
virtual ~IReporterFactory();
|
||||
@@ -253,8 +253,7 @@ namespace Catch
|
||||
virtual Listeners const& getListeners() const = 0;
|
||||
};
|
||||
|
||||
IStreamingReporterPtr addReporter( IStreamingReporterPtr const& existingReporter, IStreamingReporterPtr const& additionalReporter );
|
||||
|
||||
void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter );
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED
|
||||
|
@@ -18,7 +18,7 @@ namespace Catch {
|
||||
class ReporterFactory : public IReporterFactory {
|
||||
|
||||
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const {
|
||||
return std::make_shared<T>( config );
|
||||
return std::unique_ptr<T>( new T( config ) );
|
||||
}
|
||||
|
||||
virtual std::string getDescription() const {
|
||||
|
@@ -59,11 +59,11 @@ namespace Catch {
|
||||
|
||||
public:
|
||||
|
||||
explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr const& reporter )
|
||||
explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter )
|
||||
: m_runInfo( _config->name() ),
|
||||
m_context( getCurrentMutableContext() ),
|
||||
m_config( _config ),
|
||||
m_reporter( reporter )
|
||||
m_reporter( std::move( reporter ) )
|
||||
{
|
||||
m_context.setRunner( this );
|
||||
m_context.setConfig( m_config );
|
||||
@@ -131,6 +131,9 @@ namespace Catch {
|
||||
IConfigPtr config() const {
|
||||
return m_config;
|
||||
}
|
||||
IStreamingReporter& reporter() const {
|
||||
return *m_reporter;
|
||||
}
|
||||
|
||||
private: // IResultCapture
|
||||
|
||||
|
Reference in New Issue
Block a user