]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/translator-group.cc
release: 1.1.31
[lilypond.git] / lily / translator-group.cc
index 7b59009780d2d600a2ee7090e5d258f4c6526bce..2e6c6ee3167738f3166e73c8fb138937c3ba13ad 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "music-output-def.hh"
@@ -12,6 +12,7 @@
 #include "debug.hh"
 #include "pcursor.hh"
 #include "rational.hh"
+#include "dictionary-iter.hh"
 
 Translator_group::Translator_group (Translator_group const&s)
   : Translator(s)
@@ -19,6 +20,8 @@ Translator_group::Translator_group (Translator_group const&s)
   consists_str_arr_ = s.consists_str_arr_;
   accepts_str_arr_ = s.accepts_str_arr_;
   iterator_count_ =0;
+  properties_dict_ = s.properties_dict_;
+  
 }
 
 Translator_group::~Translator_group ()
@@ -242,7 +245,7 @@ Translator_group::nongroup_l_arr () const
 void
 Translator_group::terminate_translator (Translator*r_l)
 {
-  DOUT << "Removing " << classname (r_l) << " at " << now_moment () << '\n';
+  DOUT << "Removing " << classname (r_l) << " at " << now_mom () << '\n';
   r_l->removal_processing();
   Translator * trans_p =remove_translator_p (r_l);
 
@@ -331,6 +334,10 @@ Translator_group::do_print() const
 #ifndef NPRINT
   if (!check_debug)
     return ;
+  for (Dictionary_iter<Scalar> i (properties_dict_); i.ok (); i++)
+    {
+      DOUT << i.key () << "=" << i.val () << '\n';
+    }
   if (status == ORPHAN)
     {
       DOUT << "consists of: ";
@@ -392,3 +399,28 @@ Translator_group::do_add_processing ()
        add_translator (t->clone ());
     }
 }
+
+Scalar
+Translator_group::get_property (String id,
+                               Translator_group **where_l) const
+{
+  if (properties_dict_.elem_b (id))
+    {
+      if (where_l)
+       *where_l = this;
+      return properties_dict_[id];
+    }
+  
+  if (daddy_trans_l_)
+    return daddy_trans_l_->get_property (id, where_l);
+
+  if (where_l)
+    *where_l = 0;
+  return "";
+}
+
+void
+Translator_group::set_property (String id, Scalar val)
+{
+  properties_dict_[id] = val;
+}