#include <tools.h>
List of all members.
Public Member Functions |
| | cVector (int Allocated=10) |
| virtual | ~cVector () |
| T & | At (int Index) const |
| const T & | operator[] (int Index) const |
| T & | operator[] (int Index) |
| int | Size (void) const |
| virtual void | Insert (T Data, int Before=0) |
| virtual void | Append (T Data) |
| virtual void | Clear (void) |
| void | Sort (__compar_fn_t Compare) |
Detailed Description
template<class T>
class cVector< T >
Definition at line 402 of file tools.h.
Constructor & Destructor Documentation
Definition at line 419 of file tools.h.
{
allocated = 0;
size = 0;
data = NULL;
Realloc(Allocated);
}
Member Function Documentation
template<class T>
| virtual void cVector< T >::Append |
( |
T |
Data | ) |
[inline, virtual] |
Definition at line 454 of file tools.h.
{
if (size >= allocated)
Realloc(allocated * 4 / 2);
data[size++] = Data;
}
template<class T>
| T& cVector< T >::At |
( |
int |
Index | ) |
const [inline] |
Definition at line 427 of file tools.h.
{
Realloc(Index);
if (Index >= size)
size = Index + 1;
return data[Index];
}
template<class T>
| virtual void cVector< T >::Clear |
( |
void |
| ) |
[inline, virtual] |
template<class T>
| virtual void cVector< T >::Insert |
( |
T |
Data, |
|
|
int |
Before = 0 |
|
) |
| [inline, virtual] |
Definition at line 443 of file tools.h.
{
if (Before < size) {
Realloc(size);
memmove(&data[Before + 1], &data[Before], (size - Before) * sizeof(T));
size++;
data[Before] = Data;
}
else
Append(Data);
}
template<class T>
| const T& cVector< T >::operator[] |
( |
int |
Index | ) |
const [inline] |
template<class T>
| T& cVector< T >::operator[] |
( |
int |
Index | ) |
[inline] |
template<class T>
| int cVector< T >::Size |
( |
void |
| ) |
const [inline] |
template<class T>
| void cVector< T >::Sort |
( |
__compar_fn_t |
Compare | ) |
[inline] |
Definition at line 461 of file tools.h.
{
qsort(data, size, sizeof(T), Compare);
}
The documentation for this class was generated from the following file: