Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include/internal
diff options
context:
space:
mode:
authorPhil Nash2017-04-29 19:38:34 +0100
committerPhil Nash2017-05-05 15:43:31 +0100
commit687437fcd1abe75b2cdc55c002f381e34eabbeca (patch)
treea11899f75ee1e68df5d56fdee6eaa687c0b221a5 /include/internal
parentef8b72c94915c41ea1af2284805c8f740a7113de (diff)
downloadcatch3-687437fcd1abe75b2cdc55c002f381e34eabbeca.tar.gz
converted IStreamingReporter to unique_ptr
Diffstat (limited to 'include/internal')
-rw-r--r--include/internal/catch_interfaces_reporter.h7
-rw-r--r--include/internal/catch_reporter_registrars.hpp2
-rw-r--r--include/internal/catch_run_context.hpp7
3 files changed, 9 insertions, 7 deletions
diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h
index b1f09f90..7a42f097 100644
--- a/include/internal/catch_interfaces_reporter.h
+++ b/include/internal/catch_interfaces_reporter.h
@@ -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
diff --git a/include/internal/catch_reporter_registrars.hpp b/include/internal/catch_reporter_registrars.hpp
index 759b0edb..06c16cb5 100644
--- a/include/internal/catch_reporter_registrars.hpp
+++ b/include/internal/catch_reporter_registrars.hpp
@@ -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 {
diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp
index 7f38eb4a..feb192ed 100644
--- a/include/internal/catch_run_context.hpp
+++ b/include/internal/catch_run_context.hpp
@@ -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