A dynamically sized vector template. More...
#include <Vector.h>
Classes | |
| class | Iterator |
Public Member Functions | |
| Vector (int count=10) | |
| constructor. | |
| Vector (const Vector &v) | |
| Vector & | operator= (const Vector &v) |
| Iterator | Begin () const |
| void | Add (T item) |
| Add an item. | |
| void | AddRange (const Array< T > &a, const int offset, const int len) |
| void | AddRange (const Array< T > &a, const int len) |
| void | AddRange (const Array< T > &a) |
| void | AddRange (const Vector< T > &v) |
| void | AddRangeWithPad (const Array< T > &a, int count) |
| void | AddRangeWithLeadingPad (Array< T > &a, int count) |
| void | SetElementAt (T item, int pos) |
| Set an element of the array. | |
| void | Insert (T item, int pos) |
| Insert an item into the array. | |
| T | ElementAt (const int pos) const |
| Get an element. | |
| T & | ElementAtRef (const int pos) const |
| Get a reference to an element. | |
| T | RemoveAt (const int pos) |
| Remove the element at the index. | |
| T & | operator[] (const int idx) const |
| void | Remove (const T &item) |
| Remove the specified item. | |
| T | Pop () |
| Removes that last (highest index) element. | |
| T | Peek () const |
| Returns that last (highest index) element. | |
| T & | PeekRef () const |
| Returns that last (highest index) element. | |
| void | Clear () |
| Resets the vector count to zero. | |
| int | Count () const |
| Number of elements in the vector. | |
| Vector< T > * | Copy () const |
| Shallow copy of the vector. | |
| T * | Data () |
| Internal data pointer. | |
| void | EnsureElementTo (int size) |
| Ensure the vector has a minimum number of elements. | |
| void | SetCount (int cnt) |
| RefCountPtr< Array< T > > | ToArray () const |
| RefCountPtr< Array< T > > | ToArray (int count) const |
| void | CheckMem () const |
| void | ValidateMem () const |
Protected Member Functions | |
|
virtual RefCountPtr< IIterator < T > > | IteratorPtr () |
| void | ExtendTo (int index) |
| void | Extend (int newlen) |
Protected Attributes | |
| T * | m_data |
| int | m_pos |
| int | m_size |
A dynamically sized vector template.
Both native and class types (with copy constructors) can be used.
Definition at line 41 of file Vector.h.
| void Vector< T >::Add | ( | T | item | ) | [inline] |
Add an item.
| item[in] | of type T |
| OutOfMemoryException |
Definition at line 164 of file Vector.h.
Referenced by Vector< Decimal >::Copy(), Uri::Parse(), CommandLine::Parse(), and XPathLex::Tokenize().
| void Vector< T >::Clear | ( | ) | [inline] |
Resets the vector count to zero.
Does not deallocate or clear any vector elements.
Definition at line 393 of file Vector.h.
Referenced by XPathLex::Tokenize().
Shallow copy of the vector.
| OutOfMemoryException |
| int Vector< T >::Count | ( | ) | const [inline] |
Number of elements in the vector.
Definition at line 401 of file Vector.h.
Referenced by Vector< Decimal >::Copy(), Vector< Decimal >::EnsureElementTo(), and Vector< Decimal >::Remove().
| T* Vector< T >::Data | ( | ) | [inline] |
| T Vector< T >::ElementAt | ( | const int | pos | ) | const [inline] |
Get an element.
| pos[in] | Index in the vector. |
Definition at line 277 of file Vector.h.
Referenced by Vector< Decimal >::Copy(), Vector< Decimal >::Remove(), and Vector< Decimal >::RemoveAt().
| T& Vector< T >::ElementAtRef | ( | const int | pos | ) | const [inline] |
| void Vector< T >::EnsureElementTo | ( | int | size | ) | [inline] |
| void Vector< T >::Insert | ( | T | item, | |
| int | pos | |||
| ) | [inline] |
Insert an item into the array.
If necessary, the vector is automatically extended. All existing items are preserved.
| item[in] | of type T. | |
| pos[in] | Index in the vector. |
| OutOfMemoryException |
| T Vector< T >::Peek | ( | ) | const [inline] |
| T& Vector< T >::PeekRef | ( | ) | const [inline] |
| T Vector< T >::Pop | ( | ) | [inline] |
| void Vector< T >::Remove | ( | const T & | item | ) | [inline] |
| T Vector< T >::RemoveAt | ( | const int | pos | ) | [inline] |
Remove the element at the index.
No error if pos is greater than the vector length.
| pos[in] | Vector index. |
Definition at line 311 of file Vector.h.
Referenced by Vector< Decimal >::Remove().
| void Vector< T >::SetElementAt | ( | T | item, | |
| int | pos | |||
| ) | [inline] |
Set an element of the array.
If necessary, the vector is automatically extended.
| item[in] | of type T. | |
| pos[in] | The index to set. |
| OutOfMemoryException |
Next write position
Definition at line 45 of file Vector.h.
Referenced by Vector< Decimal >::Add(), Vector< Decimal >::Clear(), Vector< Decimal >::Count(), Vector< Decimal >::ElementAt(), Vector< Decimal >::ElementAtRef(), Vector< Decimal >::Insert(), Vector< Decimal >::Peek(), Vector< Decimal >::PeekRef(), Vector< Decimal >::Pop(), Vector< Decimal >::RemoveAt(), and Vector< Decimal >::SetElementAt().
Number of elements in m_data
Definition at line 46 of file Vector.h.
Referenced by Vector< Decimal >::Add(), Vector< Decimal >::ElementAt(), Vector< Decimal >::ElementAtRef(), Vector< Decimal >::Insert(), Vector< Decimal >::RemoveAt(), Vector< Decimal >::SetElementAt(), and Vector< Decimal >::Vector().