diff -r 000000000000 -r 667063e416a2 landmarks/locationlandmarks/localaccess/src/EPos_CPosLmLocalIterator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/landmarks/locationlandmarks/localaccess/src/EPos_CPosLmLocalIterator.cpp Tue Feb 02 01:06:48 2010 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2002-2005 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: Local iterator base class. +* +* +*/ + + +#include +#include "EPos_CPosLmLocalIterator.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +CPosLmLocalIterator::CPosLmLocalIterator() : + CPosLmItemIterator() + { + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +CPosLmLocalIterator::~CPosLmLocalIterator() + { + iIdArray.Close(); + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +TPosLmItemId CPosLmLocalIterator::NextL() + { + if (iCurrent >= iIdArray.Count()) + { + return KPosLmNullItemId; + } + + return iIdArray[iCurrent++]; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +void CPosLmLocalIterator::Reset() + { + iCurrent = 0; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +TUint CPosLmLocalIterator::NumOfItemsL() + { + return iIdArray.Count(); + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +void CPosLmLocalIterator::GetItemIdsL( + RArray& aIdArray, + TInt aStartIndex, + TInt aNumOfItems) + { + if (aStartIndex < 0 || aStartIndex >= iIdArray.Count() || + aStartIndex + aNumOfItems > iIdArray.Count()) + { + Panic(KPosLandmarksClientPanic, + EPosSpecifiedIntervalLiesOutsideIteratedSet); + } + + aIdArray.Reset(); + aIdArray.ReserveL( aNumOfItems ); // to avoid heap fragmentation + for (TInt i = aStartIndex; i < aStartIndex + aNumOfItems; i++) + { + aIdArray.Append( iIdArray[i] ); + } + } +