class CLiwDefaultList : public CLiwList |
An ordered collection or sequence. CLiwDefaultList providers a default implementation for CLiwList . The collection entries are typically of type TLiwVarian .
access elements based on index
remove an element
append an element to the end of the list collection
get the total number of elements stored in the list collection
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 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.
This implies that the object of this concrete implementation class being created should be pushed into the CleanupStack using CLiwContainer::PushL .
ServiceHandler.lib
CLiwContainer CLiwContainer::Close CLiwContainer::PushL CLiwList TLiwVariant
Public Member Functions | |
---|---|
IMPORT_C void | AppendL (const TLiwVariant &) |
IMPORT_C TBool | AtL ( TInt , TLiwVariant &) |
IMPORT_C TInt | Count () |
IMPORT_C void | ExternalizeL ( RWriteStream &) |
IMPORT_C CLiwDefaultList * | NewL () |
IMPORT_C CLiwDefaultList * | NewLC () |
CLiwDefaultList * | NewLC ( RReadStream &) |
IMPORT_C void | Remove ( TInt ) |
IMPORT_C TInt | Size () |
Private Member Functions | |
---|---|
CLiwDefaultList ( CLiwGenericParamList *) | |
~CLiwDefaultList () |
Private Attributes | |
---|---|
CLiwGenericParamList * | iList |
CLiwDefaultList | ( | CLiwGenericParamList * | aList | ) | [private, inline] |
CLiwGenericParamList * aList |
IMPORT_C void | AppendL | ( | const TLiwVariant & | aEntry | ) | [virtual] |
Appends an entry to the end of the collection. The entry to be added is of type TLiwVariant .
A string content being added to the end of the collection
_LIT8(KLitPbkService,"PhoneBookService"); CLiwDefaultList* pList = CLiwDefaultList::NewL(); pList->PushL(); pList->AppendL(TLiwVariant(KLitPbkService)); CleanupStack::Pop(pList); pList->DecRef();
An integer value being added to the end of the collection
CLiwDefaultList* pList = CLiwDefaultList::NewL(); pList->PushL(); TInt intVal=0; pList->AppendL(TLiwVariant(intVal)); CleanupStack::Pop(pList); pList->DecRef();
const TLiwVariant & aEntry | an Element to be added to the end of the collection |
IMPORT_C TBool | AtL | ( | TInt | aIndex, |
TLiwVariant & | aEntry | |||
) | const [virtual] |
Gets an entry from the collection based on an integeral index.
!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
This is a copy of the value present in the list at the particular index. To ensure proper cleanup TLiwVariant::PushL method should be called beforehand.
An integral value being retrieved from the collection
CLiwDefaultList* pList = CLiwDefaultList::NewL(); pList->PushL(); TInt intVal=1100; //some magic number pList->AppendL(TLiwVariant(intVal)); TInt nIndex=0; //only one entry is stored.. TLiwVariant valFnd; valFnd.PushL(); //Pushes the TLiwVariant into the CleanupStack using TCleanupItem if(EFalse!=pList->AtL(nIndex,valFnd)) { TInt intValFnd=-1; valFnd.Get(intValFnd); } CleanupStack::PopAndDestroy(valFnd); //Pops and Destroys the TLiwVariant object CleanupStack::Pop(pList); pList->DecRef();
TInt aIndex | to get an entry from the collection |
TLiwVariant & aEntry | the returned element from the collection |
IMPORT_C TInt | Count | ( | ) | const [virtual] |
Returns the number of elements present in the collection.
IMPORT_C void | ExternalizeL | ( | RWriteStream & | aOutputStream | ) | const [virtual] |
Serializes the collection data entries to an output stream.
RWiteStream
RWriteStream & aOutputStream | the output stream to which the data will be streamed |
IMPORT_C CLiwDefaultList * | NewL | ( | ) | [static] |
Creates and returns a new instace of CLiwDefaultList
void CreateListL() { CLiwDefaultList* pList = CLiwDefaultList::NewL(); pList->PushL(); //pushes the List into cleanupstack using CleanupClosePushL CleanupStack::Pop(pList); pList->DecRef(); }
@ see PushL @ see Close
IMPORT_C CLiwDefaultList * | NewLC | ( | ) | [static] |
Creates and returns a new instace of CLiwDefaultList
void CreateListL() { CLiwDefaultList* pList = CLiwDefaultList::NewLC(); //pushes the List into cleanupstack using CleanupClosePushL CleanupStack::Pop(pList); pList->DecRef(); }
@ see PushL @ see Close
CLiwDefaultList * | NewLC | ( | RReadStream & | aInputStream | ) | [static] |
Creates and returns a new instace of CLiwDefaultList . The collection elements will be generated from the data values read from the input stream. This method leaves the created instance in the cleanup stack.
RReadStream & aInputStream | the input stream containing the data values to append to the list collection |
IMPORT_C void | Remove | ( | TInt | aIndex | ) | [virtual] |
Removes an element located at the passed index from the collection.
An element being removed from the collection
CLiwDefaultList* pList = CLiwDefaultList::NewL(); pList->PushL(); TInt intVal=1100; //some magic number pList->AppendL(TLiwVariant(intVal)); TInt nIndex=0; //only one entry is stored.. pList->Remove(nIndex); if(0==pList->Count()) { //should be zero } CleanupStack::Pop(pList); pList->DecRef();
TInt aIndex | the index of the element to be removed from the collection |
IMPORT_C TInt | Size | ( | ) | const [virtual] |
Returns the size of the collection. The size is calculated based on the total numer of elements and the size of each element 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.