]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/unfolded-repeat-iterator.hh
release: 1.3.107
[lilypond.git] / lily / include / unfolded-repeat-iterator.hh
1 /*   
2   unfolded-repeat-iterator.hh -- declare Unfolded_repeat_iterator
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #ifndef UNFOLDED_REPEAT_ITERATOR_HH
11 #define UNFOLDED_REPEAT_ITERATOR_HH
12
13 #include "music-iterator.hh"
14
15 /**
16    Iterate repeats.  First do body, then alternatives one by one,
17    optionally interspersed by the body.
18  */
19 class Unfolded_repeat_iterator : public Music_iterator
20 {
21   void add_repeat_command (SCM);
22
23 public:
24   VIRTUAL_COPY_CONS (Music_iterator);
25   /**
26      How often have we done the body (assuming bodies are interspersed.)?
27    */
28   int done_count_;
29   static SCM constructor_cxx_function; 
30
31   /*
32     are we now busy doing the body?
33
34    */
35   bool do_main_b_;
36
37   /*
38     are we doing volta's?
39    */
40   bool volta_b_;
41
42   /** How far have we progressed into the repeat.
43       This excludes the elt currently being iterated.
44   */
45   Moment here_mom_;
46   int alternative_count_i_;
47   Music_iterator * current_iter_p_;
48   
49   /// pointer to the alternative that will be processed next.
50   SCM alternative_cons_;
51   ~Unfolded_repeat_iterator();
52   Unfolded_repeat_iterator ();
53
54 protected:  
55   virtual void construct_children ();
56   virtual Moment pending_moment () const;
57   virtual void process (Moment);
58   virtual Music_iterator *try_music_in_children (Music *) const;
59   virtual void skip (Moment);
60   virtual SCM get_music (Moment) const;
61   
62   virtual bool ok () const;
63   virtual void next_element (bool side_effect);
64 };
65
66 class Volta_repeat_iterator : public Unfolded_repeat_iterator
67 {
68 public:
69   Volta_repeat_iterator ();
70   static  SCM constructor_cxx_function;
71   VIRTUAL_COPY_CONS(Music_iterator);
72 };
73
74
75 #endif /* UNFOLDED_REPEAT_ITERATOR_HH */
76