]> git.donarmstrong.com Git - lilypond.git/blob - lily/simple-music-iterator.cc
Web-ja: update introduction
[lilypond.git] / lily / simple-music-iterator.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2000--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "simple-music-iterator.hh"
21
22 #include "music.hh"
23 #include "input.hh"
24
25 Simple_music_iterator::Simple_music_iterator ()
26   : Music_iterator ()
27 {
28   last_processed_mom_ = -1;
29 }
30
31 bool
32 Simple_music_iterator::ok ()const
33 {
34   return last_processed_mom_ < music_get_length ();
35 }
36
37 /*
38   TODO: remove last_processed_mom_, and the complete shit.  We should
39   only process a simple-music once, and that is at its start.
40
41   Engravers can detect and event the end-moments to be processed as
42   well.
43 */
44 Moment
45 Simple_music_iterator::pending_moment ()const
46 {
47   if (last_processed_mom_ < Moment (0))
48     return Moment (0);
49   else
50     return music_get_length ();
51 }
52
53 void
54 Simple_music_iterator::process (Moment m)
55 {
56   /*
57     don't do report_event (), since it would make the function useless for
58     base classes
59   */
60
61   last_processed_mom_ = m;
62 }
63
64 IMPLEMENT_CTOR_CALLBACK (Simple_music_iterator);