2010-12-31 23:46:51 +01:00
|
|
|
/*
|
|
|
|
* catch_reporter_registrars.hpp
|
|
|
|
* Test
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
2010-12-31 23:54:35 +01:00
|
|
|
#include "catch_hub.h"
|
2010-12-31 23:46:51 +01:00
|
|
|
|
|
|
|
namespace Catch
|
|
|
|
{
|
|
|
|
template<typename T>
|
|
|
|
class ReporterRegistrar
|
|
|
|
{
|
|
|
|
class ReporterFactory : public IReporterFactory
|
|
|
|
{
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
virtual IReporter* create
|
|
|
|
(
|
|
|
|
const IReporterConfig& config
|
|
|
|
)
|
|
|
|
const
|
|
|
|
{
|
|
|
|
return new T( config );
|
|
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
virtual std::string getDescription
|
|
|
|
()
|
|
|
|
const
|
|
|
|
{
|
|
|
|
return T::getDescription();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
ReporterRegistrar
|
|
|
|
(
|
|
|
|
const std::string& name
|
|
|
|
)
|
|
|
|
{
|
|
|
|
Hub::getReporterRegistry().registerReporter( name, new ReporterFactory() );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2011-02-03 21:00:46 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2011-01-27 23:29:36 +01:00
|
|
|
#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
|
2010-12-31 23:46:51 +01:00
|
|
|
Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name );
|
|
|
|
|
|
|
|
#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
|