]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/group-interface.hh
fc832a5426096ea626327977638eeb79eccf4db2
[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 /*
32   template<class T>
33   Link_array<T> Group_interface__extract_elements (T *, String name);
34 */
35 template<class T>
36 Link_array<T>
37 Group_interface__extract_elements (Score_element const *elt, T *, String name)
38 {
39   Link_array<T> arr;
40
41   for (SCM s = elt->get_elt_property (name); gh_pair_p (s); s = gh_cdr (s))
42     {
43       SCM e = gh_car (s);
44       assert (SMOB_IS_TYPE_B(Score_element,e));
45       Score_element* se = SMOB_TO_TYPE(Score_element, e);
46       arr.push (dynamic_cast<T*> (se));
47     }
48
49   arr.reverse ();
50   return arr;
51 }
52
53
54
55
56 #endif /* GROUP_INTERFACE_HH */
57