]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/dictionary.hh
release: 1.1.29
[lilypond.git] / flower / include / dictionary.hh
index 87af9f9f7ae2ede0fefb692f4dd715a6c01e689e..e29b483a4cef101004c4d667c646f4655817f74b 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the Flower Library
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 
 #define DICTIONARY_HH
 
 #include "string.hh"
-#include "assoc.hh"
+#include "array.hh"
 
-/**
-  UGH:  write a String_hash template, 
+#include "hash-table.hh"
 
-  SEE:
-  
-       #include <search.h>
 
-       ENTRY *hsearch(ENTRY item, ACTION action);
+unsigned int string_hash (String);
 
-       int     hcreate (unsigned nel);
 
-       void    hdestroy (void);
+template<class V>
+struct Dict_initialiser
+{
+  char *key_;
+  V value_;
+};
 
-  (should be frobnified to allow multiple hashes)
- */
-template<class T>
-class Dictionary : public Assoc<String, T>
+
+template<class V>
+class Dictionary : public Hash_table<String, V>
 {
 public:
-  
+  Dictionary ()
+    {
+      hash_func_ = string_hash;
+    }
+  Dictionary (Dict_initialiser<V> *p)
+    {
+      hash_func_ = string_hash;
+      for (Dict_initialiser<V> *q = p; q->key_; q++)
+       elem (q->key_) = q->value_;
+         
+    }
+
+  friend class Dictionary_iter<V>;
 };
 
+
 #endif // DICTIONARY_HH