LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
Loading...
Searching...
No Matches
wx_utils Namespace Reference

Functions

long to_wx_long (size_t value) noexcept
 Safely convert size_t to long for wxWidgets APIs.
 
int to_wx_int (size_t value) noexcept
 Safely convert size_t to int for wxWidgets APIs.
 
unsigned int to_wx_uint (size_t value) noexcept
 Safely convert size_t to unsigned int for wxWidgets APIs.
 
size_t from_wx_long (long value) noexcept
 Safely convert long to size_t.
 
size_t from_wx_int (int value) noexcept
 Safely convert int to size_t.
 
size_t from_wx_uint (unsigned int value) noexcept
 Safely convert unsigned int to size_t.
 
unsigned int int_to_uint (int value) noexcept
 Safely convert int to unsigned int for wxWidgets APIs.
 
int uint_to_int (unsigned int value) noexcept
 Safely convert unsigned int to int for wxWidgets APIs.
 
int to_model_index (size_t value) noexcept
 Safely convert size_t to int for IModel interface.
 
void validate_int_range (size_t value)
 Validate that a size_t value fits in an int.
 
void validate_long_range (size_t value)
 Validate that a size_t value fits in a long.
 

Function Documentation

◆ from_wx_int()

size_t wx_utils::from_wx_int ( int  value)
inlinenoexcept

Safely convert int to size_t.

Parameters
valueThe int value to convert
Returns
size_t The converted value, 0 if negative
Note
Returns 0 for negative values to maintain unsigned semantics

◆ from_wx_long()

size_t wx_utils::from_wx_long ( long  value)
inlinenoexcept

Safely convert long to size_t.

Parameters
valueThe long value to convert
Returns
size_t The converted value, 0 if negative
Note
Returns 0 for negative values to maintain unsigned semantics

◆ from_wx_uint()

size_t wx_utils::from_wx_uint ( unsigned int  value)
inlinenoexcept

Safely convert unsigned int to size_t.

Parameters
valueThe unsigned int value to convert
Returns
size_t The converted value

◆ int_to_uint()

unsigned int wx_utils::int_to_uint ( int  value)
inlinenoexcept

Safely convert int to unsigned int for wxWidgets APIs.

Parameters
valueThe int value to convert
Returns
unsigned int The converted value, 0 if negative
Note
Returns 0 for negative values

◆ to_model_index()

int wx_utils::to_model_index ( size_t  value)
inlinenoexcept

Safely convert size_t to int for IModel interface.

Parameters
valueThe size_t value to convert
Returns
int The converted value, clamped to INT_MAX
Note
This is specifically for the IModel::GetEvent(int) interface
Here is the call graph for this function:

◆ to_wx_int()

int wx_utils::to_wx_int ( size_t  value)
inlinenoexcept

Safely convert size_t to int for wxWidgets APIs.

Parameters
valueThe size_t value to convert
Returns
int The converted value, clamped to INT_MAX if necessary
Note
Clamps to INT_MAX to prevent overflow
Here is the caller graph for this function:

◆ to_wx_long()

long wx_utils::to_wx_long ( size_t  value)
inlinenoexcept

Safely convert size_t to long for wxWidgets APIs.

Parameters
valueThe size_t value to convert
Returns
long The converted value, clamped to LONG_MAX if necessary
Note
Clamps to LONG_MAX to prevent overflow

◆ to_wx_uint()

unsigned int wx_utils::to_wx_uint ( size_t  value)
inlinenoexcept

Safely convert size_t to unsigned int for wxWidgets APIs.

Parameters
valueThe size_t value to convert
Returns
unsigned int The converted value, clamped to UINT_MAX if necessary
Note
Clamps to UINT_MAX to prevent overflow

◆ uint_to_int()

int wx_utils::uint_to_int ( unsigned int  value)
inlinenoexcept

Safely convert unsigned int to int for wxWidgets APIs.

Parameters
valueThe unsigned int value to convert
Returns
int The converted value, clamped to INT_MAX if necessary
Note
Clamps to INT_MAX to prevent overflow

◆ validate_int_range()

void wx_utils::validate_int_range ( size_t  value)
inline

Validate that a size_t value fits in an int.

Parameters
valueThe size_t value to validate
Exceptions
std::overflow_errorif value > INT_MAX

◆ validate_long_range()

void wx_utils::validate_long_range ( size_t  value)
inline

Validate that a size_t value fits in a long.

Parameters
valueThe size_t value to validate
Exceptions
std::overflow_errorif value > LONG_MAX