KArrayTemplate Class Template Reference

#include <karrayul.h>
Inheritance diagram for KArrayTemplate:
Inheritance graph
[legend]

List of all members.


Detailed Description

template<class Type>
class KArrayTemplate< Type >

Array of pointers.

Definition at line 492 of file karrayul.h.


Public Member Functions

  KArrayTemplate ()
  Constructor.
  KArrayTemplate (const KArrayTemplate &pArrayTemplate)
  Copy constructor.
  ~KArrayTemplate ()
int  InsertAt (int pIndex, Type pItem)
  Insert a pointer.
Type  RemoveAt (int pIndex)
  Remove a pointer in the array without deleting the associated object.
Type  RemoveLast ()
  Remove last pointer in the array without deleting the associated object.
bool  RemoveIt (Type pItem)
  Remove first matching pointer in the array without deleting the associated object.
Type &  operator[] (int pIndex) const
  Access pointer at given index.
void  SetAt (int pIndex, Type pItem)
  Set pointer at given index, must within valid range.
void  SetLast (Type pItem)
  Set last pointer, the array must contain at least one pointer.
Type  GetAt (int pIndex) const
  Get pointer at given index, must be within valid range.
Type  GetFirst () const
  Get first pointer, the array must contain at least one pointer.
Type  GetLast () const
  Get last pointer, the array must contain at least one pointer.
int  Find (Type pItem) const
  Find first matching pointer.
int  FindAfter (int pAfterIndex, Type pItem) const
  Find first matching pointer after given index.
int  FindBefore (int pBeforeIndex, Type pItem) const
  Find first matching pointer before given index.
int  Add (Type pItem)
  Append a pointer at the end of the array.
int  AddUnique (Type pItem)
  Add Element at the end of array if not present.
void  AddMultiple (kUInt pItemCount)
  Add multiple (init to zero) elements in the array, use SetAt or GetArray to set the value of the new elements.
void  AddArray (KArrayTemplate< Type > &pArray)
void  AddArrayNoDuplicate (KArrayTemplate< Type > &pArray)
void  RemoveArray (KArrayTemplate< Type > &pArray)
Type *  GetArray () const
  Get pointer to internal array of pointers.
KArrayTemplate< Type > &  operator= (const KArrayTemplate< Type > &pArrayTemplate)
  Copy array of pointers without copying the associated objects.
  operator Type * ()
  Cast operator.

Constructor & Destructor Documentation

KArrayTemplate (  )  [inline]

Constructor.

Definition at line 512 of file karrayul.h.

KArrayTemplate ( const KArrayTemplate< Type > &  pArrayTemplate  )  [inline]

Copy constructor.

Definition at line 518 of file karrayul.h.

~KArrayTemplate (  )  [inline]

Definition at line 524 of file karrayul.h.


Member Function Documentation

int InsertAt ( int  pIndex,
Type  pItem  
) [inline]

Insert a pointer.

Parameters:
pIndex  Position where to insert the pointer.
pItem  Item to insert.
Returns:
Position of the inserted pointer in the array.
Remarks:
If the given index is out of range, the pointer is appended at the end.

Definition at line 532 of file karrayul.h.

Referenced by KArrayTemplate< KLayerInfo * >::Add(), KStringListTemplate< KStringListItem >::InsertAt(), and KStringListTemplate< KStringListItem >::InsertItemAt().

Type RemoveAt ( int  pIndex  )  [inline]

Remove a pointer in the array without deleting the associated object.

Parameters:
pIndex  Position of the item to remove.
Returns:
Removed item.

Reimplemented from KBaseArray< KBaseArraySizeType< Type > >.

Definition at line 541 of file karrayul.h.

Referenced by KStringListTemplate< KStringListItem >::RemoveAt(), KArrayTemplate< KLayerInfo * >::RemoveIt(), and KArrayTemplate< KLayerInfo * >::RemoveLast().

Type RemoveLast (  )  [inline]

Remove last pointer in the array without deleting the associated object.

Returns:
Remove item.

Definition at line 551 of file karrayul.h.

bool RemoveIt ( Type  pItem  )  [inline]

Remove first matching pointer in the array without deleting the associated object.

Parameters:
pItem  Item to remove.
Returns:
true if a matching pointer is found and removed, false otherwise.

Definition at line 560 of file karrayul.h.

Referenced by KArrayTemplate< KLayerInfo * >::RemoveArray().

Type& operator[] ( int  pIndex  )  const [inline]

Access pointer at given index.

Definition at line 572 of file karrayul.h.

void SetAt ( int  pIndex,
Type  pItem  
) [inline]

Set pointer at given index, must within valid range.

Definition at line 584 of file karrayul.h.

Referenced by KArrayTemplate< KLayerInfo * >::AddArray(), KFbxLayerElementArray::CopyTo(), and KArrayTemplate< KLayerInfo * >::SetLast().

void SetLast ( Type  pItem  )  [inline]

Set last pointer, the array must contain at least one pointer.

Definition at line 596 of file karrayul.h.

Type GetAt ( int  pIndex  )  const [inline]

Type GetFirst (  )  const [inline]

Get first pointer, the array must contain at least one pointer.

Returns:
First pointer.

Definition at line 616 of file karrayul.h.

Type GetLast (  )  const [inline]

Get last pointer, the array must contain at least one pointer.

Returns:
Last pointer.

Definition at line 627 of file karrayul.h.

int Find ( Type  pItem  )  const [inline]

Find first matching pointer.

Returns:
Index of first matching pointer found or -1 if there is no matching element.

Definition at line 639 of file karrayul.h.

Referenced by KArrayTemplate< KLayerInfo * >::AddArrayNoDuplicate(), KArrayTemplate< KLayerInfo * >::AddUnique(), KStringListTemplate< KStringListItem >::FindItem(), and KArrayTemplate< KLayerInfo * >::RemoveIt().

int FindAfter ( int  pAfterIndex,
Type  pItem  
) const [inline]

Find first matching pointer after given index.

Returns:
Index of first matching pointer found after given index or -1 if there is no matching pointer.
Remarks:
The index must be within valid range.

Definition at line 649 of file karrayul.h.

Referenced by KArrayTemplate< KLayerInfo * >::Find().

int FindBefore ( int  pBeforeIndex,
Type  pItem  
) const [inline]

Find first matching pointer before given index.

Returns:
Index of first matching pointer found after given index or -1 if there is no matching pointer.
Remarks:
The index must be within valid range.

Definition at line 676 of file karrayul.h.

int Add ( Type  pItem  )  [inline]

int AddUnique ( Type  pItem  )  [inline]

Add Element at the end of array if not present.

Returns:
Index of Element.

Definition at line 709 of file karrayul.h.

void AddMultiple ( kUInt  pItemCount  )  [inline]

Add multiple (init to zero) elements in the array, use SetAt or GetArray to set the value of the new elements.

Parameters:
pItemCount.  How many new Array elements you want.

Definition at line 722 of file karrayul.h.

Referenced by KArrayTemplate< KLayerInfo * >::AddArray().

void AddArray ( KArrayTemplate< Type > &  pArray  )  [inline]

Definition at line 727 of file karrayul.h.

void AddArrayNoDuplicate ( KArrayTemplate< Type > &  pArray  )  [inline]

Definition at line 739 of file karrayul.h.

void RemoveArray ( KArrayTemplate< Type > &  pArray  )  [inline]

Definition at line 751 of file karrayul.h.

Type* GetArray (  )  const [inline]

KArrayTemplate<Type>& operator= ( const KArrayTemplate< Type > &  pArrayTemplate  )  [inline]

Copy array of pointers without copying the associated objects.

Definition at line 770 of file karrayul.h.

operator Type * (  )  [inline]

Cast operator.

Definition at line 788 of file karrayul.h.