Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: e32base.inl

CleanupClosePushL()

inline void CleanupClosePushL(T &aRef);

Description

Constructs and pushes a TCleanupItem object onto the cleanup stack.

The TCleanupItem encapsulates:

1. a reference aRef to the object of type class T which is to be cleaned up

2. an associated cleanup operation.

The cleanup operation is the private static function Close() of the templated class CleanupClose and is invoked as a result of a subsequent call to CleanupStack::PopAndDestroy().

CleanupClose::Close() is passed a pointer to the class T object to be cleaned up, and the function implements cleanup by calling Close() on the passed object. The class T object must, therefore, define and implement (or inherit) a Close() member function.

An example of its use:

class RTestTwo;
    {
public :
    ...
    IMPORT_C void Close();
    ...
    }
...
RTestTwo two;
CleanupClosePushL(two);
...
CleanupStack::PopAndDestroy(); // <--- results in Close() being called on "two".
......

In practice, this type of cleanup operation is commonly applied to handles to resources; if such handles are constructed on the program stack, then it is important that such handles are closed.

Parameters

T &aRef

A reference to a class T type object for which the cleanup item is being created.

See also: