]> git.donarmstrong.com Git - lilypond.git/blob - lily/music-wrapper-iterator.cc
release: 1.3.107
[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--2000 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_p_ =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_p_)
22     child_iter_p_ = src.child_iter_p_->clone ();
23   else
24     child_iter_p_ = 0;
25 }
26
27 Music_wrapper_iterator::~Music_wrapper_iterator ()
28 {
29   delete child_iter_p_;
30 }
31
32
33 void
34 Music_wrapper_iterator::construct_children ()
35 {
36   child_iter_p_ =
37     get_iterator_p (dynamic_cast<Music_wrapper const*> (music_l_)->element ());
38 }
39
40 bool
41 Music_wrapper_iterator::ok () const
42 {
43   return child_iter_p_ && child_iter_p_->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_p_->skip (m);
58 }
59
60 void
61 Music_wrapper_iterator::process (Moment m)
62 {
63   child_iter_p_->process (m);
64 }
65
66 SCM
67 Music_wrapper_iterator::get_music (Moment m)const
68 {
69   return child_iter_p_->get_music (m);
70 }
71
72 Moment
73 Music_wrapper_iterator::pending_moment () const
74 {
75   return child_iter_p_->pending_moment ();
76 }
77
78 Music_iterator*
79 Music_wrapper_iterator::try_music_in_children (Music *m) const
80 {
81   return child_iter_p_->try_music (m);
82 }
83
84 IMPLEMENT_CTOR_CALLBACK(Music_wrapper_iterator);