mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Made ReportConfig a value type
This commit is contained in:
		| @@ -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 ); | ||||
|   | ||||
| @@ -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; | ||||
|     }; | ||||
|   | ||||
| @@ -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 ); | ||||
|             } | ||||
|              | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Phil Nash
					Phil Nash