Split IReporterRegistry into its own header file

Doing this removes `<map>` from the include set of the base reporter
interface, and thus from bunch more TUs. This provides about 1.5%
improvements in the debug build of the static library, and 1% in
release build.
This commit is contained in:
Martin Hořeňovský 2020-08-23 18:16:10 +02:00
parent ed7eaf2df3
commit 9677df6d8b
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
10 changed files with 43 additions and 13 deletions

View File

@ -72,6 +72,7 @@ set(INTERNAL_HEADERS
${SOURCES_DIR}/interfaces/catch_interfaces_generatortracker.hpp ${SOURCES_DIR}/interfaces/catch_interfaces_generatortracker.hpp
${SOURCES_DIR}/interfaces/catch_interfaces_registry_hub.hpp ${SOURCES_DIR}/interfaces/catch_interfaces_registry_hub.hpp
${SOURCES_DIR}/interfaces/catch_interfaces_reporter.hpp ${SOURCES_DIR}/interfaces/catch_interfaces_reporter.hpp
${SOURCES_DIR}/interfaces/catch_interfaces_reporter_registry.hpp
${SOURCES_DIR}/interfaces/catch_interfaces_runner.hpp ${SOURCES_DIR}/interfaces/catch_interfaces_runner.hpp
${SOURCES_DIR}/interfaces/catch_interfaces_tag_alias_registry.hpp ${SOURCES_DIR}/interfaces/catch_interfaces_tag_alias_registry.hpp
${SOURCES_DIR}/interfaces/catch_interfaces_testcase.hpp ${SOURCES_DIR}/interfaces/catch_interfaces_testcase.hpp

View File

@ -19,6 +19,7 @@
#include <catch2/internal/catch_textflow.hpp> #include <catch2/internal/catch_textflow.hpp>
#include <catch2/internal/catch_windows_h_proxy.hpp> #include <catch2/internal/catch_windows_h_proxy.hpp>
#include <catch2/reporters/catch_reporter_listening.hpp> #include <catch2/reporters/catch_reporter_listening.hpp>
#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp>
#include <algorithm> #include <algorithm>
#include <iomanip> #include <iomanip>

View File

@ -22,6 +22,7 @@
#include <catch2/interfaces/catch_interfaces_generatortracker.hpp> #include <catch2/interfaces/catch_interfaces_generatortracker.hpp>
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> #include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
#include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/interfaces/catch_interfaces_reporter.hpp>
#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp>
#include <catch2/interfaces/catch_interfaces_runner.hpp> #include <catch2/interfaces/catch_interfaces_runner.hpp>
#include <catch2/interfaces/catch_interfaces_tag_alias_registry.hpp> #include <catch2/interfaces/catch_interfaces_tag_alias_registry.hpp>
#include <catch2/interfaces/catch_interfaces_testcase.hpp> #include <catch2/interfaces/catch_interfaces_testcase.hpp>

View File

@ -77,3 +77,9 @@ namespace Catch {
ITestInvoker::~ITestInvoker() = default; ITestInvoker::~ITestInvoker() = default;
ITestCaseRegistry::~ITestCaseRegistry() = default; ITestCaseRegistry::~ITestCaseRegistry() = default;
} }
#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp>
namespace Catch {
IReporterRegistry::~IReporterRegistry() = default;
}

View File

@ -187,6 +187,5 @@ namespace Catch {
} }
IReporterFactory::~IReporterFactory() = default; IReporterFactory::~IReporterFactory() = default;
IReporterRegistry::~IReporterRegistry() = default;
} // end namespace Catch } // end namespace Catch

View File

@ -24,7 +24,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <iosfwd> #include <iosfwd>
#include <map>
namespace Catch { namespace Catch {
@ -33,7 +32,6 @@ namespace Catch {
struct TestCaseInfo; struct TestCaseInfo;
class TestCaseHandle; class TestCaseHandle;
struct IConfig; struct IConfig;
class Config;
struct ReporterConfig { struct ReporterConfig {
explicit ReporterConfig( IConfig const* _fullConfig ); explicit ReporterConfig( IConfig const* _fullConfig );
@ -251,16 +249,6 @@ namespace Catch {
}; };
using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>; using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;
struct IReporterRegistry {
using FactoryMap = std::map<std::string, IReporterFactoryPtr>;
using Listeners = std::vector<IReporterFactoryPtr>;
virtual ~IReporterRegistry();
virtual IStreamingReporterPtr create( std::string const& name, IConfig const* config ) const = 0;
virtual FactoryMap const& getFactories() const = 0;
virtual Listeners const& getListeners() const = 0;
};
} // end namespace Catch } // end namespace Catch
#endif // TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED #endif // TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED

View File

@ -0,0 +1,31 @@
#ifndef CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED
#define CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED
#include <catch2/internal/catch_unique_ptr.hpp>
#include <string>
#include <vector>
#include <map>
namespace Catch {
struct IConfig;
struct IStreamingReporter;
using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
struct IReporterFactory;
using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;
struct IReporterRegistry {
using FactoryMap = std::map<std::string, IReporterFactoryPtr>;
using Listeners = std::vector<IReporterFactoryPtr>;
virtual ~IReporterRegistry();
virtual IStreamingReporterPtr create( std::string const& name, IConfig const* config ) const = 0;
virtual FactoryMap const& getFactories() const = 0;
virtual Listeners const& getListeners() const = 0;
};
} // end namespace Catch
#endif // CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED

View File

@ -11,6 +11,7 @@
#include <catch2/catch_config.hpp> #include <catch2/catch_config.hpp>
#include <catch2/internal/catch_string_manip.hpp> #include <catch2/internal/catch_string_manip.hpp>
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> #include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp>
#include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/interfaces/catch_interfaces_reporter.hpp>
#include <fstream> #include <fstream>

View File

@ -10,6 +10,7 @@
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> #include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
#include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/interfaces/catch_interfaces_reporter.hpp>
#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp>
#include <catch2/interfaces/catch_interfaces_testcase.hpp> #include <catch2/interfaces/catch_interfaces_testcase.hpp>
#include <catch2/internal/catch_context.hpp> #include <catch2/internal/catch_context.hpp>

View File

@ -9,6 +9,7 @@
#define TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED
#include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/interfaces/catch_interfaces_reporter.hpp>
#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp>
#include <map> #include <map>