qxLib
Classes | Public Member Functions | List of all members
qx::asserts_manager Class Referencefinal

Determines assertions behavior. More...

#include <asserts_manager.h>

Inheritance diagram for qx::asserts_manager:
singleton< asserts_manager >

Classes

struct  config
 
struct  interceptor_entry
 

Public Member Functions

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. More...
 
void exit (const category &category, assert_type eAssertType)
 Called in fatal assertions to exit the application. More...
 
config get_config () const
 Get config. More...
 
void set_config (config config)
 Set config. More...
 
void add_interceptor (const void *pOwner, interceptor_func interceptor)
 Register an assertion interceptor. More...
 
void remove_interceptor (const void *pOwner)
 Remove an interceptor, waiting for callbacks already in progress. More...
 

Detailed Description

Determines assertions behavior.

Author
Khrapov
Date
4.01.2026

Definition at line 57 of file asserts_manager.h.

Member Function Documentation

◆ add_interceptor()

void qx::asserts_manager::add_interceptor ( const void *  pOwner,
interceptor_func  interceptor 
)
inline

Register an assertion interceptor.

Interceptors are tried in registration order before normal assertion handling. A matching interceptor suppresses logging, the callback and debug break. Fatal assertions still call onExit. It must not modify the interceptor list or the manager configuration from its callback.

Parameters
pOwner- unique identity used to remove the interceptor
interceptor- returns true when the assertion is handled

Definition at line 97 of file asserts_manager.inl.

◆ do_assert()

bool qx::asserts_manager::do_assert ( string_view  svCondition,
const category &  category,
assert_type  eAssertType,
string  sUserMessage,
string_view  svFunction,
string_view  svFile,
i32  nLine 
)
inline

An entry point for all assertions.

Parameters
svCondition- a string representation of the condition
category- a category of the assertion (file wide or manually specified)
eAssertType- an assertion type
sUserMessage- formatted user message, if specified
svFunction- assert location function
svFile- assert location file
nLine- assert location line number
Returns
- true if debug break is required

Definition at line 41 of file asserts_manager.inl.

◆ exit()

void qx::asserts_manager::exit ( const category &  category,
assert_type  eAssertType 
)
inline

Called in fatal assertions to exit the application.

Parameters
category- a category of the assertion (file wide or manually specified)
eAssertType- an assertion type

Definition at line 78 of file asserts_manager.inl.

◆ get_config()

asserts_manager::config qx::asserts_manager::get_config ( ) const
inline

Get config.

Returns
- a thread-safe copy of the current configuration

Definition at line 85 of file asserts_manager.inl.

◆ remove_interceptor()

void qx::asserts_manager::remove_interceptor ( const void *  pOwner)
inline

Remove an interceptor, waiting for callbacks already in progress.

Parameters
pOwner- identity supplied when registering the interceptor

Definition at line 103 of file asserts_manager.inl.

◆ set_config()

void qx::asserts_manager::set_config ( config  config)
inline

Set config.

Parameters
config- new config

Definition at line 91 of file asserts_manager.inl.


The documentation for this class was generated from the following files: