Pass the whole IStream wrapper into reporter

This will become useful when reworking colour support, because
Win32 colour support requires checking whether the output is
stdout, which is done through the `IStream` wrapper.
This commit is contained in:
Martin Hořeňovský committed 2022-03-06 16:34:13 +01:00
1 parent 9b01c404f5
commit 61d0f7a9af
12 files changed
+48 -27

No files matched your search

@@ -55,13 +55,14 @@ namespace Catch {
}; };
class TestSpec;
class IStream;
struct IConfig : Detail::NonCopyable {
virtual ~IConfig();
virtual bool allowThrows() const = 0;
virtual std::ostream& defaultStream() const = 0;
virtual IStream const* defaultStream() const = 0;
virtual StringRef name() const = 0;
virtual bool includeSuccessfulResults() const = 0;
virtual bool shouldDebugBreak() const = 0;
@@ -20,10 +20,10 @@
namespace Catch {
ReporterConfig::ReporterConfig( IConfig const* _fullConfig, std::ostream& _stream )
: m_stream( &_stream ), m_fullConfig( _fullConfig ) {}
ReporterConfig::ReporterConfig( IConfig const* _fullConfig, IStream const* _stream )
: m_stream( _stream ), m_fullConfig( _fullConfig ) {}
std::ostream& ReporterConfig::stream() const { return *m_stream; }
IStream const* ReporterConfig::stream() const { return m_stream; }
IConfig const * ReporterConfig::fullConfig() const { return m_fullConfig; }
AssertionStats::AssertionStats( AssertionResult const& _assertionResult,
@@ -30,15 +30,16 @@ namespace Catch {
struct TestCaseInfo;
class TestCaseHandle;
struct IConfig;
class IStream;
struct ReporterConfig {
ReporterConfig( IConfig const* _fullConfig, std::ostream& _stream );
ReporterConfig( IConfig const* _fullConfig, IStream const* _stream );
std::ostream& stream() const;
IStream const* stream() const;
IConfig const* fullConfig() const;
private:
std::ostream* m_stream;
IStream const* m_stream;
IConfig const* m_fullConfig;
};