comparison anagram/support/agdict.h @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 /*
2 * AnaGram, A System for Syntax Directed Programming
3 * Copyright 1997-2002 Parsifal Software. All Rights Reserved.
4 * See the file COPYING for license and usage terms.
5 *
6 * agdict.h - new string dictionary
7 */
8
9 #ifndef AGDICT_H
10 #define AGDICT_H
11
12 class AgString; // from agstr.h
13 #include "agbaltree.h"
14 #include "agstack.h"
15
16
17 class AgStringDictionary {
18 class Tree : public AgBalancedTree<int> {
19 protected:
20 AgStack<AgString> stringStore;
21 int compare(const int &x, const int &y) const;
22 friend class AgStringDictionary;
23 void reset();
24 };
25 Tree tree;
26 public:
27 void reset() { tree.reset(); }
28 AgStringDictionary() { tree.reset(); }
29 unsigned size() const { return tree.size(); }
30
31 int operator << (const AgString s);
32 int operator [] (const AgString s);
33 AgString operator [] (const unsigned x);
34 };
35
36
37 #endif /* AGDICT_H */