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"
15 Translator::~Translator ()
19 Translator::Translator ()
26 Translator::Translator (Translator
const &s
)
30 output_def_l_
= s
.output_def_l_
;
31 properties_dict_
= s
.properties_dict_
;
32 type_str_
= s
.type_str_
;
36 Translator::is_alias_b (String s
) const
38 return s
== type_str_
;
42 Translator::do_try_request (Request
*)
49 Translator::now_moment () const
51 return daddy_trans_l_
->now_moment ();
56 Translator::add_processing ()
63 Translator::print () const
66 DOUT
<< name () << " {";
67 if (name () != type_str_
)
68 DOUT
<< "type= " << type_str_
;
69 for (Dictionary_iter
<Scalar
> i (properties_dict_
); i
.ok (); i
++)
71 DOUT
<< i
.key () << "=" << i
.val () <<"\n";
79 Translator::do_print () const
83 IMPLEMENT_IS_TYPE_B(Translator
);
87 Translator::creation_processing ()
89 if (status
>= CREATION_INITED
)
92 do_creation_processing ();
93 status
= CREATION_INITED
;
97 Translator::post_move_processing()
99 if (status
>= MOVE_INITED
)
102 creation_processing();
103 do_post_move_processing();
104 status
= MOVE_INITED
;
108 Translator::removal_processing()
110 creation_processing();
111 do_removal_processing();
116 Translator::try_request (Request
* r
)
118 if (status
< MOVE_INITED
)
119 post_move_processing();
121 return do_try_request (r
);
125 Translator::process_requests()
127 if (status
< PROCESSED_REQS
)
128 post_move_processing();
129 else if (status
>= PROCESSED_REQS
)
132 status
= PROCESSED_REQS
;
133 do_process_requests();
137 Translator::pre_move_processing()
139 do_pre_move_processing();
140 status
= CREATION_INITED
;
144 Translator::get_property (String id
)
146 if (properties_dict_
.elt_b (id
))
148 return properties_dict_
[id
];
152 return daddy_trans_l_
->get_property (id
);
158 Translator::set_property (String id
, Scalar val
)
160 properties_dict_
[id
] = val
;
165 Translator::output_def_l () const
167 return output_def_l_
;