moved impl of hub out into hub_impl - only #included from runner.

This commit is contained in:
Phil Nash 2010-12-31 22:54:35 +00:00
parent 18e32b9b9f
commit aca80a171b
6 changed files with 40 additions and 25 deletions

31
Test/catch_hub_impl.hpp Normal file
View File

@ -0,0 +1,31 @@
/*
* catch_hub_impl.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_HUB_IMPL_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_HUB_IMPL_HPP_INCLUDED
#include "catch_hub.h"
#include "catch_reporter_registry.hpp"a
namespace Catch
{
inline Hub::Hub()
: m_reporterRegistry( new ReporterRegistry )
{
}
inline IReporterRegistry& Hub::getReporterRegistry()
{
return *me().m_reporterRegistry.get();
}
}
#endif // TWOBLUECUBES_CATCH_HUB_IMPL_HPP_INCLUDED

View File

@ -26,7 +26,7 @@
#ifndef TWOBLUECUBES_CATCH_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_HPP_INCLUDED #define TWOBLUECUBES_CATCH_HPP_INCLUDED
#include "internal/catch_hub.hpp" #include "internal/catch_hub.h"
#include "internal/catch_registry.hpp" #include "internal/catch_registry.hpp"
#include "internal/catch_capture.hpp" #include "internal/catch_capture.hpp"
#include "internal/catch_section.hpp" #include "internal/catch_section.hpp"

View File

@ -18,6 +18,7 @@
#include "catch_reporter_basic.hpp" #include "catch_reporter_basic.hpp"
#include "catch_reporter_xml.hpp" #include "catch_reporter_xml.hpp"
#include "catch_reporter_junit.hpp" #include "catch_reporter_junit.hpp"
#include "catch_hub_impl.hpp"
#include <fstream> #include <fstream>

View File

@ -1,5 +1,5 @@
/* /*
* catch_hub.hpp * catch_hub.h
* Test * Test
* *
* Created by Phil on 31/12/2010. * Created by Phil on 31/12/2010.
@ -9,8 +9,8 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
* *
*/ */
#ifndef TWOBLUECUBES_CATCH_HUB_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_HUB_H_INCLUDED
#define TWOBLUECUBES_CATCH_HUB_HPP_INCLUDED #define TWOBLUECUBES_CATCH_HUB_H_INCLUDED
#include <memory> #include <memory>
@ -38,22 +38,5 @@ namespace Catch
std::auto_ptr<IReporterRegistry> m_reporterRegistry; std::auto_ptr<IReporterRegistry> m_reporterRegistry;
}; };
} }
////// -- new file --
#include "catch_reporter_registry.hpp" #endif // TWOBLUECUBES_CATCH_HUB_H_INCLUDED
namespace Catch
{
inline Hub::Hub()
: m_reporterRegistry( new ReporterRegistry )
{
}
inline IReporterRegistry& Hub::getReporterRegistry()
{
return *me().m_reporterRegistry.get();
}
}
#endif // TWOBLUECUBES_CATCH_HUB_HPP_INCLUDED

View File

@ -23,8 +23,8 @@ namespace Catch
if( config.listWhat() & RunnerConfig::listReports ) if( config.listWhat() & RunnerConfig::listReports )
{ {
std::cout << "Available reports:\n"; std::cout << "Available reports:\n";
ReporterRegistry::FactoryMap::const_iterator it = Hub::getReporterRegistry().getFactories().begin(); IReporterRegistry::FactoryMap::const_iterator it = Hub::getReporterRegistry().getFactories().begin();
ReporterRegistry::FactoryMap::const_iterator itEnd = Hub::getReporterRegistry().getFactories().end(); IReporterRegistry::FactoryMap::const_iterator itEnd = Hub::getReporterRegistry().getFactories().end();
for(; it != itEnd; ++it ) for(; it != itEnd; ++it )
{ {
// !TBD: consider listAs() // !TBD: consider listAs()

View File

@ -12,7 +12,7 @@
#ifndef TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
#include "catch_hub.hpp" #include "catch_hub.h"
namespace Catch namespace Catch
{ {