lxgui
Loading...
Searching...
No Matches
Public Member Functions | List of all members
lxgui::gui::alive_checker Class Reference

Utility class for safe checking of region validity. More...

#include <gui_alive_checker.hpp>

Public Member Functions

 alive_checker (region &object)
 Contructor.
 
 alive_checker (const alive_checker &)=delete
 
 alive_checker (alive_checker &&)=delete
 
alive_checkeroperator= (const alive_checker &)=delete
 
alive_checkeroperator= (alive_checker &&)=delete
 
bool is_alive () const
 Check if the wrapped region is still alive.
 

Detailed Description

Utility class for safe checking of region validity.

To use this class, construct an instance of alive_checker with any object you wish to monitor. Then use the object. Then use alive_checker::is_alive() to check if the object is still alive.

// Construct the checker
alive_checker checker(*this);
// Call a member function that may destroy 'this'
maybe_destroy_this();
// Check if 'this' is still alive
if (!checker.is_alive()) return;
Utility class for safe checking of region validity.

Definition at line 30 of file gui_alive_checker.hpp.

Constructor & Destructor Documentation

◆ alive_checker() [1/3]

lxgui::gui::alive_checker::alive_checker ( region object)
inlineexplicit

Contructor.

Parameters
objectThe object to monitor

Definition at line 36 of file gui_alive_checker.hpp.

◆ alive_checker() [2/3]

lxgui::gui::alive_checker::alive_checker ( const alive_checker )
delete

◆ alive_checker() [3/3]

lxgui::gui::alive_checker::alive_checker ( alive_checker &&  )
delete

Member Function Documentation

◆ is_alive()

bool lxgui::gui::alive_checker::is_alive ( ) const
inline

Check if the wrapped region is still alive.

Returns
'true' if the region is alive, 'false' otherwise

Definition at line 48 of file gui_alive_checker.hpp.

◆ operator=() [1/2]

alive_checker & lxgui::gui::alive_checker::operator= ( alive_checker &&  )
delete

◆ operator=() [2/2]

alive_checker & lxgui::gui::alive_checker::operator= ( const alive_checker )
delete

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