]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/dictionary-iter.hh
release: 1.0.17
[lilypond.git] / flower / include / dictionary-iter.hh
index 9183c5d585934581b5d0fea755c105bb83fffb81..da6e64b391794279538bdbfc5a56003cce3a7f04 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  dictionary-iter.hh -- declare 
+  dictionary-iter.hh -- declare Dictionary_iter
 
   source file of the Flower Library
 
 #ifndef DICTIONARY_ITER_HH
 #define DICTIONARY_ITER_HH
 
-#include "string.hh"
-#include "assoc-iter.hh"
+#include "dictionary.hh"
+
+
+
 #include "dictionary.hh"
 
 template<class V>
-class Dictionary_iter : public Assoc_iter<String, V>
+class Dictionary_iter
 {
+  Dictionary<V> *dict_l_;
+  int i;
 public:
-  Dictionary_iter (Dictionary<V> const &d)
-    : Assoc_iter<String, V> (d)
-  {
-  }
+  Dictionary_iter(Dictionary<V> const &dict)
+    {
+      i =0;
+      dict_l_ =(Dictionary<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 ();
+    }
+
+  String key ()
+    {
+      return dict_l_->fixed_p_->dict_arr_[i].name_;
+    }
+  V val ()
+    {
+      return dict_l_->fixed_p_->dict_arr_[i].value_;      
+    }
 };
 
 #endif // DICTIONARY_ITER_HH