Reduce misc includes all around

This commit is contained in:
Martin Hořeňovský 2023-03-23 13:41:04 +01:00
parent 3230760db2
commit c487b27d9d
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
10 changed files with 30 additions and 11 deletions

View File

@ -153,6 +153,7 @@ set(IMPL_SOURCES
${SOURCES_DIR}/catch_timer.cpp ${SOURCES_DIR}/catch_timer.cpp
${SOURCES_DIR}/catch_tostring.cpp ${SOURCES_DIR}/catch_tostring.cpp
${SOURCES_DIR}/catch_totals.cpp ${SOURCES_DIR}/catch_totals.cpp
${SOURCES_DIR}/catch_translate_exception.cpp
${SOURCES_DIR}/catch_version.cpp ${SOURCES_DIR}/catch_version.cpp
${SOURCES_DIR}/internal/catch_assertion_handler.cpp ${SOURCES_DIR}/internal/catch_assertion_handler.cpp
${SOURCES_DIR}/internal/catch_case_insensitive_comparisons.cpp ${SOURCES_DIR}/internal/catch_case_insensitive_comparisons.cpp

View File

@ -116,7 +116,6 @@ namespace Catch {
} // namespace Detail } // namespace Detail
// If we decide for C++14, change these to enable_if_ts
template <typename T, typename = void> template <typename T, typename = void>
struct StringMaker { struct StringMaker {
template <typename Fake = T> template <typename Fake = T>

View File

@ -0,0 +1,20 @@
// Copyright Catch2 Authors
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
// SPDX-License-Identifier: BSL-1.0
#include <catch2/catch_translate_exception.hpp>
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
namespace Catch {
namespace Detail {
void registerTranslatorImpl(
Detail::unique_ptr<IExceptionTranslator>&& translator ) {
getMutableRegistryHub().registerTranslator(
CATCH_MOVE( translator ) );
}
} // namespace Detail
} // namespace Catch

View File

@ -15,6 +15,10 @@
#include <exception> #include <exception>
namespace Catch { namespace Catch {
namespace Detail {
void registerTranslatorImpl(
Detail::unique_ptr<IExceptionTranslator>&& translator );
}
class ExceptionTranslatorRegistrar { class ExceptionTranslatorRegistrar {
template<typename T> template<typename T>
@ -48,9 +52,9 @@ namespace Catch {
public: public:
template<typename T> template<typename T>
ExceptionTranslatorRegistrar( std::string(*translateFunction)( T const& ) ) { ExceptionTranslatorRegistrar( std::string(*translateFunction)( T const& ) ) {
getMutableRegistryHub().registerTranslator( Detail::registerTranslatorImpl(
Detail::make_unique<ExceptionTranslator<T>>(translateFunction) Detail::make_unique<ExceptionTranslator<T>>(
); translateFunction ) );
} }
}; };

View File

@ -8,7 +8,6 @@
#ifndef CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED #ifndef CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED
#define CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED #define CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
#include <catch2/internal/catch_unique_ptr.hpp> #include <catch2/internal/catch_unique_ptr.hpp>
#include <string> #include <string>

View File

@ -12,7 +12,6 @@
#include <catch2/internal/catch_debugger.hpp> #include <catch2/internal/catch_debugger.hpp>
#include <catch2/internal/catch_test_failure_exception.hpp> #include <catch2/internal/catch_test_failure_exception.hpp>
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> #include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
#include <catch2/internal/catch_run_context.hpp>
#include <catch2/matchers/catch_matchers_string.hpp> #include <catch2/matchers/catch_matchers_string.hpp>
namespace Catch { namespace Catch {

View File

@ -11,14 +11,11 @@
#include <catch2/catch_assertion_info.hpp> #include <catch2/catch_assertion_info.hpp>
#include <catch2/internal/catch_decomposer.hpp> #include <catch2/internal/catch_decomposer.hpp>
#include <catch2/interfaces/catch_interfaces_capture.hpp> #include <catch2/interfaces/catch_interfaces_capture.hpp>
#include <catch2/internal/catch_lazy_expr.hpp>
#include <string> #include <string>
namespace Catch { namespace Catch {
class IResultCapture;
struct AssertionReaction { struct AssertionReaction {
bool shouldDebugBreak = false; bool shouldDebugBreak = false;
bool shouldThrow = false; bool shouldThrow = false;

View File

@ -260,6 +260,7 @@ internal_sources = files(
'catch_timer.cpp', 'catch_timer.cpp',
'catch_tostring.cpp', 'catch_tostring.cpp',
'catch_totals.cpp', 'catch_totals.cpp',
'catch_translate_exception.cpp',
'catch_version.cpp', 'catch_version.cpp',
) )

View File

@ -8,6 +8,7 @@
#include <catch2/reporters/catch_reporter_registrars.hpp> #include <catch2/reporters/catch_reporter_registrars.hpp>
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
#include <catch2/internal/catch_compiler_capabilities.hpp> #include <catch2/internal/catch_compiler_capabilities.hpp>
namespace Catch { namespace Catch {

View File

@ -8,8 +8,6 @@
#ifndef CATCH_REPORTER_REGISTRARS_HPP_INCLUDED #ifndef CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
#define CATCH_REPORTER_REGISTRARS_HPP_INCLUDED #define CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
#include <catch2/interfaces/catch_interfaces_reporter.hpp>
#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> #include <catch2/interfaces/catch_interfaces_reporter_factory.hpp>
#include <catch2/internal/catch_compiler_capabilities.hpp> #include <catch2/internal/catch_compiler_capabilities.hpp>
#include <catch2/internal/catch_unique_name.hpp> #include <catch2/internal/catch_unique_name.hpp>