]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/dictionary.hh
''
[lilypond.git] / flower / include / dictionary.hh
index 11bb27329bbba3ca0590e00fef7fdf37aadf7495..d77f3aec982b6fd87d452f2758c1bc68c127b058 100644 (file)
@@ -3,21 +3,55 @@
 
   source file of the Flower Library
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 
 #ifndef DICTIONARY_HH
 #define DICTIONARY_HH
 
+#include <map>
+
+
 #include "string.hh"
-#include "assoc.hh"
+#include "array.hh"
+
 
-template<class T>
-class Dictionary : public Assoc<String, T>
+unsigned int string_hash (String);
+
+template <class V>
+struct Dict_initialiser
+{
+  char *key_;
+  V value_;
+};
+
+
+/*
+  interface to STL function.
+ */
+
+template <class V>
+class Dictionary : public std::map<String, V> //map<String, V>
 {
 public:
+  Dictionary ()
+    {
+    }
+  Dictionary (Dict_initialiser<V> *p)
+    {
+      hash_func_ = string_hash;
+      for (Dict_initialiser<V> *q = p; q->key_; q++)
+ (*this) [q->key_] = q->value_;
+         
+    }
+  bool elem_b (String s)
+  {
+    std::map<String,V>::const_iterator ki (find (s));
+    return ki != end ();
+  }
   
 };
 
+
 #endif // DICTIONARY_HH