diff -r 000000000000 -r 044383f39525 bintools/rcomp/src/ARRAY.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bintools/rcomp/src/ARRAY.CPP Tue Oct 27 16:36:35 2009 +0000 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "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: +* +*/ + + +#include +#include +#include "ARRAY.H" + +Array::Array(): + iData(NULL), + iItemCount(0), + iItemAllocCount(0) + {} + +Array::~Array() + { + delete [] iData; + } + +Array::Array(const Array& aSource) + { + iItemCount=aSource.iItemCount; + iItemAllocCount=aSource.iItemAllocCount; + assert(iItemAllocCount>=iItemCount); + if (iItemAllocCount>0) + { + iData=new ArrayItem* [iItemAllocCount]; + assert(iData!=0); + for(int i=0;i=iItemCount); + if (iItemAllocCount>0) + { + iData=new ArrayItem* [iItemAllocCount]; + assert(iData!=0); + for(int i=0;i=0); + assert(aIndex=0); + assert(aIndex<=iItemCount); + assert(iItemCount<=iItemAllocCount); + if (iItemCountaIndex;--i) + { + iData[i]=iData[i-1]; + } + iData[aIndex]=aNewItem; + } + else + { + iItemAllocCount+=4; + ArrayItem** const data=new ArrayItem* [iItemAllocCount]; + assert(data!=0); + ++iItemCount; + int i; + for (i=iItemCount-1;i>aIndex;--i) + { + data[i]=iData[i-1]; + } + data[aIndex]=aNewItem; + for (i=0;i=0); + assert(aIndex=iArray->Size()) + return NULL; + ArrayItem* p=(*iArray)[iCurrentIndex++]; + return p; + } + +void ArrayIterator::Reset() + { + iCurrentIndex=0; + } +