]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/dictionary.hh
patch::: 1.3.49.hwn1: deze dus
[lilypond.git] / flower / include / dictionary.hh
1 /*
2   dictionary.hh -- declare Dictionary
3
4   source file of the Flower Library
5
6   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10 #ifndef DICTIONARY_HH
11 #define DICTIONARY_HH
12
13 #include "string.hh"
14 #include "array.hh"
15
16 #include "hash-table.hh"
17
18
19 unsigned int string_hash (String);
20
21
22 template<class V>
23 struct Dict_initialiser
24 {
25   char *key_;
26   V value_;
27 };
28
29
30 /*
31   DEPRECATED. Use either SCM (preferred) or STL 
32  */
33 template<class V>
34 class Dictionary : public Hash_table<String, V>
35 {
36 public:
37   Dictionary ()
38     {
39       hash_func_ = string_hash;
40     }
41   Dictionary (Dict_initialiser<V> *p)
42     {
43       hash_func_ = string_hash;
44       for (Dict_initialiser<V> *q = p; q->key_; q++)
45         elem (q->key_) = q->value_;
46           
47     }
48
49   friend class Dictionary_iter<V>;
50 };
51
52
53 #endif // DICTIONARY_HH