#include <qafContainer.h>
Inheritance diagram for qaf::Container< T >:

Vector.
Elements are stored in an internal array; its size is increased automatically to accomodate new elements.
Container class may only work properly if the template's type argument (i.e., the stuff between <angle brackets>) meets the following criteria:operator==).
You can safely use primitive types (char, float, any kind of pointer, etc.) with this class.
Public Member Functions | |
| Container () | |
| Creates an empty container. | |
| Container (const T *elems, int _count) | |
| Copies all elements from the array into the container. | |
| Container (const Container &orig) | |
| Copy constructor: All the elements will be copied from the other container. | |
| Container & | operator= (const Container &other) |
| Assignment operator: Copies all elements from the other container. | |
| void | add (const T &elem) |
| Appends an element to the end of the container. | |
| void | add (int index, const T &elem) |
Inserts an element at position index in the container, "pushing" all elements after it towards the end. | |
| int | indexOf (const T &elem) const |
| Searches the container for the specified element. | |
| void | remove (int index) |
| Removes the element at the specified index, shifting all the elements after it towards the beginning. | |
| bool | removeFirst (const T &elem) |
| Searches the container for the first occurrence of the element, and removes it if it was found. | |
| bool | removeAll (const T &elem) |
| Searches the container for all occurrences of the element, removing them as they are found. | |
| void | removeAll () |
| Removes all elements from the container. | |
| int | getCount () const |
| |
| const T & | operator[] (int index) const |
| Used to access the elements in the container. | |
| T & | operator[] (int index) |
| Used to access the elements in the container. | |
| const T & | elem (int index) const |
| An alias for the subscript operator. | |
| T & | elem (int index) |
| An alias for the subscript operator. | |
| const T & | tail () const |
| |
| T & | tail () |
| |
| const T * | getData () const |
| Returns a pointer to the container's internal buffer. | |
| void | toBeginning (int index) |
| Moves an element to the beginning of the container, shifting the necessary elements to higher indices. | |
| void | toEnd (int index) |
| Moves an element to the end of the container, shifting the necessary elements to lower indices. | |
| void | swap (int i, int j) |
| Swaps the position of two objects in the container. | |
| virtual | ~Container () |
| Destructor: Frees the allocated memory. | |
| void qaf::Container< T >::add | ( | const T & | elem | ) | [inline] |
Appends an element to the end of the container.
The internal array's size will be increased automatically.
| void qaf::Container< T >::add | ( | int | index, | |
| const T & | elem | |||
| ) | [inline] |
Inserts an element at position index in the container, "pushing" all elements after it towards the end.
A valid index is defined as
| std::out_of_range | if the index is not valid. |
| int qaf::Container< T >::indexOf | ( | const T & | elem | ) | const [inline] |
Searches the container for the specified element.
| void qaf::Container< T >::remove | ( | int | index | ) | [inline] |
Removes the element at the specified index, shifting all the elements after it towards the beginning.
A valid index is defined as
| std::out_of_range | if an invalid index is supplied. |
| bool qaf::Container< T >::removeFirst | ( | const T & | elem | ) | [inline] |
Searches the container for the first occurrence of the element, and removes it if it was found.
| bool qaf::Container< T >::removeAll | ( | const T & | elem | ) | [inline] |
Searches the container for all occurrences of the element, removing them as they are found.
| const T& qaf::Container< T >::operator[] | ( | int | index | ) | const [inline] |
Used to access the elements in the container.
A valid index is defined as
| std::out_of_range | if an invalid index is supplied. |
| T& qaf::Container< T >::operator[] | ( | int | index | ) | [inline] |
Used to access the elements in the container.
A valid index is defined as
| std::out_of_range | if an invalid index is supplied. |
| const T& qaf::Container< T >::elem | ( | int | index | ) | const [inline] |
| T& qaf::Container< T >::elem | ( | int | index | ) | [inline] |
| const T& qaf::Container< T >::tail | ( | ) | const [inline] |
| std::out_of_range | if the container is empty. |
| T& qaf::Container< T >::tail | ( | ) | [inline] |
| std::out_of_range | if the container is empty. |
| const T* qaf::Container< T >::getData | ( | ) | const [inline] |
Returns a pointer to the container's internal buffer.
This pointer must not be deleted or modified in any way -- use other methods for those purposes. This is useful for functions requiring an array as a parameter.
| void qaf::Container< T >::toBeginning | ( | int | index | ) | [inline] |
Moves an element to the beginning of the container, shifting the necessary elements to higher indices.
A valid index is defined as
| std::out_of_range | if an invalid index is supplied. |
| void qaf::Container< T >::toEnd | ( | int | index | ) | [inline] |
Moves an element to the end of the container, shifting the necessary elements to lower indices.
A valid index is defined as
| std::out_of_range | if an invalid index is supplied. |
| void qaf::Container< T >::swap | ( | int | i, | |
| int | j | |||
| ) | [inline] |
Swaps the position of two objects in the container.
| std::out_of_range | if an invalid index is supplied. |
1.5.1-p1