Allow for nested properties in list form when using \override.
[lilypond.git] / lily / unfolded-repeat-iterator.cc
blob46a8bfd0475b369559eb2191efa29f124c0ca98f
1 /*
2 unfolded-repeat-iterator.cc -- implement Unfolded_repeat_iterator
4 source file of the GNU LilyPond music typesetter
6 (c) 2002--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "music.hh"
10 #include "sequential-iterator.hh"
11 #include "context.hh"
13 class Unfolded_repeat_iterator : public Sequential_iterator
15 public:
16 DECLARE_SCHEME_CALLBACK (constructor, ());
17 protected:
18 virtual SCM get_music_list () const;
21 SCM
22 Unfolded_repeat_iterator::get_music_list () const
24 SCM l = SCM_EOL;
25 SCM *tail = &l;
27 SCM body = get_music ()->get_property ("element");
28 SCM alts = get_music ()->get_property ("elements");
29 int alt_count = scm_ilength (alts);
30 int rep_count = scm_to_int (get_music ()->get_property ("repeat-count"));
32 for (int i = 0; i < rep_count; i++)
34 if (unsmob_music (body))
35 *tail = scm_cons (body, SCM_EOL);
37 tail = SCM_CDRLOC (*tail);
39 if (alt_count)
41 *tail = scm_cons (scm_car (alts), SCM_EOL);
42 tail = SCM_CDRLOC (*tail);
43 if (i >= rep_count - alt_count)
45 alts = scm_cdr (alts);
49 return l;
52 IMPLEMENT_CTOR_CALLBACK (Unfolded_repeat_iterator);