![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/data/Array.h>
Classes | |
class | Iter |
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 |
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) |
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 Iter &i, const T &val) |
T & | get (int idx) |
T & | operator[] (int idx) |
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 |
Referenced by Array< elm::String >::equals().
|
inline |
Referenced by Bag< T >::make(), Array< elm::String >::operator()(), Array< elm::String >::set(), and AllocArray< elm::String >::tie().
|
inline |
Referenced by Array< elm::String >::containsAll().
|
inline |
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. |
Referenced by AllocArray< elm::String >::AllocArray(), and AllocArray< elm::String >::copy().
|
inline |
Referenced by elm::serial2::__serialize(), AllocArray< elm::String >::copy(), Array< elm::String >::indexOf(), Array< elm::String >::lastIndexOf(), Array< elm::String >::length(), Bag< T >::make(), Array< elm::String >::set(), and Array< elm::String >::size().
|
inline |
Fill the array with the gien value.
val | Value to copy in the array elements. |
Referenced by AllocArray< elm::String >::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. |
|
inline |
Get an element by index. Raise an assertion failure if idx is out of array bounds.
idx | Index of element to get. |
Referenced by Array< elm::String >::indexOf(), Array< elm::String >::lastIndexOf(), and Array< elm::String >::operator[]().
|
inline |
Referenced by Array< elm::String >::operator bool().
|
inline |
Referenced by Array< elm::String >::begin(), and Array< elm::String >::operator*().
|
inline |
|
inline |
|
inline |
Same as items().
|
inline |
Same as get().
|
inline |
Same as get().
Assign the given array t to the current array.
t | Array to assign. |
Set a value according to an iterator.
i | Non-ended iterator. |
val | Value to set. |
|
inline |
Change the buffer of the array. The Array will NOT be in charge of freeing this buffer.
Referenced by AllocArray< elm::String >::copy(), Array< elm::String >::operator=(), and AllocArray< elm::String >::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. |
|
inline |
|
protected |
|
protected |
|
static |
Singleton representing an empty array.