2010-12-31 17:46:51 -05:00
|
|
|
/*
|
|
|
|
* Created by Phil on 31/12/2010.
|
|
|
|
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
|
|
|
*
|
|
|
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
*/
|
|
|
|
#ifndef TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
|
|
|
|
#define TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
|
|
|
|
|
2012-08-06 15:16:53 -04:00
|
|
|
#include "catch_interfaces_static_registries.h"
|
2010-12-31 17:46:51 -05:00
|
|
|
|
2012-05-16 03:02:20 -04:00
|
|
|
namespace Catch {
|
|
|
|
|
2010-12-31 17:46:51 -05:00
|
|
|
template<typename T>
|
2012-05-16 03:02:20 -04:00
|
|
|
class ReporterRegistrar {
|
|
|
|
|
|
|
|
class ReporterFactory : public IReporterFactory {
|
|
|
|
|
2012-07-20 14:07:42 -04:00
|
|
|
virtual IReporter* create( const ReporterConfig& config ) const {
|
2010-12-31 17:46:51 -05:00
|
|
|
return new T( config );
|
|
|
|
}
|
2012-05-16 03:02:20 -04:00
|
|
|
|
|
|
|
virtual std::string getDescription() const {
|
2010-12-31 17:46:51 -05:00
|
|
|
return T::getDescription();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-05-16 03:02:20 -04:00
|
|
|
public:
|
2010-12-31 17:46:51 -05:00
|
|
|
|
2012-05-16 03:02:20 -04:00
|
|
|
ReporterRegistrar( const std::string& name ) {
|
2012-08-06 15:16:53 -04:00
|
|
|
getStaticRegistries().registerReporter( name, new ReporterFactory() );
|
2010-12-31 17:46:51 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2011-01-27 17:29:36 -05:00
|
|
|
#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
|
2010-12-31 17:46:51 -05:00
|
|
|
Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name );
|
|
|
|
|
|
|
|
#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
|