CBase Class Reference

class CBase

Container Base Class

Base class for all classes to be instantiated on the heap.

By convention, all classes derived from CBase have a name beginning with the letter 'C'.

The class has two important features:

1. A virtual destructor that allows instances of derived classes to be destroyed and properly cleaned up through a CBase* pointer. All CBase derived objects can be pushed, as CBase* pointers, onto the cleanup stack, and destroyed through a call to CleanupStack::PopAndDestroy().

2. Initialisation of the CBase derived object to binary zeroes through a specific CBase::operator new() - this means that members, whose initial value should be zero, do not have to be initialised in the constructor. This allows safe destruction of a partially-constructed object.

Note that using C++ arrays of CBase-derived types is not recommended, as objects in the array will not be zero-initialised (as there is no operator new[] member). You should use an array class such as RPointerArray instead for arrays of CBase-derived types.

CleanupStack

Public Member Functions
CBase()
~CBase()
IMPORT_C voidDelete(CBase *)
TAny *operator new(TUint, TAny *)
TAny *operator new(TUint)
TAny *operator new(TUint, TLeave)
TAny *operator new(TUint, TUint)
TAny *operator new(TUint, TLeave, TUint)
Protected Member Functions
IMPORT_C TIntExtension_(TUint, TAny *&, TAny *)
Private Member Functions
CBase(const CBase &)
CBase &operator=(const CBase &)

Constructor & Destructor Documentation

CBase()

CBase()[inline]

Default constructor

CBase(const CBase &)

CBase(const CBase &)[private]

Parameters

const CBase &

~CBase()

IMPORT_C~CBase()[virtual]

Virtual destructor.

Enables any derived object to be deleted through a CBase* pointer.

Member Functions Documentation

Delete(CBase *)

IMPORT_C voidDelete(CBase *aPtr)[static]

Deletes the specified object.

Parameters

CBase * aPtrPointer to the CBase derived object to be deleted.

Extension_(TUint, TAny *&, TAny *)

IMPORT_C TIntExtension_(TUintaExtensionId,
TAny *&a0,
TAny *a1
)[protected, virtual]

Extension function

Parameters

TUint aExtensionId
TAny *& a0
TAny * a1

operator new(TUint, TAny *)

TAny *operator new(TUintaSize,
TAny *aBase
)[inline]

Initialises the object to binary zeroes.

Parameters

TUint aSizeThe size of the derived class. This parameter is specified implicitly by C++ in all circumstances in which a derived class is allocated.
TAny * aBaseIndicates a base address which is returned as the object's address.

operator new(TUint)

TAny *operator new(TUintaSize)[inline]

Allocates the object from the heap and then initialises its contents to binary zeroes.

Parameters

TUint aSizeThe size of the derived class. This parameter is specified implicitly by C++ in all circumstances in which a derived class is allocated.

operator new(TUint, TLeave)

TAny *operator new(TUintaSize,
TLeave
)[inline]

Allocates the object from the heap and then initialises its contents to binary zeroes.

Parameters

TUint aSizeThe size of the derived class. This parameter is specified implicitly by C++ in all circumstances in which a derived class is allocated.
TLeave

operator new(TUint, TUint)

TAny *operator new(TUintaSize,
TUintaExtraSize
)[inline]

Allocates the object from the heap and then initialises its contents to binary zeroes.

Use of this overload is rare.

Parameters

TUint aSizeThe size of the derived class. This parameter is specified implicitly by C++ in all circumstances in which a derived class is allocated.
TUint aExtraSizeIndicates additional size beyond the end of the base class.

operator new(TUint, TLeave, TUint)

TAny *operator new(TUintaSize,
TLeave,
TUintaExtraSize
)[inline]

Allocates the object from the heap and then initialises its contents to binary zeroes.

Use of this overload is rare.

Parameters

TUint aSizeThe size of the derived class. This parameter is specified implicitly by C++ in all circumstances in which a derived class is allocated.
TLeave
TUint aExtraSizeIndicates additional size beyond the end of the base class.

operator=(const CBase &)

CBase &operator=(const CBase &)[private]

Parameters

const CBase &