]> git.donarmstrong.com Git - lilypond.git/blob - lily/simple-music-iterator.cc
05fcc293f4211d6c003f0f7387f5ad3f386df3ba
[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--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "simple-music-iterator.hh"
10
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 bool
21 Simple_music_iterator::ok ()const
22 {
23   return last_processed_mom_ < music_get_length ();
24 }
25
26 /*
27   TODO: remove last_processed_mom_, and the complete shit.  We should
28   only process a simple-music once, and that is at its start.
29
30   Engravers can detect and event the end-moments to be processed as
31   well.
32 */
33 Moment
34 Simple_music_iterator::pending_moment ()const
35 {
36   if (last_processed_mom_ < Moment (0))
37     return Moment (0);
38   else
39     return music_get_length ();
40 }
41
42 void
43 Simple_music_iterator::process (Moment m)
44 {
45   /*
46     don't do report_event (), since it would make the function useless for
47     base classes
48   */
49
50   last_processed_mom_ = m;
51 }
52
53 IMPLEMENT_CTOR_CALLBACK (Simple_music_iterator);