Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

CB2::PMapList< Tkey, Tvalue > Class Template Reference

List of key=value pairs. More...

#include <utils.h>

Inheritance diagram for CB2::PMapList< Tkey, Tvalue >:

CB2::Class List of all members.

Public Types

typedef PMapList< Tkey, Tvalue > this_type
 Template type alias.

typedef PMap< Tkey, Tvalue > item_type
 Item type.

typedef List< item_typestorage_type
 Storage type.

typedef storage_type::size_type size_type
 Size type.

typedef storage_type::ref_type ref_type
 Item reference type.

typedef Iterator< this_type,
ref_type, item_type
iterator
 Iterator.

typedef RevIterator< this_type,
ref_type, item_type
rev_iterator
 Reverse iterator.


Public Member Functions

 PMapList ()
 Constructor.

 ~PMapList ()
 Destructor.

const this_typeoperator<< (const item_type &map)
 Add new pair.

void Add (const Tkey &key, const Tvalue &value)
 Add new pair.

void Add (const Tkey &key)
 Add new pair with NULL value.

const Tvalue & operator[] (const Tkey &key) const
 Access item by key.

bool IsNULL (const Tkey &key) const
 Check whether item is NULL.

size_type Len () const
 Return number of items.

bool Empty () const
 Check list for empty.

ref_type RefBegin () const
 Get starting reference.

ref_type RefEnd () const
 Get final reference.

ref_type RevRefBegin () const
 Get starting reverse reference.

ref_type RevRefEnd () const
 Get final reverse reference.

ref_type RefNext (const ref_type &prev) const
 Get succeding reference.

ref_type RefPrev (const ref_type &prev) const
 Get predecessing reference.

const item_typeDeref (const ref_type &ref) const
 Dereference.

const item_typeRevDeref (const ref_type &ref) const
 Reverse dereference.

iterator Begin () const
 Get starting iterator.

iterator End () const
 Get final iterator.

rev_iterator RevBegin () const
 Get starting reverse iterator.

rev_iterator RevEnd () const
 Get final reverse iterator.


Public Attributes

int tag
 Tag for user-specific data.


Private Attributes

storage_type data
 List of pairs.


Detailed Description

template<class Tkey, class Tvalue>
class CB2::PMapList< Tkey, Tvalue >

List of key=value pairs.

List of key=value pairs of a given type. Unlike the simple List< Map> type, this template allows access by key.


Member Typedef Documentation

template<class Tkey, class Tvalue>
typedef PMap< Tkey, Tvalue> CB2::PMapList< Tkey, Tvalue >::item_type
 

Item type.

template<class Tkey, class Tvalue>
typedef Iterator< this_type, ref_type, item_type> CB2::PMapList< Tkey, Tvalue >::iterator
 

Iterator.

template<class Tkey, class Tvalue>
typedef storage_type::ref_type CB2::PMapList< Tkey, Tvalue >::ref_type
 

Item reference type.

template<class Tkey, class Tvalue>
typedef RevIterator< this_type, ref_type, item_type> CB2::PMapList< Tkey, Tvalue >::rev_iterator
 

Reverse iterator.

template<class Tkey, class Tvalue>
typedef storage_type::size_type CB2::PMapList< Tkey, Tvalue >::size_type
 

Size type.

template<class Tkey, class Tvalue>
typedef List< item_type> CB2::PMapList< Tkey, Tvalue >::storage_type
 

Storage type.

template<class Tkey, class Tvalue>
typedef PMapList< Tkey, Tvalue> CB2::PMapList< Tkey, Tvalue >::this_type
 

Template type alias.


Constructor & Destructor Documentation

template<class Tkey, class Tvalue>
CB2::PMapList< Tkey, Tvalue >::PMapList  )  [inline]
 

Constructor.

Create empty list.

template<class Tkey, class Tvalue>
CB2::PMapList< Tkey, Tvalue >::~PMapList  )  [inline]
 

Destructor.

Destroy the list.


Member Function Documentation

template<class Tkey, class Tvalue>
void CB2::PMapList< Tkey, Tvalue >::Add const Tkey &  key  )  [inline]
 

Add new pair with NULL value.

Add new pair as key and NULL value.

Parameters:
key Key.

template<class Tkey, class Tvalue>
void CB2::PMapList< Tkey, Tvalue >::Add const Tkey &  key,
const Tvalue &  value
[inline]
 

Add new pair.

Add new pair as key and value.

Parameters:
key Key.
value Value.

template<class Tkey, class Tvalue>
iterator CB2::PMapList< Tkey, Tvalue >::Begin  )  const [inline]
 

Get starting iterator.

Returns:
Starting iterator.

template<class Tkey, class Tvalue>
const item_type& CB2::PMapList< Tkey, Tvalue >::Deref const ref_type ref  )  const [inline]
 

Dereference.

Get the item value referenced by 'ref'. If the reference is out of range, ExceptionMemory is thrown.

Parameters:
ref Item reference.
Returns:
Item value.

template<class Tkey, class Tvalue>
bool CB2::PMapList< Tkey, Tvalue >::Empty  )  const [inline]
 

Check list for empty.

Returns:
True if the list is empty.

template<class Tkey, class Tvalue>
iterator CB2::PMapList< Tkey, Tvalue >::End  )  const [inline]
 

Get final iterator.

Returns:
Final iterator.

template<class Tkey, class Tvalue>
bool CB2::PMapList< Tkey, Tvalue >::IsNULL const Tkey &  key  )  const [inline]
 

Check whether item is NULL.

Check whether an item is NULL. If no value for given key is found, ExceptionNotFound is thrown.

Parameters:
key Key.
Returns:
True if value for the key is NULL.

template<class Tkey, class Tvalue>
size_type CB2::PMapList< Tkey, Tvalue >::Len  )  const [inline]
 

Return number of items.

Returns:
Number of items in the list.

template<class Tkey, class Tvalue>
const this_type& CB2::PMapList< Tkey, Tvalue >::operator<< const item_type map  )  [inline]
 

Add new pair.

Add new pair of key=value to the list. The pair is stored as local copy.

Parameters:
map Pair to store.
Returns:
Reference to this.

template<class Tkey, class Tvalue>
const Tvalue& CB2::PMapList< Tkey, Tvalue >::operator[] const Tkey &  key  )  const [inline]
 

Access item by key.

Get value by key. If no value for given key is found, ExceptionNotFound is thown. Also if the value is found, but NULL, ExceptionAssert is thrown (see Map< Tkey, Tvalue>::GetValue().

Parameters:
key Key.
Returns:
Value.

template<class Tkey, class Tvalue>
ref_type CB2::PMapList< Tkey, Tvalue >::RefBegin  )  const [inline]
 

Get starting reference.

Get the reference to the first item in the list as a pointer to the first item (or NULL on empty list).

Returns:
Starting reference.

template<class Tkey, class Tvalue>
ref_type CB2::PMapList< Tkey, Tvalue >::RefEnd  )  const [inline]
 

Get final reference.

Get the final reference as a NULL pointer.

Returns:
Final reference.

template<class Tkey, class Tvalue>
ref_type CB2::PMapList< Tkey, Tvalue >::RefNext const ref_type prev  )  const [inline]
 

Get succeding reference.

Get the reference to an item succeding the item referenced by 'prev'.

Parameters:
prev Original reference.
Returns:
Next reference.

template<class Tkey, class Tvalue>
ref_type CB2::PMapList< Tkey, Tvalue >::RefPrev const ref_type prev  )  const [inline]
 

Get predecessing reference.

Get the reference to an item predecessing the item referenced by 'prev'.

Parameters:
prev Original reference.
Returns:
Previous reference.

template<class Tkey, class Tvalue>
rev_iterator CB2::PMapList< Tkey, Tvalue >::RevBegin  )  const [inline]
 

Get starting reverse iterator.

Returns:
Starting reverse iterator.

template<class Tkey, class Tvalue>
const item_type& CB2::PMapList< Tkey, Tvalue >::RevDeref const ref_type ref  )  const [inline]
 

Reverse dereference.

Get the item value referenced by 'ref'. If the reference is out of range, ExceptionMemory is thrown.

Parameters:
ref Item reference.
Returns:
Item value.

template<class Tkey, class Tvalue>
rev_iterator CB2::PMapList< Tkey, Tvalue >::RevEnd  )  const [inline]
 

Get final reverse iterator.

Returns:
Final reverse iterator.

template<class Tkey, class Tvalue>
ref_type CB2::PMapList< Tkey, Tvalue >::RevRefBegin  )  const [inline]
 

Get starting reverse reference.

Get the reverse reference to the last item in the list as a pointer to the last item (or NULL on empty list).

Returns:
Starting reverse reference.

template<class Tkey, class Tvalue>
ref_type CB2::PMapList< Tkey, Tvalue >::RevRefEnd  )  const [inline]
 

Get final reverse reference.

Get the final reverse reference as a NULL pointer.

Returns:
Final reverse reference.


Member Data Documentation

template<class Tkey, class Tvalue>
storage_type CB2::PMapList< Tkey, Tvalue >::data [private]
 

List of pairs.

int CB2::Class::tag [inherited]
 

Tag for user-specific data.


The documentation for this class was generated from the following file:
Generated on Thu Sep 16 23:26:49 2004 for ColorBox2 by doxygen 1.3.7