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::PushL CLiwList CLiwMap CLiwIterable
Public Member Functions | |
---|---|
IMPORT_C void | Close () |
void | DecRef () |
IMPORT_C void | ExternalizeL ( RWriteStream &) |
void | IncRef () |
IMPORT_C void | PushL () |
IMPORT_C TInt | Size () |
Protected Member Functions | |
---|---|
CLiwContainer () | |
~CLiwContainer () |
Private Attributes | |
---|---|
TInt | iRefCount |
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.
IMPORT_C void | Close | ( | ) |
!!!!!!!!!!!!!!!!!!!!!!!!!!!! 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)
void | DecRef | ( | ) | [inline] |
Decrements the container reference count by one. If there are no more references to the container type, this container instance will be deleted.
IMPORT_C void | ExternalizeL | ( | 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 .
RWriteStream & aOutputStream | the output stream to which the data will be streamed |
void | IncRef | ( | ) | [inline] |
Increments the container reference count by one. The reference count gets incremented whenever a copy of the data values is made.
IMPORT_C void | PushL | ( | ) |
!!!!!!!!!!!!!!!!!!!!!!!!!!!! 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
IMPORT_C TInt | Size | ( | ) | 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.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.