2 translator.cc -- implement Translator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 #include "translator.hh"
12 #include "translator-group.hh"
13 #include "dictionary-iter.hh"
14 #include "rational.hh"
16 Translator::~Translator ()
20 Translator::Translator ()
27 Translator::Translator (Translator const &s)
32 output_def_l_ = s.output_def_l_;
33 properties_dict_ = s.properties_dict_;
34 type_str_ = s.type_str_;
38 Translator::is_alias_b (String s) const
40 return s == type_str_;
44 Translator::do_try_request (Request *)
51 Translator::now_moment () const
53 return daddy_trans_l_->now_moment ();
58 Translator::add_processing ()
68 Translator::do_add_processing ()
73 Translator::print () const
76 DOUT << name () << " {";
77 if (name () != type_str_)
78 DOUT << "type = " << type_str_;
79 for (Dictionary_iter<Scalar> i (properties_dict_); i.ok (); i++)
81 DOUT << i.key () << "=" << i.val () <<"\n";
89 Translator::do_print () const
93 IMPLEMENT_IS_TYPE_B(Translator);
97 Translator::creation_processing ()
99 if (status >= CREATION_INITED)
102 do_creation_processing ();
103 status = CREATION_INITED;
107 Translator::post_move_processing ()
109 if (status >= MOVE_INITED)
112 creation_processing ();
113 do_post_move_processing ();
114 status = MOVE_INITED;
118 Translator::removal_processing ()
120 if (status == ORPHAN)
122 creation_processing ();
123 do_removal_processing ();
130 Translator::try_request (Request * r)
132 if (status < MOVE_INITED)
133 post_move_processing ();
135 return do_try_request (r);
139 Translator::process_requests ()
141 if (status < PROCESSED_REQS)
142 post_move_processing ();
143 else if (status >= PROCESSED_REQS)
146 status = PROCESSED_REQS;
147 do_process_requests ();
151 Translator::pre_move_processing ()
153 do_pre_move_processing ();
154 status = CREATION_INITED;
158 Translator::get_property (String id)
160 if (properties_dict_.elt_b (id))
162 return properties_dict_[id];
166 return daddy_trans_l_->get_property (id);
172 Translator::set_property (String id, Scalar val)
174 properties_dict_[id] = val;
179 Translator::output_def_l () const
181 return output_def_l_;