]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/sequential-iterator.hh
Run grand-replace (issue 3765)
[lilypond.git] / lily / include / sequential-iterator.hh
index 382a3211fef38d152a78ded71f95cc6dc09565a6..6c09ae3d09b0df9147c3de188fbc87f7c00639d6 100644 (file)
@@ -1,9 +1,20 @@
-/*   
-  sequential-iterator.hh -- declare Sequential_iterator
+/*
+  This file is part of LilyPond, the GNU music typesetter.
+
+  Copyright (C) 2002--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+  LilyPond is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
 
-  source file of the GNU LilyPond music typesetter
+  LilyPond is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-  (c)  2002--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  You should have received a copy of the GNU General Public License
+  along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef SEQUENTIAL_ITERATOR_HH
 #include "music-iterator.hh"
 #include "protected-scm.hh"
 
-/*
-
-  This is a lookahead list for grace notes.
-
-   {  ... X \grace Y  Z ... }
-
-   normally, the ending of X is the start of Z. In case of a grace
-   note, we take off a little at the end of X. What is stored: START
-   (start point of X), LENGTH (length of X), GRACE_START (start_music
-   of Y), and the next fixup element.
-
-  This is also done for nested musics, i.e.
-
-  voiceA = \notes { \grace b16 c'2 }
-  voiceB = \notes { c'2 \voiceA }
-
-  the iterator for voiceB will contain a fixup entry with (START=0/1,
-  LENGTH=2/1, GRACE_START=(0G-1/16) ) 
-   
-  Graces at the start of a sequential music iterator are handled
-  by initting here_mom_ with Music::start_music (); no fixups are needed.
-
-*/
-struct Grace_fixup 
-{
-  Moment start_;
-  Moment length_;
-
-  Rational grace_start_;  
-  Grace_fixup *next_;
-};
-
 /** Sequential_music iteration: walk each element in turn, and
-  construct an iterator for every element.
-  
- */
-class Sequential_iterator :  public Music_iterator
+    construct an iterator for every element.
+*/
+class Sequential_iterator : public Music_iterator
 {
 public:
-  Grace_fixup * grace_fixups_;
-  
-  VIRTUAL_COPY_CONS (Music_iterator);
-  DECLARE_SCHEME_CALLBACK(constructor, ());
+  DECLARE_SCHEME_CALLBACK (constructor, ());
+  DECLARE_CLASSNAME (Sequential_iterator);
   Sequential_iterator ();
-  Sequential_iterator (Sequential_iterator const&);
+  Sequential_iterator (Sequential_iterator const &);
+  virtual void derived_substitute (Context *f, Context *t);
+
   virtual void derived_mark () const;
 
   virtual void construct_children ();
   virtual Moment pending_moment () const;
-  virtual void do_quit(); 
+  virtual void do_quit ();
   virtual bool ok () const;
-  virtual void skip (Moment);
-  virtual SCM get_pending_events (Moment)const;
 
 protected:
   virtual void process (Moment);
-  virtual Music_iterator *try_music_in_children (Music *) const;
   virtual bool run_always () const;
+
 protected:
+  Music_iterator *iter_;
+
+  virtual SCM get_music_list () const;
+  virtual void next_element (bool side_effect);
+
+  Grace_fixup *get_grace_fixup () const;
+  void next_grace_fixup ();
+
+private:
+  Moment last_mom_;
   Moment here_mom_;
-  Music_iterator * iter_;
-  SCM  list_;
   SCM cursor_;
-  
-  virtual void next_element (bool side_effect);
-  virtual void descend_to_child ();
-  virtual SCM get_music_list ()const;
+  Grace_fixup *grace_fixups_;
 };
 
 #endif /* SEQUENTIAL_ITERATOR_HH */