dictionary.h
// Copyright (c) 2003 David Muse
// See the COPYING file for more information.
#ifndef RUDIMENTS_DICTIONARY_H
#define RUDIMENTS_DICTIONARY_H
#include <rudiments/private/dictionaryincludes.h>
template <class keytype, class valuetype>
class dictionarynode {
public:
dictionarynode(keytype key, valuetype value);
virtual ~dictionarynode();
void setKey(keytype key);
void setValue(valuetype value);
keytype getKey() const;
valuetype getValue() const;
int32_t compare(keytype testkey) const;
int32_t compare(
dictionarynode<keytype,valuetype> *testnode) const;
void print() const;
#include <rudiments/private/dictionarynode.h>
};
template <class keytype, class valuetype>
class dictionary {
public:
dictionary();
dictionary(bool trackinsertionorder);
virtual ~dictionary();
bool setTrackInsertionOrder(bool trackinsertionorder);
bool getTrackInsertionOrder();
void setValue(keytype key, valuetype value);
bool getValue(keytype key, valuetype *value);
dictionarynode<keytype,valuetype> *getNode(keytype key);
valuetype getValue(keytype key);
bool remove(keytype key);
bool remove(dictionarynode<keytype,valuetype> *node);
linkedlist<keytype> *getKeys();
avltree< dictionarynode<keytype,valuetype> *> *getTree();
linkedlist< dictionarynode<keytype,valuetype> *> *getList();
void clear();
void print();
#include <rudiments/private/dictionary.h>
};
// ideally I'd use typdefs for these but older compilers can't handle them
#define namevaluepairsnode dictionarynode< char *, char * >
#define namevaluepairs dictionary< char *, char * >
#define constnamevaluepairsnode dictionarynode< const char *, const char * >
#define constnamevaluepairs dictionary< const char *, const char * >
#include <rudiments/private/dictionaryinlines.h>
#endif
dictionarynode::print
void print() const
avltree
Definition: avltree.h:77
dictionarynode::setValue
void setValue(valuetype value)
linkedlist
Definition: linkedlist.h:60
dictionarynode
Definition: dictionary.h:12
dictionarynode::compare
int32_t compare(keytype testkey) const
dictionarynode::~dictionarynode
virtual ~dictionarynode()
dictionary
Definition: dictionary.h:63
dictionarynode::setKey
void setKey(keytype key)
dictionarynode::dictionarynode
dictionarynode(keytype key, valuetype value)
dictionarynode::getKey
keytype getKey() const
dictionarynode::getValue
valuetype getValue() const