*** empty log message ***
[lilypond.git] / flower / include / dictionary.hh
blob3b39641e5a620a78a44fefb3a7375a9a2a2114e7
1 /*
2 dictionary.hh -- declare Dictionary
4 source file of the Flower Library
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
10 #ifndef DICTIONARY_HH
11 #define DICTIONARY_HH
13 #include <map>
16 #include "string.hh"
17 #include "array.hh"
20 unsigned int string_hash (String);
22 template <class V>
23 struct Dict_initialiser
25 char *key_;
26 V value_;
31 interface to STL function.
34 template <class V>
35 class Dictionary : public std::map<String, V> //map<String, V>
37 public:
38 Dictionary ()
41 Dictionary (Dict_initialiser<V> *p)
43 hash_func_ = string_hash;
44 for (Dict_initialiser<V> *q = p; q->key_; q++)
45 (*this) [q->key_] = q->value_;
48 bool elem_b (String s)
50 typename std::map<String,V>::const_iterator ki (find (s));
51 return ki != end ();
57 #endif // DICTIONARY_HH