Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



Location: e32base.h
Link against: euser.lib

Class CCleanup

class CCleanup : public CBase;

Description

Implements the cleanup stack.

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

Derivation

Members

Defined in CCleanup:
CCleanup(), Check(), DoPop(), DoPopAll(), New(), NewL(), NextLevel(), Pop(), Pop(), PopAll(), PopAndDestroy(), PopAndDestroy(), PopAndDestroyAll(), PreviousLevel(), PushL(), PushL(), PushL(), iBase, iNext, iTop, ~CCleanup()

Inherited from CBase:
Delete(), Extension_(), operator new()


Construction and destruction


NewL()

static IMPORT_C CCleanup *NewL();

Description

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.

Return value

CCleanup *

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


~CCleanup()

IMPORT_C ~CCleanup();

Description

Destructor.

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


CCleanup()

protected: IMPORT_C CCleanup();

Description

Default constructor.

[Top]


Member functions


New()

static IMPORT_C CCleanup *New();

Description

Creates a new cleanup stack object.

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

Return value

CCleanup *

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


NextLevel()

IMPORT_C void NextLevel();

Description

Goes to the next cleanup level.


PreviousLevel()

IMPORT_C void PreviousLevel();

Description

Goes to the previous cleanup level.

Panic codes

E32USER-CBase

71 If the previous stack item does not represent a cleanup level.


PushL()

IMPORT_C void PushL(TAny *aPtr);

Description

Pushes a cleanup item onto the cleanup stack.

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

Parameters

TAny *aPtr

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


PushL()

IMPORT_C void PushL(CBase *anObject);

Description

Pushes a cleanup item onto the cleanup stack.

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

Parameters

CBase *anObject

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


PushL()

IMPORT_C void PushL(TCleanupItem anItem);

Description

Pushes a cleanup item onto the cleanup stack.

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

Parameters

TCleanupItem anItem

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


Pop()

IMPORT_C void Pop();

Description

Pops a single cleanup item from the cleanup stack.

Panic codes

E32USER-CBase

64 If there are no items on the cleanup stack.

E32USER-CBase

63 If a cleanup level is crossed.


Pop()

IMPORT_C void Pop(TInt aCount);

Description

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

Parameters

TInt aCount

The number of cleanup items to be popped from the cleanup stack.

Panic codes

E32USER-CBase

70 If the specified number of cleanup items is negative.

E32USER-CBase

64 If the specifed number of items is greater than the number of items on the cleanup stack.

E32USER-CBase

63 If the specified number of items is such that it causes a cleanup level to be crossed.


PopAll()

IMPORT_C void PopAll();

Description

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


PopAndDestroy()

IMPORT_C void PopAndDestroy();

Description

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

Panic codes

E32USER-CBase

64 If there are no items on the cleanup stack.

E32USER-CBase

63 If a cleanup level is crossed.


PopAndDestroy()

IMPORT_C void PopAndDestroy(TInt aCount);

Description

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

Parameters

TInt aCount

The number of cleanup items to be popped from the cleanup stack.

Panic codes

E32USER-CBase

70 If the specified number of cleanup items is negative.

E32USER-CBase

64 If the specifed number of items is greater than the number of items on the cleanup stack.

E32USER-CBase

63 If the specified number of items is such that it causes a cleanup level to be crossed.


PopAndDestroyAll()

IMPORT_C void PopAndDestroyAll();

Description

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


Check()

IMPORT_C void Check(TAny *aExpectedItem);

Description

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

Parameters

TAny *aExpectedItem

The object which is the subject of the test.


DoPop()

protected: IMPORT_C void DoPop(TInt aCount, TBool aDestroy);

Description

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

Parameters

TInt aCount

The number of cleanup items to be popped from the cleanup stack.

TBool aDestroy

ETrue, if cleanup is to be performed; EFalse, otherwise.


DoPopAll()

protected: IMPORT_C void DoPopAll(TBool aDestroy);

Description

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

Parameters

TBool aDestroy

ETrue, if cleanup is to be performed; EFalse, otherwise.

[Top]


Member data


iBase

protected: TCleanupStackItem * iBase;

Description

Pointer to the bottom of the cleanup stack.


iTop

protected: TCleanupStackItem * iTop;

Description

Pointer to the top of the cleanup stack.


iNext

protected: TCleanupStackItem * iNext;

Description

Pointer to the next availaible slot in the cleanup stack.