bintools/rcomp/inc/ARRAY.H
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #if !defined(__ARRAY_H__)
       
    20 #define __ARRAY_H__
       
    21 
       
    22 // ArrayItem
       
    23 
       
    24 class ArrayItem
       
    25 	{
       
    26 public:
       
    27 	virtual ~ArrayItem() {}
       
    28 	};
       
    29 
       
    30 // Array
       
    31 
       
    32 class ArrayIterator;
       
    33 class Array
       
    34 	{
       
    35 	friend class ArrayIterator;
       
    36 public:
       
    37 	void Empty();		// Empty store without calling delete on individual elements.
       
    38 	void DeleteAll();	// Delete elements in store and then empty it out.
       
    39 	int Size() const;
       
    40 protected:
       
    41 	Array();
       
    42 	Array(const Array&);
       
    43 	virtual ~Array();
       
    44 	ArrayItem*& operator[](int aIndex) const;
       
    45 	Array& operator=(const Array&);
       
    46 	void Add(ArrayItem* aNewItem);
       
    47 	void Add(int aIndex, ArrayItem* pNewItem);
       
    48 	void Discard(ArrayItem* pItemToRemove);
       
    49 	void Discard(int aIndex);
       
    50 private:
       
    51 	ArrayItem** iData;
       
    52 	int iItemCount;
       
    53 	int iItemAllocCount;
       
    54 	};
       
    55 
       
    56 // ArrayIterator
       
    57 
       
    58 class ArrayIterator
       
    59 	{
       
    60 public:
       
    61 	void Reset();
       
    62 protected:
       
    63 	ArrayIterator(const Array& c);
       
    64 	ArrayItem * operator()();
       
    65 private:
       
    66 	const Array* iArray;
       
    67 	int iCurrentIndex;
       
    68 	};
       
    69 
       
    70 #endif