[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

TArray



Overview:

TArray is a PowerPlant template class that is a template wrapper for LArray.

Methods :

The methods in this class are:

 

TArray()  
~TArray()  
AddItem()  
AssignItemsAt()  
FetchIndexOf()  
FetchInsertIndexOf()  
FetchItemAt()  
FetchItemPtr()  
InsertItemsAt()  
Remove()  
Operator[ ]  
 

Data Members:

There are no data members in this class.

 

Operation:

You can't store actual objects in a TArray or LArray. Only use TArray and LArray to store pointers to objects (created via new), built-in numerical data types, or data structures (simple structs).

Source files:

(Array Classes)

TArray.h

Ancestors:

LArray

See Also:

LComparator

TArray()

Purpose:

Construct an array.

Access:

Public

Prototype:

TArray( LComparator *inComparator = nil,
Boolean inKeepSorted = false );

TArray( UInt32 inItemCount,
LComparator *inComparator = nil,
Boolean inKeepSorted = false );

TArray( Handle inItemsHandle,
LComparator *inComparator = nil,
Boolean inIsSorted = false,
Boolean inKeepSorted = false );
Parameters:

The parameters for these constructors are:

 

LComparator*  
inComparator  
A pointer to the comparator to use for the array.  
Boolean  
inKeepSorted  
A value indicating whether the array should be kept sorted.  
UInt32  
inItemCount  
The number of items to put in the array.  
Handle  
inItemsHandle  
A handle to the items to put in the array.  
Boolean  
inIsSorted  
A value indicating whether the items are sorted.  

~TArray()

Purpose:

The destructor destroys the array.

Access:

Virtual, Public

Prototype:

virtual ~TArray();

AddItem()

Purpose:

This adds an item to the array. This is an override of AddItem() in LArray.

AssignItemsAt()

Purpose:

Assign the same value to items in the array starting at the specified index. This is an override of AssignItemsAt() in LArray.

FetchIndexOf()

Purpose:

Returns the index of the specified item within the array. This is an override of FetchIndexOf() in LArray.

FetchInsertIndexOf()

Purpose:

Return the index at which the specified item would be inserted. This is an override of FetchInsertIndexOf() in LArray.

FetchItemAt()

Purpose:

Pass back the item at the specified index. This is an override of FetchItemAt() in LArray.

FetchItemPtr()

Purpose:

Returns a pointer to an item.

Access:

Public

Prototype:

T* FetchItemPtr( ArrayIndexT inAtIndex ) const;
Parameters:

The parameter for this method is:

 

ArrayIndexT  
inAtIndex  
The array index to fetch from.  

Return:

A pointer to the array item at the specified index.

InsertItemsAt()

Purpose:

Insert items at the specified position in an array. This is an override of InsertItemsAt() in LArray.

Remove()

Purpose:

Remove an item from an array. This is an override of Remove() in LArray.

Operator[ ]

Purpose:

The array operator is overloaded for this class to provide convenient array-like access to array items, even though they are implemented differently than the row/column arrangement in memory.

Access:

Public

Prototype:

T& operator [] ( ArrayIndexT inAtIndex );

const T& operator [] (ArrayIndexT inAtIndex) 
const;
Parameters:

The parameter for this method is:

 

ArrayIndexT  
inAtIndex  
The array index to access.  

Return:

A reference to the array element/item of interest.

 


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000