diff -r 000000000000 -r f72a12da539e idlehomescreen/xmluirendering/dom/src/xndomlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlehomescreen/xmluirendering/dom/src/xndomlist.cpp Thu Dec 17 08:40:49 2009 +0200 @@ -0,0 +1,384 @@ +/* +* Copyright (c) 2005,2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: List class to hold CXnDomList objects. +* +*/ + + + +// INCLUDE FILES +#include "xndomlist.h" +#include "xndomnode.h" +#include "xndomattribute.h" +#include "xndomproperty.h" +#include "xndompropertyvalue.h" +#include "xndomstringpool.h" + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXnDomList::CXnDomList +// C++ parameter constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CXnDomList::CXnDomList( + TListType aListType, + CXnDomStringPool& aStringPool, + TInt aGranularity ): + iListType( aListType ), + iList( aGranularity ), + iStringPool( aStringPool ) + { + } +// ----------------------------------------------------------------------------- +// CXnDomList::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CXnDomList::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// CXnDomList::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CXnDomList* CXnDomList::NewL( + TListType aListType, + CXnDomStringPool& aStringPool, + TInt aGranularity) + { + CXnDomList* self = + new( ELeave ) CXnDomList( aListType, aStringPool,aGranularity ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } +// ----------------------------------------------------------------------------- +// CXnDomList::NewL +// Two-phased stream constructor. +// ----------------------------------------------------------------------------- +// +CXnDomList* CXnDomList::NewL( + RReadStream& aStream, + CXnDomStringPool& aStringPool ) + { + CXnDomList* self = new( ELeave ) CXnDomList( ENodeList, aStringPool ); + + CleanupStack::PushL( self ); + + aStream >> *self; + CleanupStack::Pop( self ); + + return self; + } + +// Destructor +CXnDomList::~CXnDomList() + { + iList.ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// CXnDomList::Reset +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXnDomList::Reset() + { + iList.Reset(); + } + +// ----------------------------------------------------------------------------- +// CXnDomList::AddItemL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXnDomList::AddItemL( MXnDomListItem* aItem ) + { + iList.AppendL( aItem ); + } + +// ----------------------------------------------------------------------------- +// CXnDomList::AddItemL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXnDomList::AddItemL( MXnDomListItem* aItem, TInt aIndex ) + { + iList.InsertL( aItem, aIndex ); + } + +// ----------------------------------------------------------------------------- +// CXnDomList::RemoveItem +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXnDomList::RemoveItem( TInt aIndex ) + { + iList.Remove( aIndex); + iList.Compress(); + } +// ----------------------------------------------------------------------------- +// CXnDomList::DeleteItem +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXnDomList::DeleteItem( TInt aIndex ) + { + delete iList[ aIndex ]; + iList.Remove( aIndex); + iList.Compress(); + } + +// ----------------------------------------------------------------------------- +// CXnDomList::RemoveItem +// ----------------------------------------------------------------------------- +// +EXPORT_C void CXnDomList::RemoveItem( MXnDomListItem* aItem ) + { + MXnDomListItem* tmp = NULL; + TInt count( iList.Count() ); + TBool stop( EFalse ); + for ( TInt i=0; iName() ) == 0 ) + { + return tmp; + } + } + return NULL; + } + +// ----------------------------------------------------------------------------- +// CXnDomList::ItemIndex +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CXnDomList::ItemIndex( const MXnDomListItem& aItem ) const + { + + MXnDomListItem* tmp = NULL; + TInt count( iList.Count() ); + for ( TInt i=0; iSize(); + } + return size; + } +// ----------------------------------------------------------------------------- +// CXnDomList::ExternalizeL +// ----------------------------------------------------------------------------- +// +void CXnDomList::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteInt8L( iListType ); + + + TInt count( iList.Count() ); + aStream.WriteInt32L( count ); + + + for ( TInt i=0; i( aStream.ReadInt8L() ); + + TInt count ( aStream.ReadInt32L() ); + for ( TInt i=0; i