diff options
| author | Phil Nash | 2012-07-20 19:07:42 +0100 |
|---|---|---|
| committer | Phil Nash | 2012-07-20 19:07:42 +0100 |
| commit | d2553cdc641d8b7f051e977a41c4ab6891cdd69a (patch) | |
| tree | cbfe2203cd6ccf601d856275c56639fd1715f916 /include/internal | |
| parent | f606517376c5e3f94e9927afcf2bca0f0005237e (diff) | |
| download | catch3-d2553cdc641d8b7f051e977a41c4ab6891cdd69a.tar.gz | |
Made ReportConfig a value type
Diffstat (limited to 'include/internal')
| -rw-r--r-- | include/internal/catch_config.hpp | 2 | ||||
| -rw-r--r-- | include/internal/catch_interfaces_reporter.h | 24 | ||||
| -rw-r--r-- | include/internal/catch_reporter_registrars.hpp | 2 | ||||
| -rw-r--r-- | include/internal/catch_reporter_registry.hpp | 2 |
4 files changed, 19 insertions, 11 deletions
diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index ee56c1f4..9bb53a07 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -60,7 +60,7 @@ namespace Catch { }; - class Config : public IReporterConfig, public IConfig { + class Config : public IConfig { private: Config( const Config& other ); Config& operator = ( const Config& other ); diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index 47cf1830..7d10f407 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -18,12 +18,20 @@ namespace Catch { - struct IReporterConfig { - virtual ~IReporterConfig() {} - virtual std::ostream& stream () const = 0; - virtual bool includeSuccessfulResults () const = 0; - virtual std::string getName () const = 0; - }; + struct ReporterConfig + { + ReporterConfig( const std::string& _name, + std::ostream& _stream, + bool _includeSuccessfulResults = false ) + : name( _name ), + stream( _stream ), + includeSuccessfulResults( _includeSuccessfulResults ) + {} + + std::string name; + std::ostream& stream; + bool includeSuccessfulResults; + }; class TestCaseInfo; class ResultInfo; @@ -45,7 +53,7 @@ namespace Catch struct IReporterFactory { virtual ~IReporterFactory() {} - virtual IReporter* create( const IReporterConfig& config ) const = 0; + virtual IReporter* create( const ReporterConfig& config ) const = 0; virtual std::string getDescription() const = 0; }; @@ -53,7 +61,7 @@ namespace Catch typedef std::map<std::string, IReporterFactory*> FactoryMap; virtual ~IReporterRegistry() {} - virtual IReporter* create( const std::string& name, const IReporterConfig& config ) const = 0; + virtual IReporter* create( const std::string& name, const ReporterConfig& config ) const = 0; virtual void registerReporter( const std::string& name, IReporterFactory* factory ) = 0; virtual const FactoryMap& getFactories() const = 0; }; diff --git a/include/internal/catch_reporter_registrars.hpp b/include/internal/catch_reporter_registrars.hpp index e650cd0c..033f433a 100644 --- a/include/internal/catch_reporter_registrars.hpp +++ b/include/internal/catch_reporter_registrars.hpp @@ -17,7 +17,7 @@ namespace Catch { class ReporterFactory : public IReporterFactory { - virtual IReporter* create( const IReporterConfig& config ) const { + virtual IReporter* create( const ReporterConfig& config ) const { return new T( config ); } diff --git a/include/internal/catch_reporter_registry.hpp b/include/internal/catch_reporter_registry.hpp index bfaffcd5..485cb3bf 100644 --- a/include/internal/catch_reporter_registry.hpp +++ b/include/internal/catch_reporter_registry.hpp @@ -22,7 +22,7 @@ namespace Catch { deleteAllValues( m_factories ); } - virtual IReporter* create( const std::string& name, const IReporterConfig& config ) const { + virtual IReporter* create( const std::string& name, const ReporterConfig& config ) const { FactoryMap::const_iterator it = m_factories.find( name ); if( it == m_factories.end() ) return NULL; |