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

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/interfaces/catch_interfaces_reporter.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2022-04-12 21:22:43 +0200
committerMartin Hořeňovský2022-04-13 15:00:50 +0200
commit79d1e8238135427a6780a6db2cdb8b9be0b7f086 (patch)
tree13b7a82bbad094af77171b2807b5d9241acc1721 /src/catch2/interfaces/catch_interfaces_reporter.cpp
parent4f09f1120ba0a28f218a00821a8347a443042ecb (diff)
downloadcatch3-79d1e8238135427a6780a6db2cdb8b9be0b7f086.tar.gz
Store IStream instance owning ptrs in reporter instances
This ended up being a surprisingly large refactoring, motivated by removing a `const_cast` from `Config`'s handling of reporter streams, forced by previous commit.
Diffstat (limited to 'src/catch2/interfaces/catch_interfaces_reporter.cpp')
-rw-r--r--src/catch2/interfaces/catch_interfaces_reporter.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/catch2/interfaces/catch_interfaces_reporter.cpp b/src/catch2/interfaces/catch_interfaces_reporter.cpp
index 926331e0..9a6cbdc2 100644
--- a/src/catch2/interfaces/catch_interfaces_reporter.cpp
+++ b/src/catch2/interfaces/catch_interfaces_reporter.cpp
@@ -17,21 +17,25 @@
#include <catch2/internal/catch_move_and_forward.hpp>
#include <algorithm>
+#include <cassert>
#include <iomanip>
namespace Catch {
ReporterConfig::ReporterConfig(
IConfig const* _fullConfig,
- IStream* _stream,
+ Detail::unique_ptr<IStream> _stream,
ColourMode colourMode,
std::map<std::string, std::string> customOptions ):
- m_stream( _stream ),
+ m_stream( CATCH_MOVE(_stream) ),
m_fullConfig( _fullConfig ),
m_colourMode( colourMode ),
m_customOptions( CATCH_MOVE( customOptions ) ) {}
- IStream* ReporterConfig::stream() const { return m_stream; }
+ Detail::unique_ptr<IStream> ReporterConfig::takeStream() && {
+ assert( m_stream );
+ return CATCH_MOVE( m_stream );
+ }
IConfig const * ReporterConfig::fullConfig() const { return m_fullConfig; }
ColourMode ReporterConfig::colourMode() const { return m_colourMode; }