dictionary.h
// Copyright (c) 1999-2018 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);
void setValues(keytype *keys, valuetype *values);
void setValues(keytype const *keys, valuetype const *values);
void setValues(keytype *keys, valuetype *values,
uint64_t count);
void setValues(keytype const *keys, valuetype const *values,
uint64_t count);
void setValues(dictionary< keytype, valuetype > *dict);
bool getValue(keytype key, valuetype *value);
dictionarynode<keytype,valuetype> *getNode(keytype key);
valuetype getValue(keytype key);
bool remove(keytype key);
bool removeAndDelete(keytype key);
bool removeAndArrayDelete(keytype key);
bool removeAndDeleteKey(keytype key);
bool removeAndArrayDeleteKey(keytype key);
bool removeAndDeleteValue(keytype key);
bool removeAndArrayDeleteValue(keytype key);
bool removeAndDeleteKeyAndArrayDeleteValue(keytype key);
bool removeAndArrayDeleteKeyAndDeleteValue(keytype key);
bool remove(dictionarynode<keytype,valuetype> *node);
bool removeAndDelete(
dictionarynode<keytype,valuetype> *node);
bool removeAndArrayDelete(
dictionarynode<keytype,valuetype> *node);
bool removeAndDeleteKey(
dictionarynode<keytype,valuetype> *node);
bool removeAndArrayDeleteKey(
dictionarynode<keytype,valuetype> *node);
bool removeAndDeleteValue(
dictionarynode<keytype,valuetype> *node);
bool removeAndArrayDeleteValue(
dictionarynode<keytype,valuetype> *node);
bool removeAndDeleteKeyAndArrayDeleteValue(
dictionarynode<keytype,valuetype> *node);
bool removeAndArrayDeleteKeyAndDeleteValue(
dictionarynode<keytype,valuetype> *node);
linkedlist<keytype> *getKeys();
avltree< dictionarynode<keytype,valuetype> *> *getTree();
linkedlist< dictionarynode<keytype,valuetype> *> *getList();
void clear();
void clearAndDelete();
void clearAndArrayDelete();
void clearAndDeleteKeys();
void clearAndArrayDeleteKeys();
void clearAndDeleteValues();
void clearAndArrayDeleteValues();
void clearAndDeleteKeysAndArrayDeleteValues();
void clearAndArrayDeleteKeysAndDeleteValues();
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
avltree
Definition: avltree.h:77
dictionary
Definition: dictionary.h:63
dictionary::removeAndDeleteKey
bool removeAndDeleteKey(dictionarynode< keytype, valuetype > *node)
dictionary::getTrackInsertionOrder
bool getTrackInsertionOrder()
dictionary::remove
bool remove(dictionarynode< keytype, valuetype > *node)
dictionary::removeAndArrayDeleteKey
bool removeAndArrayDeleteKey(dictionarynode< keytype, valuetype > *node)
dictionary::setTrackInsertionOrder
bool setTrackInsertionOrder(bool trackinsertionorder)
dictionary::removeAndDelete
bool removeAndDelete(keytype key)
dictionary::removeAndArrayDeleteKeyAndDeleteValue
bool removeAndArrayDeleteKeyAndDeleteValue(dictionarynode< keytype, valuetype > *node)
dictionary::removeAndDelete
bool removeAndDelete(dictionarynode< keytype, valuetype > *node)
dictionary::print
void print()
dictionary::clearAndDelete
void clearAndDelete()
dictionary::dictionary
dictionary(bool trackinsertionorder)
dictionary::clear
void clear()
dictionary::getValue
bool getValue(keytype key, valuetype *value)
dictionary::clearAndArrayDeleteKeysAndDeleteValues
void clearAndArrayDeleteKeysAndDeleteValues()
dictionary::clearAndArrayDelete
void clearAndArrayDelete()
dictionary::removeAndArrayDeleteKey
bool removeAndArrayDeleteKey(keytype key)
dictionary::getValue
valuetype getValue(keytype key)
dictionary::removeAndArrayDeleteKeyAndDeleteValue
bool removeAndArrayDeleteKeyAndDeleteValue(keytype key)
dictionary::removeAndArrayDeleteValue
bool removeAndArrayDeleteValue(dictionarynode< keytype, valuetype > *node)
dictionary::setValues
void setValues(keytype *keys, valuetype *values, uint64_t count)
dictionary::removeAndDeleteValue
bool removeAndDeleteValue(keytype key)
dictionary::setValues
void setValues(dictionary< keytype, valuetype > *dict)
dictionary::removeAndArrayDelete
bool removeAndArrayDelete(dictionarynode< keytype, valuetype > *node)
dictionary::removeAndDeleteValue
bool removeAndDeleteValue(dictionarynode< keytype, valuetype > *node)
dictionary::getKeys
linkedlist< keytype > * getKeys()
dictionary::removeAndDeleteKeyAndArrayDeleteValue
bool removeAndDeleteKeyAndArrayDeleteValue(keytype key)
dictionary::removeAndArrayDeleteValue
bool removeAndArrayDeleteValue(keytype key)
dictionary::clearAndArrayDeleteKeys
void clearAndArrayDeleteKeys()
dictionary::~dictionary
virtual ~dictionary()
dictionary::setValue
void setValue(keytype key, valuetype value)
dictionary::getNode
dictionarynode< keytype, valuetype > * getNode(keytype key)
dictionary::getList
linkedlist< dictionarynode< keytype, valuetype > * > * getList()
dictionary::removeAndDeleteKey
bool removeAndDeleteKey(keytype key)
dictionary::clearAndDeleteValues
void clearAndDeleteValues()
dictionary::setValues
void setValues(keytype *keys, valuetype *values)
dictionary::clearAndDeleteKeys
void clearAndDeleteKeys()
dictionary::getTree
avltree< dictionarynode< keytype, valuetype > * > * getTree()
dictionary::clearAndArrayDeleteValues
void clearAndArrayDeleteValues()
dictionary::clearAndDeleteKeysAndArrayDeleteValues
void clearAndDeleteKeysAndArrayDeleteValues()
dictionary::removeAndDeleteKeyAndArrayDeleteValue
bool removeAndDeleteKeyAndArrayDeleteValue(dictionarynode< keytype, valuetype > *node)
dictionary::remove
bool remove(keytype key)
dictionary::dictionary
dictionary()
dictionary::removeAndArrayDelete
bool removeAndArrayDelete(keytype key)
dictionarynode
Definition: dictionary.h:12
dictionarynode::print
void print() const
dictionarynode::compare
int32_t compare(keytype testkey) const
dictionarynode::~dictionarynode
virtual ~dictionarynode()
dictionarynode::getValue
valuetype getValue() const
dictionarynode::compare
int32_t compare(dictionarynode< keytype, valuetype > *testnode) const
dictionarynode::getKey
keytype getKey() const
dictionarynode::setValue
void setValue(valuetype value)
dictionarynode::dictionarynode
dictionarynode(keytype key, valuetype value)
dictionarynode::setKey
void setKey(keytype key)
linkedlist
Definition: linkedlist.h:60