![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/data/List.h>
Classes | |
class | Iter |
class | PrecIter |
class | SubIter |
Public Member Functions | |
List () | |
List (const List< T, E, A > &list) | |
~List (void) | |
E & | equivalence () |
const E & | equivalence () const |
A & | allocator () |
void | copy (const List< T, E, A > &list) |
Iter | items (void) const |
Iter | operator* (void) const |
operator Iter (void) const | |
Iter | begin (void) const |
Iter | end (void) const |
int | count (void) const |
bool | contains (const T &item) const |
bool | isEmpty (void) const |
operator bool (void) const | |
bool | equals (const List< T > &l) const |
const T & | at (const Iter &i) const |
void | clear (void) |
void | add (const T &value) |
template<class C > | |
void | addAll (const C &items) |
template<class C > | |
void | removeAll (const C &items) |
void | remove (const T &value) |
T & | at (const Iter &i) |
void | remove (PrecIter &iter) |
T & | first (void) |
const T & | first (void) const |
T & | last (void) |
const T & | last (void) const |
T & | nth (int n) |
const T & | nth (int n) const |
Iter | find (const T &item) const |
Iter | find (const T &item, const Iter &pos) const |
void | addFirst (const T &value) |
void | addLast (const T &value) |
void | addAfter (const Iter &pos, const T &value) |
void | addBefore (PrecIter &pos, const T &value) |
void | removeFirst (void) |
void | removeLast (void) |
void | set (const Iter &pos, const T &item) |
const T & | top (void) const |
T | pop (void) |
void | push (const T &i) |
void | reset (void) |
List & | operator= (const List &list) |
bool | operator& (const T &e) const |
T & | operator[] (int k) |
const T & | operator[] (int k) const |
bool | operator== (const List< T > &l) const |
bool | operator!= (const List< T > &l) const |
List< T > & | operator+= (const T &h) |
List< T > & | operator+= (const List< T > &l) |
List< T > & | operator-= (const T &h) |
List< T > & | operator-= (const List< T > &l) |
![]() | |
bool | isEqual (const T &v1, const T &v2) const |
![]() | |
t::ptr | allocate (t::size size) const |
void | free (t::ptr p) const |
template<class T > | |
T * | alloc () const |
Static Public Attributes | |
static List< T, E, A > | null |
![]() | |
static Equiv< T > | def |
Additional Inherited Members | |
![]() | |
typedef T | t |
![]() | |
static bool | equals (const T &v1, const T &v2) |
This class provides a generic implementation of single-link lists.
T | Type of data stored in the list. |
M | Manager supporting equivallence and allocation. |
|
inline |
|
inline |
Add an item to the list. In fact, alias for addFirst().
value | Value to add. |
Referenced by CleanList::add(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::addAll(), HashSet< T, H, A >::meet(), and List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::operator+=().
|
inline |
Add item before the element pointer by pos.
pos | Iterator pointing the element to add before. |
value | Value to add. |
Referenced by SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::add(), and ListSet< T, C, A >::join().
|
inline |
Add the given item at the first position in the list.
item | Item to add. |
Referenced by List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::add(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::addBefore(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::copy(), and List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::push().
|
inline |
Add the given item at the last position in the list. Remark that this method is really inefficient. Its working time is in O(n), n number of nodes in the list. Use it only with small list or revert to more powerful data structures.
item | Item to add. |
Referenced by SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::add().
|
inline |
|
inline |
|
inline |
Referenced by CleanList::clean(), SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::clear(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::copy(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::reset(), and List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::~List().
|
inline |
Test if an item is in the list.
item | Item to look for. |
Referenced by SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::operator&(), and List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::operator&().
Copy the given list in the current list (removing the previous items of the current list).
list | List to copy in. |
Referenced by SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::copy(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::List(), SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::operator=(), and List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::operator=().
|
inline |
Count the items in the list.
Referenced by SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::count().
|
inline |
Get an iterator on the end of the list.
Test if both lists are equal.
l | List to compare with. |
Referenced by List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::operator!=(), and List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::operator==().
|
inline |
|
inline |
|
inline |
Find an element in the list.
item | Element to look for. |
|
inline |
Referenced by SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::first(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::pop(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::remove(), and List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::top().
|
inline |
Get the first item of the list.
Test if the list is empty.
Referenced by SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::isEmpty(), SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::operator bool(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::operator bool(), and List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::remove().
Referenced by List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::addAll(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::begin(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::find(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::operator Iter(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::operator*(), and List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::removeAll().
|
inline |
|
inline |
Get the last item of the list. Remark that this method is really inefficient. Its working time is in O(n), n number of nodes in the list. Use it only with small list or revert to more powerful data structures.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Remove the given item from the list or just one if the list contains many items equals to the given one. The item type T must support the equality / inequality operators.
item | Item to remove. |
Referenced by ListSet< T, C, A >::diff(), ListSet< T, C, A >::meet(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::operator-=(), SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::remove(), and List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::removeAll().
|
inline |
Remove the first item from the list.
Referenced by List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::pop(), List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::remove(), and SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::removeFirst().
Remove the last item from the list. Remark that this method is really inefficient. Its working time is in O(n), n number of nodes in the list. Use it only with small list or revert to more powerful data structures.
Referenced by SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::removeLast().
change the value of an element of the list.
pos | Iterator on the element to set. |
item | Value to set. |
Referenced by SortedList< Pair< string, Section * >, AssocComparator< string, Section *, Comparator< string > >, DefaultAlloc >::set().
|
inline |
|
static |