MAUtil::Set< Key > Class Template Reference

#include <MAUtil/Set.h>

Inheritance diagram for MAUtil::Set< Key >:

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

Detailed Description

template<class Key>
class MAUtil::Set< Key >

Thin template sorted Set.


Public Types

typedef Dictionary< Key, Key > D
typedef int(* CompareFunction )(const Key &, const Key &)

Public Member Functions

 Set (int(*cf)(const Key &, const Key &)=&Compare< Key >)
Pair< typename D::Iterator,
bool > 
insert (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 Member Functions

void init (CompareFunction)

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>
typedef Dictionary<Key, Key> MAUtil::Set< Key >::D
 

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


Constructor & Destructor Documentation

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


Member Function Documentation

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

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.

Reimplemented from MAUtil::Dictionary< Key, Key >.

Iterator MAUtil::Dictionary< Key , Key >::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 , Key >::find const Key &   )  const [inherited]
 

bool MAUtil::Dictionary< Key , Key >::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 , Key >::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 , Key >::begin  )  [inherited]
 

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

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

Iterator MAUtil::Dictionary< Key , Key >::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 , Key >::end  )  const [inherited]
 

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

Returns the number of elements in the Dictionary.

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

Deletes all elements.

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

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

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


Member Data Documentation

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

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


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