Public Member Functions

PtrVec< T > Class Template Reference

Search for all occurrences

Detailed Description

template<class T>
class PtrVec< T >

See also:
Class PtrVector

template <class t>=""> class PtrVec: public PtrVector
Description:
This class is available in release 4.0 and later only.

This template class represents a variable length array of pointers which can be stored and manipulated.

#include <ptrvec.h>

Inheritance diagram for PtrVec< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  PtrVec ()
T *  operator[] (int i) const
T *&  operator[] (int i)
PtrVec< T > &  operator= (const PtrVec< T > &v)
void  append (T *ptr, int extra=10)
void  insertAt (T *ptr, int at, int extra=10)
T *  remove (int i)
T *  removeLast ()
void  deleteAll ()

Constructor & Destructor Documentation

PtrVec ( ) [inline]
Remarks:
Constructor.
Default Implementation:
{}
:PtrVector() {}

Member Function Documentation

T* operator[] ( int  i ) const [inline]
Remarks:
Indexing operator.
Default Implementation:
{ return (T*)PtrVector::operator[](i); }

Reimplemented from PtrVector.

{ return (T*)PtrVector::operator[](i); }        
T*& operator[] ( int  i ) [inline]
Remarks:
Indexing operator.
Default Implementation:
{ return (T*&)PtrVector::operator[](i); }

Reimplemented from PtrVector.

{ return (T*&)PtrVector::operator[](i); }               
PtrVec<T>& operator= ( const PtrVec< T > &  v ) [inline]
Remarks:
Assignment operator.
Default Implementation:
{ return (PtrVec<T>&)PtrVector::operator=(v); }
{ return (PtrVec<T>&)PtrVector::operator=(v); }
void append ( T *  ptr,
int  extra = 10 
) [inline]
Remarks:
This method allows you to append data to the array.
Parameters:
T *ptr

A pointer to the data.

int extra = 10

The amount of extra space you wish to allocate.
Default Implementation:
{ PtrVector::append(ptr,extra); }
{ PtrVector::append(ptr,extra); }   
void insertAt ( T *  ptr,
int  at,
int  extra = 10 
) [inline]
Remarks:
This method allows you to insert data into the array at the specified location.
Parameters:
T* ptr

A pointer to the data to add.

int at

The index in the array you wish to insert at.

int extra = 10

The extra space you wish to reserve.
Default Implementation:
{ PtrVector::insertAt(ptr,at,extra); }
{ PtrVector::insertAt(ptr,at,extra); }   
T* remove ( int  i ) [inline]
Remarks:
This method allows you to remove an element from the array.
Parameters:
int i

The index into the array.
Default Implementation:
{ return (T *)PtrVector::remove(i); }

Reimplemented from PtrVector.

{ return (T *)PtrVector::remove(i); }       
T* removeLast ( ) [inline]
Remarks:
This method will remove the last item in the array.
Returns:
A pointer to the new last item.
Default Implementation:
{ return (T *)PtrVector::removeLast(); }

Reimplemented from PtrVector.

{ return (T *)PtrVector::removeLast(); }        
void deleteAll ( )
Remarks:
This method allows you to delete the entire array.
{
    while (length()) {
        T* p = removeLast();
        delete p;
        p = NULL;
    }
}