]> git.donarmstrong.com Git - lilypond.git/blob - lily/change-iterator.cc
release: 0.1.31
[lilypond.git] / lily / change-iterator.cc
1 /*
2   change-iterator.cc -- implement 
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "change-iterator.hh"
10 #include "translator-group.hh"
11 #include "change-translator.hh"
12
13 Change_iterator::Change_iterator (Change_translator *change_l)
14 {
15   change_l_ = change_l;
16 }
17
18 /*
19   move to construct_children ?
20  */
21 void
22 Change_iterator::process_and_next (Moment m)
23 {
24   Translator_group * current = report_to_l ();
25   Translator_group * last = 0;
26   while  (current && current->type_str_ != change_l_->change_to_type_str_)
27     {
28       last = current;
29       current = current->daddy_trans_l_;
30     }
31   if (current) 
32     {
33       Translator_group * dest = 
34         report_to_l ()->find_create_translator_l (change_l_->change_to_type_str_, 
35                                                   change_l_->change_to_id_str_);
36       current->remove_translator_p (last);
37       dest->add (last);
38     }
39   
40   Music_iterator::process_and_next (m);
41 }
42
43 IMPLEMENT_IS_TYPE_B1 (Change_iterator, Music_iterator);