Logo Search packages:      
Sourcecode: scummvm version File versions

Common::Map< Key, Value, Comparator > Class Template Reference

#include <map.h>

Inherited by Common::ConfigManager::Domain.

List of all members.


Detailed Description

template<class Key, class Value, class Comparator = DefaultComparator<Key>>
class Common::Map< Key, Value, Comparator >

Template based map (aka dictionary) class which uniquely maps elements of class Key to elements of class Value.

Todo:
This implementation is fairly limited. In particular, the tree is not balanced. Ultimately this template should be reimplemented, e.g. using a red-black tree. Or if one day using Std C++ lib becomes acceptable, we can use that.
Todo:
Having unit tests for this class would be very desirable. There are a big number of things which can go wrong in this code.

Definition at line 52 of file map.h.


Public Member Functions

Value & addKey (const Key &key)
const_iterator begin () const
void clear ()
bool contains (const Key &key) const
const_iterator end () const
bool isEmpty () const
void merge (const Map< Key, Value, Comparator > &map)
const Value & operator[] (const Key &key) const
Value & operator[] (const Key &key)
void remove (const Key &key)

Protected Member Functions

void clearNodes (Node *node)
Node * findNode (Node *node, const Key &key) const
Node * findOrCreateNode (Node *node, const Key &key)
void merge (const Node *node)

Protected Attributes

Node * _header
Node * _root

Private Member Functions

 Map (const Map< Key, Value, Comparator > &map)
Map< Key, Value, Comparator > & operator= (const Map< Key, Value, Comparator > &map)

Classes

class  const_iterator
struct  Node

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

Generated by  Doxygen 1.6.0   Back to index