CLiwContainer Class Reference

class CLiwContainer : public CBase

Base class for the framework supported container types. CLiwContainer is a self managing, reference counted container. This class offers minimal interface to manage the reference counter and to serialize the container data into the stream.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Since container objects are reference counted, they cannot go with CleanupStack::PushL. The issue is solved by using CleanupClosePushL for pushing the container objects into the CleanupStack. Hence CLiwContainer::Close method is introduced common to all container objects

All the container data types supported by the framework are derived from CLiwContainer.

ServiceHandler.lib

CLiwContainer::Close CLiwContainer::PushLCLiwList CLiwMap CLiwIterable

Inherits from

Constructor & Destructor Documentation

CLiwContainer()

CLiwContainer()[protected, inline]

Protected default constructor. This method is available only for the derived container types. The reference count is set to its default vale.

~CLiwContainer()

IMPORT_C~CLiwContainer()[protected, virtual]

Destructor.

Member Functions Documentation

Close()

IMPORT_C voidClose()

!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Since reference counting does not work with CleanupStack directly, CleanupStack::PushL cannot be used for container objects which are reference counted

So CleanupClosePushL method is used for container objects. Hence the need for this method

This method informs the CleanupStack that Close method should be called incase of any Leave

Close() inturn calls DecRef which ensures proper cleanup of container objects

Example 1: //Using PushL to push the container object into the CleanupStack using CleanupClosePushL

	CLiwMap* map = CLiwDefaultMap::NewL();
 	map->PushL();
 	map->InsertL(KNullDesC8,variant);	//incase of any leave, CLiwContainer::Close is called
 	CleanupStack::PopAndDestroy(map);	//CLiwContainer::Close() is called

Example 2: //Using NewLC to push the container object into the CleanupStack using CleanupClosePushL

	CLiwMap* map = CLiwDefaultMap::NewLC();
 	map->InsertL(KNullDesC8,variant);	//incase of any leave, CLiwContainer::Close is called
 	CleanupStack::PopAndDestroy(map);   //CLiwContainer::Close() is called

@ see CLiwContainer::NewLC (pushes the container object using CleanupClosePushL) @ see CLiwContainer::PushL (pushes the container object using CleanupClosePushL)

DecRef()

voidDecRef()[inline]

Decrements the container reference count by one. If there are no more references to the container type, this container instance will be deleted.

ExternalizeL(RWriteStream &)

IMPORT_C voidExternalizeL(RWriteStream &aOutputStream)const [virtual]

Serializes the collection entries to an output stream. The derving container types from CLiwContainer should provide a concrete implementation to serialize the collection data. The default implementation of this method just leaves with an error code KErrNotSupported.

leave
KErrNotSupported whenever this method is called instead of a dervied class implementation of this method
RWiteStream

Parameters

RWriteStream & aOutputStreamthe output stream to which the data will be streamed

IncRef()

voidIncRef()[inline]

Increments the container reference count by one. The reference count gets incremented whenever a copy of the data values is made.

PushL()

IMPORT_C voidPushL()

!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!

A Friendly method to push the CLiwContainer Object into the CleanupStack using CleanupClosePushL

This method informs the CleanupStack that Close method should be called incase of any Leave

 	CLiwMap* map = CLiwDefaultMap::NewL();
 	map->PushL();
 	map->InsertL(KNullDesC8,variant);	//incase of any leave, CLiwContainer::Close is called
 	CleanupStack::PopAndDestroy(map);	//CLiwContainer::Close() is called

@ see CLiwContainer::Close

Size()

IMPORT_C TIntSize()const [virtual]

Returns the size of collection data values. This default implementation of this method leaves with an error code KErrNotSupported. Typically, the size is calculated based on the size of data type(s) the container holds and the total number of entries present in the collection.

leave
KErrNotSupported whenever this method is called instead of derived class implementation of this method

Member Data Documentation

TInt iRefCount

TInt iRefCount[private]