MAUtil::Map< Key, Value > Class Template Reference

#include <MAUtil/Map.h>

Inheritance diagram for MAUtil::Map< Key, Value >:

MAUtil::Dictionary< Key, Pair< Key, Value > > List of all members.

template<class Key, class Value>
class MAUtil::Map< Key, Value >


Public Types

typedef Pair< Key, Value > PairKV
typedef int(* CompareFunction )(const Key &, const Key &)

Public Member Functions

 Map (int(*cf)(const Key &, const Key &)=&Compare< Key >)
Pair< typename D::Iterator,
bool > 
insert (const Key &key, const Value &value)
Value & operator[] (const Key &key)
Iterator find (const Key &)
ConstIterator find (const Key &) const
bool erase (const Key &)
void erase (Iterator)
Iterator begin ()
ConstIterator begin () const
Iterator end ()
ConstIterator end () const
size_t size () const
void clear ()

Protected Types

typedef Dictionary< Key, PairKVD
typedef D::DictNode DN

Protected Member Functions

void init (CompareFunction)
Pair< Iterator, bool > insert (const Pair< Key, Value > &)

Static Protected Member Functions

static dnode_t * alloc (void *)
static void free (dnode_t *node, void *)

Protected Attributes

dict_t mDict
int mKeyOffset

Member Typedef Documentation

template<class Key, class Value>
typedef Pair<Key, Value> MAUtil::Map< Key, Value >::PairKV
 

template<class Key, class Value>
typedef Dictionary<Key, PairKV> MAUtil::Map< Key, Value >::D [protected]
 

template<class Key, class Value>
typedef D::DictNode MAUtil::Map< Key, Value >::DN [protected]
 

typedef int(* MAUtil::Dictionary< Key , Pair< Key, Value > >::CompareFunction)(const Key &, const Key &) [inherited]
 


Constructor & Destructor Documentation

template<class Key, class Value>
MAUtil::Map< Key, Value >::Map int(*)(const Key &, const Key &)  cf = &Compare<Key>  )  [inline]
 


Member Function Documentation

template<class Key, class Value>
Pair<typename D::Iterator, bool> MAUtil::Map< Key, Value >::insert const Key &  key,
const Value &  value
[inline]
 

template<class Key, class Value>
Value& MAUtil::Map< Key, Value >::operator[] const Key &  key  )  [inline]
 

Iterator MAUtil::Dictionary< Key , Pair< Key, Value > >::find const Key &   )  [inherited]
 

Searches the Dictionary for a specified Key. The returned Iterator points to the element matching the Key if one was found, or to Dictionary::end() if not.

ConstIterator MAUtil::Dictionary< Key , Pair< Key, Value > >::find const Key &   )  const [inherited]
 

bool MAUtil::Dictionary< Key , Pair< Key, Value > >::erase const Key &   )  [inherited]
 

Deletes an element, matching the specified Key, from the Dictionary. Returns true if an element was erased, or false if there was no element matching the Key.

void MAUtil::Dictionary< Key , Pair< Key, Value > >::erase Iterator   )  [inherited]
 

Deletes an element, pointed to by the specified Iterator. The Iterator is invalidated, so if you want to continue iterating through the Dictionary, you must use a different Iterator instance.

Warning:
If the Iterator is bound to a different Dictionary, or if it points to end(), the system will crash.

Iterator MAUtil::Dictionary< Key , Pair< Key, Value > >::begin  )  [inherited]
 

Returns an Iterator pointing to the first element in the Dictionary.

ConstIterator MAUtil::Dictionary< Key , Pair< Key, Value > >::begin  )  const [inherited]
 

Iterator MAUtil::Dictionary< Key , Pair< Key, Value > >::end  )  [inherited]
 

Returns an Iterator pointing to a place beyond the last element of the Dictionary. This Iterator is often used to determine when another Iterator has reached its end.

ConstIterator MAUtil::Dictionary< Key , Pair< Key, Value > >::end  )  const [inherited]
 

size_t MAUtil::Dictionary< Key , Pair< Key, Value > >::size  )  const [inherited]
 

Returns the number of elements in the Dictionary.

void MAUtil::Dictionary< Key , Pair< Key, Value > >::clear  )  [inherited]
 

Deletes all elements.

static dnode_t* MAUtil::Dictionary< Key , Pair< Key, Value > >::alloc void *   )  [inline, static, protected, inherited]
 

static void MAUtil::Dictionary< Key , Pair< Key, Value > >::free dnode_t *  node,
void * 
[inline, static, protected, inherited]
 

void MAUtil::Dictionary< Key , Pair< Key, Value > >::init CompareFunction   )  [protected, inherited]
 

Pair<Iterator, bool> MAUtil::Dictionary< Key , Pair< Key, Value > >::insert const Pair< Key, Value > &   )  [protected, inherited]
 

Inserts a new value into the Dictionary.

Returns a Pair. The Pair's second element is true if the value was indeed inserted. The Pair's first element is an Iterator that points to the element in the Dictionary.

An element which compares equal to the new one may already be present in the Dictionary; in that case, this operation does nothing, and the Iterator returned will point to the old element.


Member Data Documentation

dict_t MAUtil::Dictionary< Key , Pair< Key, Value > >::mDict [protected, inherited]
 

int MAUtil::Dictionary< Key , Pair< Key, Value > >::mKeyOffset [protected, inherited]
 


Generated on Sat Feb 13 00:15:39 2010 for MoSync 2 beta 1 by  doxygen 1.4.6-NO