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;
void print() const;
#include <rudiments/private/dictionarynode.h>
};
template <class keytype, class valuetype>
class dictionary {
public:
dictionary();
virtual ~dictionary();
void setValue(keytype key, valuetype value);
bool getValue(keytype key, valuetype *value);
bool removeValue(keytype key);
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