2 music-iterator.hh -- declare Music_iterator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #ifndef MUSIC_ITERATOR_HH
11 #define MUSIC_ITERATOR_HH
13 #include "lily-proto.hh"
16 #include "virtual-methods.hh"
17 #include "interpretation-context-handle.hh"
19 /** Walk through music and deliver music to translation units, synced
20 in time. This class provides both the implementation of the shared
21 code, and the public interface.
23 Derived classes should only have a public constructor.
24 The state of an iterator would be the intersection of the particular music
25 construct with one point in musical time.
30 VIRTUAL_COPY_CONS (Music_iterator);
33 Music_iterator (Music_iterator const&);
34 virtual ~Music_iterator ();
37 Do the reporting. Will try MUSIC_L_ in its own translator first,
38 then its children. Returns the iterator that succeeded
40 Music_iterator * try_music (Music *) const;
43 The translation unit that we this iterator is reporting to now.
45 Translator_group*report_to_l () const;
47 void set_translator (Translator_group*);
49 /** Get an iterator matching the type of MUS, and use TRANS to find
50 an accompanying translation unit
52 static Music_iterator* static_get_iterator_p (Music * mus);
53 void init_translator (Music *, Translator_group *);
55 /// Find the next interesting point in time.
56 virtual Moment next_moment () const;
59 ///Are we finished with this piece of music?
60 virtual bool ok () const;
62 virtual Music* get_music ();
65 ///Report all musical information that occurs between now and UNTIL
66 void process_and_next (Moment until);
69 Construct sub-iterators, and set the translator to
72 virtual void construct_children ();
82 Do the actual printing. This should be overriden in derived classes. It
83 is called by #print#, in the public interface
85 virtual void do_print () const;
88 Find a bottom notation context to deliver requests to.
90 virtual Translator_group* get_req_translator_l ();
93 Get an iterator for MUS, inheriting the translation unit from THIS.
95 Music_iterator* get_iterator_p (Music *) const;
97 /** Do the actual move. This should be overriden in derived
98 classes. It is called by #process_and_next#, the public interface
100 virtual void do_process_and_next (Moment until);
102 virtual Music_iterator* try_music_in_children (Music *) const;
105 Interpretation_context_handle handle_;
108 #endif // MUSIC_ITERATOR_HH