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"
20 Conceptually a music-iterator operates on a queue of musical events
21 that are pending. This queue does not actually exist, but it is a
22 way of viewing and traversing music-expressions.
25 ok () -- events left ?
27 pending_mom () -- time tag of the next event to be processed.
29 process (M) -- process all at M (Precondition: no events exist before
32 * This removes all events at M from the pending queue.
34 * Typically this reports the music to an interpretation context,
35 thus changing the state of the interpretation context.
37 get_music (M) -- return all events starting at M (pre: no events
40 skip (M) -- remove all events at M from the pending queue.
46 VIRTUAL_COPY_CONS (Music_iterator);
49 Music_iterator (Music_iterator const&);
50 virtual ~Music_iterator ();
53 Do the reporting. Will try MUSIC_L_ in its own translator first,
54 then its children. Returns the iterator that succeeded
56 Music_iterator * try_music (Music *) const;
59 The translation unit that we this iterator is reporting to now.
61 Translator_group* report_to_l () const;
63 void set_translator (Translator_group*);
65 /** Get an iterator matching the type of MUS, and use TRANS to find
66 an accompanying translation unit
68 static Music_iterator* static_get_iterator_p (Music * mus);
69 void init_translator (Music *, Translator_group *);
71 virtual Moment pending_moment () const;
72 virtual bool ok () const;
73 virtual SCM get_music (Moment until)const;
74 virtual void process (Moment until);
75 virtual void skip (Moment until);
78 Construct sub-iterators, and set the translator to
81 virtual void construct_children ();
87 Get an iterator for MUS, inheriting the translation unit from THIS.
89 Music_iterator* get_iterator_p (Music *) const;
91 virtual Music_iterator* try_music_in_children (Music *) const;
94 Interpretation_context_handle handle_;
97 #endif // MUSIC_ITERATOR_HH