2 Sequential_music-iter.cc -- implement Sequential_music_iterator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "translator-group.hh"
11 #include "voice-iterator.hh"
12 #include "music-list.hh"
16 Sequential_music_iterator::do_print() const
22 Sequential_music_iterator::Sequential_music_iterator ()
30 Sequential_music_iterator::sequential_music_l () const
32 return (Sequential_music
*)music_l_
;
36 Sequential_music_iterator::construct_children()
38 cursor_p_
= new PCursor
<Music
*> (sequential_music_l ()->music_p_list_p_
->top ());
40 while (cursor_p_
->ok())
49 set_Sequential_music_translator();
56 Sequential_music_iterator::leave_element()
60 Moment elt_time
= cursor_p_
->ptr()->duration ();
61 here_mom_
+= elt_time
;
66 Sequential_music_iterator::start_next_element()
69 iter_p_
= get_iterator_p ( cursor_p_
->ptr());
73 Sequential_music_iterator::set_Sequential_music_translator()
75 if (iter_p_
->report_to_l()->depth_i () > report_to_l ()->depth_i ())
76 set_translator (iter_p_
->report_to_l());
79 Sequential_music_iterator::~Sequential_music_iterator()
89 Sequential_music_iterator::do_process_and_next (Moment until
)
93 Moment local_until
= until
- here_mom_
;
96 Moment here
= iter_p_
->next_moment();
97 if (here
!= local_until
)
100 iter_p_
->process_and_next (local_until
);
109 start_next_element();
110 set_Sequential_music_translator();
121 Music_iterator::do_process_and_next (until
);
125 Sequential_music_iterator::next_moment() const
127 return iter_p_
->next_moment() + here_mom_
;
131 Sequential_music_iterator::ok() const