]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/dictionary-iter.hh
release: 1.3.19
[lilypond.git] / flower / include / dictionary-iter.hh
index 33531e584c442b402d9d6adf807cc93ae434d15b..eaf0317464c08529e3349c91dc15e71798b0121d 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the Flower Library
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 
 #define DICTIONARY_ITER_HH
 
 #include "dictionary.hh"
+#include "hash-table-iter.hh"
 
-template<class K, class V>
-class Hash_table_iter
-{
-  Hash_table<K,V> *dict_l_;
-  int i;
-public:
-  Hash_table_iter(Hash_table<K,V> const &dict)
-    {
-      i =0;
-      dict_l_ =(Hash_table<K,V> *) & dict;
-      next_used ();
-    }
-
-  bool ok ()
-    {
-      return i < dict_l_->fixed_p_->dict_arr_.size ();
-    }
-
-  void next_used ()
-    {
-      while (ok () && dict_l_->fixed_p_->dict_arr_[i].free_b_)
-       {
-         i ++;
-       }
-    }
-  void operator ++(int)
-    {
-      i++;
-      next_used ();
-    }
-
-  K key ()
-    {
-      return dict_l_->fixed_p_->dict_arr_[i].key_;
-    }
-  V val () 
-    {
-      return dict_l_->fixed_p_->dict_arr_[i].value_;      
-    }
-  V &val_ref ()
-    {
-      return dict_l_->fixed_p_->dict_arr_[i].value_;      
-    }
-};
 
 template<class V>
-class Dictionary_iter<V> : public Hash_table_iter<String,V>
+class Dictionary_iter : public Hash_table_iter<String,V>
 {
 public:
   Dictionary_iter (Dictionary<V> const &d)