]> git.donarmstrong.com Git - lilypond.git/blob - lily/music-wrapper-iterator.cc
4980c9344ff0322ba5249a3bae641bf8431d074c
[lilypond.git] / lily / music-wrapper-iterator.cc
1 /*   
2   music-wrapper-iterator.cc --  implement Music_wrapper_iterator
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1998--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7  */
8
9
10 #include "music-wrapper-iterator.hh"
11 #include "music-wrapper.hh"
12
13 Music_wrapper_iterator::Music_wrapper_iterator ()
14 {
15   child_iter_ =0;
16 }
17
18 Music_wrapper_iterator::Music_wrapper_iterator (Music_wrapper_iterator const &src)
19   : Music_iterator (src)
20 {
21   if (src.child_iter_)
22     child_iter_ = src.child_iter_->clone ();
23   else
24     child_iter_ = 0;
25 }
26
27 Music_wrapper_iterator::~Music_wrapper_iterator ()
28 {
29   delete child_iter_;
30 }
31
32
33 void
34 Music_wrapper_iterator::construct_children ()
35 {
36   child_iter_ =
37     get_iterator (dynamic_cast<Music_wrapper const*> (get_music ())->element ());
38 }
39
40 bool
41 Music_wrapper_iterator::ok () const
42 {
43   return child_iter_ && child_iter_->ok ();
44 }
45 void
46 Music_wrapper_iterator::skip (Moment m)
47 {
48   /*
49     FIXME: should make sure that the initial try_music () is skipped as
50     well, if you would do
51
52     iter = get_iterator (Side_effect_music); // eg. property setting
53     iter->skip (1/2)
54     iter->process ()
55
56   */
57   child_iter_->skip (m);
58 }
59
60 void
61 Music_wrapper_iterator::process (Moment m)
62 {
63   child_iter_->process (m);
64 }
65
66 SCM
67 Music_wrapper_iterator::get_pending_events (Moment m)const
68 {
69   return child_iter_->get_pending_events (m);
70 }
71
72 Moment
73 Music_wrapper_iterator::pending_moment () const
74 {
75   return child_iter_->pending_moment ();
76 }
77
78 Music_iterator*
79 Music_wrapper_iterator::try_music_in_children (Music *m) const
80 {
81   return child_iter_->try_music (m);
82 }
83
84 IMPLEMENT_CTOR_CALLBACK (Music_wrapper_iterator);