Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::SortedList< T, C, A > Class Template Reference

#include <elm/data/SortedList.h>

Classes

class  Iterator
 

Public Types

typedef A::key_t key_t
 
typedef A::val_t val_t
 

Public Member Functions

 SortedList (void)
 
 SortedList (const C &c)
 
 SortedList (SortedList &source)
 
void removeFirst (void)
 
void removeLast (void)
 
int count (void) const
 
bool contains (const key_t &item) const
 
bool isEmpty (void) const
 
 operator bool (void) const
 
void clear (void)
 
void add (const T &value)
 
template<template< class _ > class CC>
void addAll (const CC< T > &items)
 
void remove (const T &item)
 
template<template< class _ > class CC>
void removeAll (const CC< T > &items)
 
void remove (const Iterator &iter)
 
const T & first (void) const
 
const T & last (void) const
 
Iterator find (const T &item) const
 
Iterator find (const T &item, const Iterator &iter) const
 

Member Typedef Documentation

template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
typedef A::key_t elm::SortedList< T, C, A >::key_t
template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
typedef A::val_t elm::SortedList< T, C, A >::val_t

Constructor & Destructor Documentation

template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
elm::SortedList< T, C, A >::SortedList ( void  )
template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
elm::SortedList< T, C, A >::SortedList ( const C &  c)
template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
elm::SortedList< T, C, A >::SortedList ( SortedList< T, C, A > &  source)

Member Function Documentation

template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
void elm::SortedList< T, C, A >::add ( const T &  value)
template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
template<template< class _ > class CC>
void elm::SortedList< T, C, A >::addAll ( const CC< T > &  items)
template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
void elm::SortedList< T, C, A >::clear ( void  )
template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
bool elm::SortedList< T, C, A >::contains ( const key_t item) const
template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
int SortedList::count ( void  ) const

Count the items in the list.

Returns
Item count.

Referenced by elm::genstruct::AssocList< string, Section * >::count().

template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
Iterator elm::SortedList< T, C, A >::find ( const T &  item) const
template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
Iterator elm::SortedList< T, C, A >::find ( const T &  item,
const Iterator iter 
) const
template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
const T & SortedList::first ( void  ) const

Get the first item of the list.

Returns
First item.
Warning
It is an error to call this method if the list is empty.

Referenced by elm::genstruct::AssocList< string, Section * >::first().

template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
bool SortedList::isEmpty ( void  ) const

Test if the list is empty.

Returns
True if the list is empty, false else.

Referenced by elm::genstruct::AssocList< string, Section * >::isEmpty(), and elm::genstruct::AssocList< string, Section * >::operator bool().

template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
const T & SortedList::last ( void  ) const

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.

Returns
Last item.
Warning
It is an error to call this method if the list is empty.

Referenced by elm::genstruct::AssocList< string, Section * >::last().

template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
elm::SortedList< T, C, A >::operator bool ( void  ) const
template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
void SortedList::remove ( const T &  item)

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.

Parameters
itemItem to remove.

Referenced by elm::genstruct::AssocList< string, Section * >::remove().

template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
void elm::SortedList< T, C, A >::remove ( const Iterator iter)
template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
template<template< class _ > class CC>
void elm::SortedList< T, C, A >::removeAll ( const CC< T > &  items)
template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
void SortedList::removeFirst ( void  )

Remove the first item from the list.

Warning
It is an error to call this method if the list is empty.
template<class T, class C = Comparator<T>, class A = IdAdapter<T>>
void SortedList::removeLast ( void  )

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.

Warning
It is an error to call this method if the list is empty.

The documentation for this class was generated from the following files: