Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
CleanList Class Reference

#include <elm/util/Cleaner.h>

Public Member Functions

 ~CleanList (void)
 
void add (Cleaner *cleaner)
 
template<class T >
void add (T *p)
 
void clean (void)
 
Cleaneroperator() (Cleaner *cleaner)
 
template<class T >
const LockPtr< T > & operator() (const LockPtr< T > &object)
 
template<class T >
T * operator() (T *object)
 

Detailed Description

A CleanList is an easy way to not forget or to delegate clean-up in complex program. A CleanList receives a list of Cleaner object that records some cleanup to perform. When the CleanList is deleted or when the method clean() is called, clean-up actions of all stored object is invoked ensuring to not forget clean-up to perform. @code { CleanList to_clean; int *p = to_clean(new int); ... } // p deletion automatically performed at clean deletion

Constructor & Destructor Documentation

◆ ~CleanList()

~CleanList ( void  )
inline

References CleanList::clean().

Member Function Documentation

◆ add() [1/2]

void add ( Cleaner cleaner)

Add a cleaner to the list.

Parameters
cleanerCleaner to add.

References List< T, E, A >::add().

Referenced by CleanList::operator()().

◆ add() [2/2]

void add ( T *  p)
inline

References CleanList::add(), and elm::io::p().

Referenced by CleanList::add().

◆ clean()

void clean ( void  )

Clean the recorded cleaners.

References List< T, E, A >::clear().

Referenced by CleanList::~CleanList().

◆ operator()() [1/3]

Cleaner* operator() ( Cleaner cleaner)
inline

References CleanList::add().

◆ operator()() [2/3]

const LockPtr<T>& operator() ( const LockPtr< T > &  object)
inline

References CleanList::add().

◆ operator()() [3/3]

T* operator() ( T *  object)
inline

References CleanList::add().


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