2 music-iterator.hh -- declare Music_iterator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 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.
27 class Music_iterator {
28 Interpretation_context_handle handle_;
31 Music const * music_l_;
35 Do the actual printing. This should be overriden in derived classes. It
36 is called by #print#, in the public interface
38 virtual void do_print() const;
41 Find a bottom notation context to deliver requests to.
43 virtual Translator_group* get_req_translator_l();
46 Get an iterator for MUS, inheriting the translation unit from THIS.
48 Music_iterator* get_iterator_p (Music const*mus) const;
49 void set_translator (Translator_group*);
51 /** Do the actual reporting. This should be overriden in derived
52 classes. It is called by #process_and_next#, the public interface
54 virtual void do_process_and_next (Moment until);
59 The translation unit that we this iterator is reporting to now.
61 Translator_group*report_to_l() const;
64 /** Get an iterator matching the type of MUS, and use TRANS to find
65 an accompanying translation unit
67 static Music_iterator* static_get_iterator_p (Music const* mus,Translator_group* trans);
71 /// Find the next interesting point in time.
72 virtual Moment next_moment() const;
74 ///Are we finished with this piece of music?
75 virtual bool ok() const;
77 virtual ~Music_iterator();
80 ///Report all musical information that occurs between now and UNTIL
81 void process_and_next (Moment until);
84 Construct sub-iterators, and set the translator to
87 virtual void construct_children();
91 #endif // MUSIC_ITERATOR_HH