2 repeated-music-iterator.cc -- implement Repeated_music_iterator
4 source file of the GNU LilyPond music typesetter
6 (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "repeated-music-iterator.hh"
11 #include "repeated-music.hh"
12 #include "musical-request.hh"
13 #include "translator-group.hh"
14 #include "command-request.hh"
16 Repeated_music_iterator::Repeated_music_iterator ()
19 alternative_iter_p_ = 0;
22 Repeated_music_iterator::~Repeated_music_iterator ()
24 delete repeat_iter_p_;
25 delete alternative_iter_p_;
29 Repeated_music_iterator::do_print () const
31 if (repeat_iter_p_) repeat_iter_p_->print ();
32 if (alternative_iter_p_) alternative_iter_p_->print ();
36 Repeated_music_iterator::construct_children ()
38 repeat_iter_p_ = get_iterator_p (repeated_music_l ()->repeat_p_);
42 Repeated_music_iterator::do_process_and_next (Moment m)
46 bool success = report_to_l ()->try_music (repeated_music_l ());
48 music_l_->warning ( _("No one to print a volta bracket"));
50 if (repeat_iter_p_->ok ())
51 repeat_iter_p_->process_and_next (m);
54 if (!alternative_iter_p_)
56 delete repeat_iter_p_;
58 alternative_iter_p_ = dynamic_cast<Sequential_music_iterator*>
59 (get_iterator_p (repeated_music_l ()->alternative_p_));
61 alternative_iter_p_->process_and_next (m);
63 Music_iterator::do_process_and_next (m);
67 Repeated_music_iterator::next_moment () const
70 return repeat_iter_p_->next_moment ();
71 else if (alternative_iter_p_)
72 return alternative_iter_p_->next_moment ();
77 Repeated_music_iterator::ok () const
80 return repeat_iter_p_->ok ();
81 else if (alternative_iter_p_)
82 return alternative_iter_p_->ok ();
87 Repeated_music_iterator::repeated_music_l () const
89 return (Repeated_music*)Music_iterator::music_l_;