diff -r 59148e28d9f6 -r 626366955efb toolsandutils/e32tools/elf2e32/source/farray.h --- a/toolsandutils/e32tools/elf2e32/source/farray.h Fri Jun 25 18:24:47 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -// Copyright (c) 2004-2009 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: -// @internalComponent -// @released -// -// - - -#ifndef __FARRAY_H__ -#define __FARRAY_H__ -#include - -template -class TFixedArray -// Range checking wrapper+ class for C++ arrays -// Can be embedded in C-objects, or used on the stack: use Reset() to zero it - { - typedef TFixedArray ThisClass; -public: - inline TFixedArray(); - inline TFixedArray(const T* aList, TInt aLength); - // - inline void Copy(const T* aList, TInt aLength); - inline void Reset(); // zero fill - inline void DeleteAll(); - // - inline TInt Count() const; - inline TInt Length() const; - // Accessors - debug range checking - inline T& operator[](TInt aIndex); - inline const T& operator[] (TInt aIndex) const; - // Accessors - always range checking - inline T& At(TInt aIndex); - inline const T& At(TInt aIndex) const; - // Provides pointers to the beginning and end of the array - inline T* Begin(); - inline T* End(); - inline const T* Begin() const; - inline const T* End() const; - // -protected: - inline static TBool InRange(TInt aIndex); -protected: - T iRep[S]; - }; - - -template -inline TFixedArray::TFixedArray() - {} -template -inline void TFixedArray::Copy(const T* aList,TInt aLength) - { - // Never used. - assert(TUint(aLength)<=TUint(S)); - // HMdem::Copy(iRep,aList,aLength*sizeof(T)); - } -template -inline TFixedArray::TFixedArray(const T* aList,TInt aLength) - {Copy(aList,aLength);} -template -inline void TFixedArray::Reset() - {memset(iRep,0,sizeof(iRep));} -template -inline TInt TFixedArray::Count() const - {return S;} -template -inline TInt TFixedArray::Length() const - {return sizeof(T);} -template -inline TBool TFixedArray::InRange(TInt aIndex) - {return TUint(aIndex) -inline T& TFixedArray::operator[](TInt aIndex) - {assert(InRange(aIndex));return iRep[aIndex];} -template -inline const T& TFixedArray::operator[](TInt aIndex) const - {return const_cast(*this)[aIndex];} -template -inline T& TFixedArray::At(TInt aIndex) - {verify(InRange(aIndex));return iRep[aIndex];} -template -inline const T& TFixedArray::At(TInt aIndex) const - {return const_cast(*this).At(aIndex);} -template -inline T* TFixedArray::Begin() - {return &iRep[0];} -template -inline T* TFixedArray::End() - {return &iRep[S];} -template -inline const T* TFixedArray::Begin() const - {return &iRep[0];} -template -inline const T* TFixedArray::End() const - {return &iRep[S];} - - -#endif -