![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/data/Array.h>
Inheritance diagram for Array< T >:Classes | |
| class | BackIter |
| class | BackMutIter |
| class | BackPreIter |
| class | Iter |
| class | MutIter |
| class | PreIter |
Public Types | |
| typedef T | t |
| typedef Array< T > | self_t |
Public Member Functions | |
| Array (void) | |
| Array (int count, T *buffer) | |
| const T * | buffer (void) const |
| T * | buffer (void) |
| int | size (void) const |
| void | set (int count, T *buffer) |
| void | set (const Array< T > &t) |
| void | copy (const Array &t) |
| void | fill (const T &val) |
| const T * | operator() (void) const |
| T * | operator() (void) |
| Array< T > & | operator= (const Array< T > &t) |
| Iter | items (void) const |
| Iter | operator* (void) const |
| Iter | begin (void) const |
| Iter | end (void) const |
| Iterable< BackIter > | back () const |
| int | count (void) const |
| bool | contains (const T &item) |
| template<class C > | |
| bool | containsAll (const C &c) |
| bool | isEmpty (void) const |
| operator bool (void) const | |
| bool | equals (const Array< T > &a) const |
| bool | operator== (const Array< T > &a) const |
| bool | operator!= (const Array< T > &a) const |
| bool | operator<= (const Array< T > &a) const |
| bool | operator< (const Array< T > &a) const |
| bool | operator>= (const Array< T > &a) const |
| bool | operator> (const Array< T > &a) const |
| int | length (void) const |
| const T & | get (int idx) const |
| int | indexOf (const T &v, int i=0) const |
| int | lastIndexOf (const T &v, int i=-1) const |
| const T & | operator[] (int idx) const |
| void | set (int idx, const T &val) |
| void | set (const MutIter &i, const T &val) |
| T & | get (int idx) |
| T & | operator[] (int idx) |
| MutIter | begin (void) |
| MutIter | end (void) |
| Iterable< BackMutIter > | back () |
Static Public Attributes | |
| static const Array< T > | null |
Protected Attributes | |
| int | cnt |
| T * | buf |
An array is a simple wrapper around the C array data type. It provides controlled methods to it (indexed accesses are protected with assertions) and implements the concept:: Collection concept and therefore can be used as any collection. Yet, it doesn't manage the memory of the array.
To shorten the construction of an Array, you can use the function _array().
| T | Type of elements stored in the array. |
| typedef T t |
|
inline |
|
inline |
References elm::subiter().
References elm::subiter().
References Array< T >::items().
Referenced by Array< T >::equals().
|
inline |
References Array< T >::buf.
|
inline |
References Array< T >::buf.
Referenced by Bag< T >::make(), Array< T >::operator()(), Array< T >::set(), and AllocArray< T >::tie().
|
inline |
Referenced by Array< T >::containsAll().
|
inline |
References Array< T >::contains().
Referenced by Array< T >::operator<(), Array< T >::operator<=(), Array< T >::operator>(), and Array< T >::operator>=().
Copy the array t inside the current array. If the current array is smaller than t, only the first elements will be copied.
| t | Array to copy. |
References Array< T >::buf, Array< T >::cnt, elm::array::copy(), and elm::min().
Referenced by AllocArray< T >::AllocArray(), and AllocArray< T >::copy().
|
inline |
References Array< T >::cnt.
Referenced by elm::serial2::__serialize(), AllocArray< T >::copy(), Array< T >::indexOf(), Array< T >::lastIndexOf(), Array< T >::length(), Bag< T >::make(), Array< T >::set(), and Array< T >::size().
References Array< T >::begin(), and Array< T >::cnt.
Referenced by Array< T >::operator!=(), Array< T >::operator<(), Array< T >::operator==(), and Array< T >::operator>().
|
inline |
Fill the array with the gien value.
| val | Value to copy in the array elements. |
References Array< T >::buf, Array< T >::cnt, and elm::array::set().
Referenced by AllocArray< T >::AllocArray().
|
inline |
Get a reference on an element by index. Raise an assertion failure if idx is out of array bounds.
| idx | Index of element to get. |
References Array< T >::buf, and Array< T >::cnt.
|
inline |
Get an element by index. Raise an assertion failure if idx is out of array bounds.
| idx | Index of element to get. |
References Array< T >::buf, and Array< T >::cnt.
Referenced by Array< T >::indexOf(), Array< T >::lastIndexOf(), and Array< T >::operator[]().
|
inline |
References Array< T >::count(), and Array< T >::get().
References Array< T >::cnt.
Referenced by Array< T >::operator bool().
|
inline |
Referenced by Array< T >::begin(), and Array< T >::operator*().
|
inline |
References Array< T >::count(), and Array< T >::get().
|
inline |
References Array< T >::count().
References Array< T >::isEmpty().
References Array< T >::equals().
|
inline |
Same as buffer().
References Array< T >::buffer().
|
inline |
Same as buffer().
References Array< T >::buffer().
|
inline |
Same as items().
References Array< T >::items().
References Array< T >::containsAll(), and Array< T >::equals().
References Array< T >::containsAll().
Same as set().
References Array< T >::set().
References Array< T >::equals().
References Array< T >::containsAll(), and Array< T >::equals().
References Array< T >::containsAll().
|
inline |
Same as get().
References Array< T >::get().
|
inline |
Same as get().
References Array< T >::get().
Assign the given array t to the current array.
| t | Array to assign. |
References Array< T >::buf, and Array< T >::cnt.
References Array< T >::PreIter::ended().
|
inline |
Change the buffer of the array. The Array will NOT be in charge of freeing this buffer.
References Array< T >::buf, Array< T >::buffer(), Array< T >::cnt, and Array< T >::count().
Referenced by AllocArray< T >::copy(), Array< T >::operator=(), and AllocArray< T >::tie().
|
inline |
Set an array element according to index idx. If the index is out of bound, an assertion failure is raised.
| idx | Index of the element to assign. |
| val | Value to assign. |
References Array< T >::buf, and Array< T >::cnt.
|
inline |
References Array< T >::count().
|
protected |
|
protected |
|
static |
Singleton representing an empty array.