20 enum class assert_type
41 std::function<void(
const category&
category, assert_type eAssertType)> onExit =
48 std::function<verbosity(assert_type eAssertType)> getVerbosity = [](assert_type eAssertType)
52 case assert_type::assert:
53 case assert_type::verify:
54 return verbosity::critical;
56 case assert_type::expect:
57 case assert_type::ensure:
59 return verbosity::error;
64 string_view svCondition,
66 assert_type eAssertType,
67 string_view svUserMessage,
68 string_view svFunction,
73 bool bLogAssertion =
true;
89 string_view svCondition,
91 assert_type eAssertType,
93 string_view svFunction,
123 #define _QX_DEBUG_BREAK() __debugbreak()
125 #define _QX_DEBUG_BREAK() __builtin_debugtrap()
128 #define _QX_DEBUG_BREAK() raise(SIGTRAP)
130 #define _QX_DEBUG_BREAK() QX_EMPTY_MACRO
133 #ifndef QX_DEBUG_BREAK
134 #define QX_DEBUG_BREAK() _QX_DEBUG_BREAK()
137 #define _QX_COMMON_ASSERT(condition, category, assert_type, after_debug_break, result_t, ...) \
138 static_cast<result_t>( \
139 qx::predicates::is_valid(condition) \
140 || (qx::asserts_manager::get_instance().do_assert( \
144 std::move(_QX_MACRO_USER_MESSAGE(static_cast<qx::string_pool<>*>(nullptr), ##__VA_ARGS__).sValue), \
145 qx::convert_string_literal<qx::char_type, __FUNCTION__>(), \
150 after_debug_break(category, assert_type), \
153 #ifndef _QX_ASSERT_AFTER_DEBUG_BREAK_FATAL
154 #define _QX_ASSERT_AFTER_DEBUG_BREAK_FATAL(category, assert_type) \
155 qx::asserts_manager::get_instance().exit(category, assert_type)
158 #ifndef _QX_ASSERT_AFTER_DEBUG_BREAK_NON_FATAL
159 #define _QX_ASSERT_AFTER_DEBUG_BREAK_NON_FATAL(category, assert_type) false
162 #ifndef QX_WITH_DEBUG_ASSERTS
163 #define QX_WITH_DEBUG_ASSERTS QX_WITH_DEBUG_INFO
Determines assertions behavior.
void set_config(config config)
Set config.
void exit(const category &category, assert_type eAssertType)
Called in fatal assertions to exit the application.
bool do_assert(string_view svCondition, const category &category, assert_type eAssertType, string sUserMessage, string_view svFunction, string_view svFile, i32 nLine)
An entry point for all assertions.
const config & get_config() const
Get config.
A category is a class that identifies a particular piece of code. This code can be located in differe...
Inherit the necessary singleton class from this.
std::int32_t i32
− 9 223 372 036 854 775 808 .. 9 223 372 036 854 775 807