]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/group-interface.hh
release: 1.3.25
[lilypond.git] / lily / include / group-interface.hh
1 /*   
2   group-interface.hh -- declare Group_interface
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #ifndef GROUP_INTERFACE_HH
11 #define GROUP_INTERFACE_HH
12
13 #include "lily-proto.hh"
14 #include "string.hh"
15 #include "lily-guile.hh"
16 #include "smobs.hh"
17
18 struct Group_interface
19 {
20   Score_element * elt_l_;
21   String name_;
22 public:
23   Group_interface (Score_element const*);
24   Group_interface (Score_element const*, String);
25   int count ();
26   bool has_interface_b ();
27   void set_interface ();
28   void add_element (Score_element*);
29 };
30
31 Group_interface group (Score_element*);
32
33 /*
34   template<class T>
35   Link_array<T> Group_interface__extract_elements (T *, String name);
36 */
37 template<class T>
38 Link_array<T>
39 Group_interface__extract_elements (Score_element const *elt, T *, String name)
40 {
41   Link_array<T> arr;
42
43   for (SCM s = elt->get_elt_property (name); gh_pair_p (s); s = gh_cdr (s))
44     {
45       SCM e = gh_car (s);
46       assert (SMOB_IS_TYPE_B(Score_element,e));
47       Score_element* se = SMOB_TO_TYPE(Score_element, e);
48       arr.push (dynamic_cast<T*> (se));
49     }
50
51   arr.reverse ();
52   return arr;
53 }
54
55
56
57
58 #endif /* GROUP_INTERFACE_HH */
59