]> git.donarmstrong.com Git - lilypond.git/blob - lily/music-wrapper-iterator.cc
* VERSION (MY_PATCH_LEVEL): make 1.7.0
[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   child_iter_ = (src.child_iter_) ? src.child_iter_->clone () : 0;
22   if (child_iter_)
23     scm_gc_unprotect_object (child_iter_->self_scm());
24 }
25
26 void
27 Music_wrapper_iterator::do_quit()
28 {
29   child_iter_->quit();
30 }
31
32 void
33 Music_wrapper_iterator::derived_mark()const
34 {
35   if (child_iter_)
36     scm_gc_mark (child_iter_->self_scm());
37 }
38
39
40 void
41 Music_wrapper_iterator::construct_children ()
42 {
43   Music * m =  dynamic_cast<Music_wrapper const*> (get_music ())-> element();  
44   child_iter_ = unsmob_iterator (get_iterator (m));
45 }
46
47 bool
48 Music_wrapper_iterator::ok () const
49 {
50   return child_iter_ && child_iter_->ok ();
51 }
52 void
53 Music_wrapper_iterator::skip (Moment m)
54 {
55   /*
56     FIXME: should make sure that the initial try_music () is skipped as
57     well, if you would do
58
59     iter = get_iterator (Side_effect_music); // eg. property setting
60     iter->skip (1/2)
61     iter->process ()
62
63   */
64   child_iter_->skip (m);
65 }
66
67 void
68 Music_wrapper_iterator::process (Moment m)
69 {
70   child_iter_->process (m);
71 }
72
73 SCM
74 Music_wrapper_iterator::get_pending_events (Moment m)const
75 {
76   return child_iter_->get_pending_events (m);
77 }
78
79 Moment
80 Music_wrapper_iterator::pending_moment () const
81 {
82   return child_iter_->pending_moment ();
83 }
84
85 Music_iterator*
86 Music_wrapper_iterator::try_music_in_children (Music *m) const
87 {
88   return child_iter_->try_music (m);
89 }
90
91 IMPLEMENT_CTOR_CALLBACK (Music_wrapper_iterator);