diff --git a/Bigfoot/Sources/Engine/Include/Engine/EngineAssertHandler.hpp b/Bigfoot/Sources/Engine/Include/Engine/EngineAssertHandler.hpp index b47f803..acd1598 100644 --- a/Bigfoot/Sources/Engine/Include/Engine/EngineAssertHandler.hpp +++ b/Bigfoot/Sources/Engine/Include/Engine/EngineAssertHandler.hpp @@ -8,46 +8,13 @@ #define BIGFOOT_ENGINE_ENGINEASSERTHANDLER_HPP #include -#include +#include #if defined BIGFOOT_NOT_OPTIMIZED -#include -#include - namespace Bigfoot { -class EngineAssertHandler -{ - public: - EngineAssertHandler() = delete; - - EngineAssertHandler(const EngineAssertHandler& p_handler) = delete; - EngineAssertHandler(EngineAssertHandler&& p_handler) = delete; - - ~EngineAssertHandler() = delete; - - /** - * Handle an assertion. - * - * \param p_location Location of the assertion. - * \param p_format Format string for the assertion message. - * \param p_args Arguments for the format string. - */ - template - static void Handle(const std::source_location& p_location, std::format_string p_format, ARGS&&... p_args) - { - BIGFOOT_LOG_FATAL(ENGINE_LOGGER, - "Assert: {} (File:{}, Line:{}, Function:{}\n", - std::format(p_format, std::forward(p_args)...), - p_location.file_name(), - p_location.line(), - p_location.function_name()); - } - - EngineAssertHandler& operator=(const EngineAssertHandler& p_handler) = delete; - EngineAssertHandler& operator=(EngineAssertHandler&& p_handler) = delete; -}; +using EngineAssertHandler = AssertHandler; } // namespace Bigfoot #endif #endif diff --git a/Bigfoot/Sources/System/Include/System/SystemAssertHandler.hpp b/Bigfoot/Sources/System/Include/System/SystemAssertHandler.hpp index 8ee1842..f0bb121 100644 --- a/Bigfoot/Sources/System/Include/System/SystemAssertHandler.hpp +++ b/Bigfoot/Sources/System/Include/System/SystemAssertHandler.hpp @@ -8,46 +8,13 @@ #define BIGFOOT_SYSTEM_SYSTEMASSERTHANDLER_HPP #include -#include +#include #if defined BIGFOOT_NOT_OPTIMIZED -#include -#include - namespace Bigfoot { -class SystemAssertHandler -{ - public: - SystemAssertHandler() = delete; - - SystemAssertHandler(const SystemAssertHandler& p_handler) = delete; - SystemAssertHandler(SystemAssertHandler&& p_handler) = delete; - - ~SystemAssertHandler() = delete; - - /** - * Handle an assertion. - * - * \param p_location Location of the assertion. - * \param p_format Format string for the assertion message. - * \param p_args Arguments for the format string. - */ - template - static void Handle(const std::source_location& p_location, std::format_string p_format, ARGS&&... p_args) - { - BIGFOOT_LOG_FATAL(SYSTEM_LOGGER, - "Assert: {} (File:{}, Line:{}, Function:{}\n", - std::format(p_format, std::forward(p_args)...), - p_location.file_name(), - p_location.line(), - p_location.function_name()); - } - - SystemAssertHandler& operator=(const SystemAssertHandler& p_handler) = delete; - SystemAssertHandler& operator=(SystemAssertHandler&& p_handler) = delete; -}; +using SystemAssertHandler = AssertHandler; } // namespace Bigfoot #endif #endif diff --git a/Bigfoot/Sources/Utils/Include/Utils/Assert.hpp b/Bigfoot/Sources/Utils/Include/Utils/Assert/Assert.hpp similarity index 100% rename from Bigfoot/Sources/Utils/Include/Utils/Assert.hpp rename to Bigfoot/Sources/Utils/Include/Utils/Assert/Assert.hpp diff --git a/Bigfoot/Sources/Utils/Include/Utils/Assert/AssertHandler.hpp b/Bigfoot/Sources/Utils/Include/Utils/Assert/AssertHandler.hpp new file mode 100644 index 0000000..05f1310 --- /dev/null +++ b/Bigfoot/Sources/Utils/Include/Utils/Assert/AssertHandler.hpp @@ -0,0 +1,53 @@ +/********************************************************************* + * \file AssertHandler.hpp + * + * \author Romain BOULLARD + * \date August 2026 + *********************************************************************/ +#ifndef BIGFOOT_UTILS_ASSERTHANDLER_HPP +#define BIGFOOT_UTILS_ASSERTHANDLER_HPP +#include +#include + +#if defined BIGFOOT_NOT_OPTIMIZED + +#include +#include + +namespace Bigfoot +{ +template +class AssertHandler +{ + public: + AssertHandler() = delete; + + AssertHandler(const AssertHandler& p_handler) = delete; + AssertHandler(AssertHandler&& p_handler) = delete; + + ~AssertHandler() = delete; + + /** + * Handle an assertion. + * + * \param p_location Location of the assertion. + * \param p_format Format string for the assertion message. + * \param p_args Arguments for the format string. + */ + template + static void Handle(const std::source_location& p_location, std::format_string p_format, ARGS&&... p_args) + { + BIGFOOT_LOG_FATAL(LOGGER, + "Assert: {} (File:{}, Line:{}, Function:{}\n", + std::format(p_format, std::forward(p_args)...), + p_location.file_name(), + p_location.line(), + p_location.function_name()); + } + + AssertHandler& operator=(const AssertHandler& p_handler) = delete; + AssertHandler& operator=(AssertHandler&& p_handler) = delete; +}; +} // namespace Bigfoot +#endif +#endif diff --git a/Bigfoot/Sources/Utils/Include/Utils/UtilsAssertHandler.hpp b/Bigfoot/Sources/Utils/Include/Utils/UtilsAssertHandler.hpp index 7777449..507889b 100644 --- a/Bigfoot/Sources/Utils/Include/Utils/UtilsAssertHandler.hpp +++ b/Bigfoot/Sources/Utils/Include/Utils/UtilsAssertHandler.hpp @@ -6,47 +6,14 @@ *********************************************************************/ #ifndef BIGFOOT_UTILS_UTILSASSERTHANDLER_HPP #define BIGFOOT_UTILS_UTILSASSERTHANDLER_HPP -#include +#include #include #if defined BIGFOOT_NOT_OPTIMIZED -#include -#include - namespace Bigfoot { -class UtilsAssertHandler -{ - public: - UtilsAssertHandler() = delete; - - UtilsAssertHandler(const UtilsAssertHandler& p_handler) = delete; - UtilsAssertHandler(UtilsAssertHandler&& p_handler) = delete; - - ~UtilsAssertHandler() = delete; - - /** - * Handle an assertion. - * - * \param p_location Location of the assertion. - * \param p_format Format string for the assertion message. - * \param p_args Arguments for the format string. - */ - template - static void Handle(const std::source_location& p_location, std::format_string p_format, ARGS&&... p_args) - { - BIGFOOT_LOG_FATAL(UTILS_LOGGER, - "Assert: {} (File:{}, Line:{}, Function:{}\n", - std::format(p_format, std::forward(p_args)...), - p_location.file_name(), - p_location.line(), - p_location.function_name()); - } - - UtilsAssertHandler& operator=(const UtilsAssertHandler& p_handler) = delete; - UtilsAssertHandler& operator=(UtilsAssertHandler&& p_handler) = delete; -}; +using UtilsAssertHandler = AssertHandler; } // namespace Bigfoot #endif #endif