CCleanup Class Reference

#include <e32base.h>

class CCleanup : public CBase

Inherits from

Protected Attributes
TCleanupStackItem *iBase
TCleanupStackItem *iNext
TCleanupStackItem *iTop
Public Member Functions
~CCleanup()
IMPORT_C voidCheck(TAny *)
IMPORT_C CCleanup *New()
IMPORT_C CCleanup *NewL()
IMPORT_C voidNextLevel()
IMPORT_C voidPop()
IMPORT_C voidPop(TInt)
IMPORT_C voidPopAll()
IMPORT_C voidPopAndDestroy()
IMPORT_C voidPopAndDestroy(TInt)
IMPORT_C voidPopAndDestroyAll()
IMPORT_C voidPreviousLevel()
IMPORT_C voidPushL(TAny *)
IMPORT_C voidPushL(CBase *)
IMPORT_C voidPushL(TCleanupItem)
Protected Member Functions
CCleanup()
IMPORT_C voidDoPop(TInt, TBool)
IMPORT_C voidDoPopAll(TBool)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()

Detailed Description

Implements the cleanup stack.

An object of this type is created and used by the cleanup stack interface, CTrapCleanup.

Member Attribute Documentation

iBase

TCleanupStackItem *iBase[protected]

Pointer to the bottom of the cleanup stack.

iNext

TCleanupStackItem *iNext[protected]

Pointer to the next availaible slot in the cleanup stack.

iTop

TCleanupStackItem *iTop[protected]

Pointer to the top of the cleanup stack.

Constructor & Destructor Documentation

CCleanup ( )

IMPORT_CCCleanup()[protected]

Default constructor.

~CCleanup ( )

IMPORT_C~CCleanup()

Destructor.

Pops and destroys all items from the cleanup stack and then destroys the cleanup stack itself.

Member Function Documentation

Check ( TAny * )

IMPORT_C voidCheck(TAny *aExpectedItem)

Checks that the cleanup item at the top of the cleanup stack represents a cleanup operation for the specified object.

ParameterDescription
aExpectedItemThe object which is the subject of the test.

DoPop ( TInt, TBool )

IMPORT_C voidDoPop(TIntaCount,
TBoolaDestroy
)[protected]

Provides an implementation for Pop() and PopAndDestroy().

ParameterDescription
aCountThe number of cleanup items to be popped from the cleanup stack.
aDestroyETrue, if cleanup is to be performed; EFalse, otherwise.

DoPopAll ( TBool )

IMPORT_C voidDoPopAll(TBoolaDestroy)[protected]

Provides an implementation for PopAll() and PopAndDestroyAll().

ParameterDescription
aDestroyETrue, if cleanup is to be performed; EFalse, otherwise.

New ( )

IMPORT_C CCleanup *New()[static]

Creates a new cleanup stack object.

The cleanup stack itself is allocated with enough space initially to hold a number of stack items.

Returns: A pointer to the new cleanup stack object. This is Null if there is insufficient memory.

NewL ( )

IMPORT_C CCleanup *NewL()[static]

Creates a new cleanup stack object, and leaves if there is insufficient memory to create it.

The cleanup stack itself is allocated with enough space initially to hold a number of stack items.

Returns: A pointer to the new cleanup stack object. This is Null if there is nsufficient memory.

NextLevel ( )

IMPORT_C voidNextLevel()

Goes to the next cleanup level.

Pop ( )

IMPORT_C voidPop()

Pops a single cleanup item from the cleanup stack.

panic
E32USER-CBase 64 If there are no items on the cleanup stack.
panic
E32USER-CBase 63 If a cleanup level is crossed.

Pop ( TInt )

IMPORT_C voidPop(TIntaCount)

Pops the specified number of cleanup items from the cleanup stack.

panic
E32USER-CBase 70 If the specified number of cleanup items is negative.
panic
E32USER-CBase 64 If the specifed number of items is greater than the number of items on the cleanup stack.
panic
E32USER-CBase 63 If the specified number of items is such that it causes a cleanup level to be crossed.
ParameterDescription
aCountThe number of cleanup items to be popped from the cleanup stack.

PopAll ( )

IMPORT_C voidPopAll()

Pops all cleanup items at the current level, and then decrements the level.

PopAndDestroy ( )

IMPORT_C voidPopAndDestroy()

Pops a single cleanup item from the cleanup stack, and invokes its cleanup operation.

panic
E32USER-CBase 64 If there are no items on the cleanup stack.
panic
E32USER-CBase 63 If a cleanup level is crossed.

PopAndDestroy ( TInt )

IMPORT_C voidPopAndDestroy(TIntaCount)

Pops the specified number of cleanup items from the cleanup stack, and invokes their cleanup operations.

panic
E32USER-CBase 70 If the specified number of cleanup items is negative.
panic
E32USER-CBase 64 If the specifed number of items is greater than the number of items on the cleanup stack.
panic
E32USER-CBase 63 If the specified number of items is such that it causes a cleanup level to be crossed.
ParameterDescription
aCountThe number of cleanup items to be popped from the cleanup stack.

PopAndDestroyAll ( )

IMPORT_C voidPopAndDestroyAll()

Pops all cleanup items at the current level, invokes their cleanup operations and then decrements the level.

PreviousLevel ( )

IMPORT_C voidPreviousLevel()

Goes to the previous cleanup level.

panic
E32USER-CBase 71 If the previous stack item does not represent a cleanup level.

PushL ( TAny * )

IMPORT_C voidPushL(TAny *aPtr)

Pushes a cleanup item onto the cleanup stack.

The cleanup item represents an operation that frees the specified heap cell.

ParameterDescription
aPtrA pointer to a heap cell that will be freed by the cleanup operation.

PushL ( CBase * )

IMPORT_C voidPushL(CBase *anObject)

Pushes a cleanup item onto the cleanup stack.

The cleanup item represents an operation that deletes the specified CBase derived object.

ParameterDescription
anObjectA pointer to CBase derived object that will be deleted by the cleanup operation.

PushL ( TCleanupItem )

IMPORT_C voidPushL(TCleanupItemanItem)

Pushes a cleanup item onto the cleanup stack.

The cleanup item represents a call back operation that performs the required cleanup.

See also: CleanupClosePushL CleanupReleasePushL CleanupDeletePushL

ParameterDescription
anItemEncapsulates a cleanup operation and an object on which the cleanup operation is to be performed.