]> git.donarmstrong.com Git - lilypond.git/blob - lily/simple-music-iterator.cc
release: 1.5.28
[lilypond.git] / lily / simple-music-iterator.cc
1 /*   
2   simple-music-iterator.cc --  implement Simple_music_iterator
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #include "simple-music-iterator.hh"
11 #include "music.hh"
12 #include "input.hh"
13
14 Simple_music_iterator::Simple_music_iterator ()
15   : Music_iterator ()
16 {
17   last_processed_mom_ = -1;
18 }
19
20 Simple_music_iterator::Simple_music_iterator (Simple_music_iterator const &src)
21   : Music_iterator (src)
22 {
23   last_processed_mom_ = src.last_processed_mom_;
24 }
25
26 bool
27 Simple_music_iterator::ok ()const
28 {
29   return last_processed_mom_ < music_length_mom ();
30 }
31
32 /*
33   TODO: remove last_processed_mom_, and the complete shit.  We should
34   only process a simple-music once, and that is at its start.
35
36   Engravers can detect and request the end-moments to be processed as
37   well.
38
39 */
40 Moment
41 Simple_music_iterator::pending_moment ()const
42 {
43   if (last_processed_mom_ < Moment (0))
44     return Moment (0);
45   else
46     return music_length_mom ();
47 }
48
49 void
50 Simple_music_iterator::skip (Moment m)
51 {
52   /*
53     docme??!!
54
55     uncommented because setting MUSIC_L_ = 0 causes core dumps with
56     grace notes.  */
57   
58   //  music_l_ = 0;
59   
60   last_processed_mom_ = m;
61 }
62
63 void
64 Simple_music_iterator::process (Moment m)
65 {
66   /*
67   don't do try_music (), since it would make the function useless for
68   base classes */
69
70   skip (m);
71 }
72
73 IMPLEMENT_CTOR_CALLBACK (Simple_music_iterator);