]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/group-interface.hh
* Another grand 2003 update.
[lilypond.git] / lily / include / group-interface.hh
index 509fcdf25b8783cf98acb5499a6a57e4c907f56a..3327c0a8d84b91176d6213bff8f35c032f3f8ad0 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1999--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
 #include "lily-proto.hh"
 #include "string.hh"
 #include "lily-guile.hh"
-#include "smobs.hh"
-
-/*
-  rename to list interface?
- */
 
+#include "grob.hh"
 /**
    Look at Score element ELT as thing which has a list property called
-   NAME_. Normally the list would contain Score_elements, but
+   NAME_. Normally the list would contain Grobs, but
    sometimes it can be different things.
+
+   todo: reename as list_interface?
 */
+
 struct Group_interface
 {
-  Score_element * elt_l_;
-  String name_;
 public:
-  Group_interface (Score_element const*);
-  Group_interface (Score_element const*, String);
-  int count ();
-  void add_thing (SCM);
-  bool has_interface_b ();
-  void set_interface ();
-  void add_element (Score_element*);
+  static int count (Grob*  , String);
+  static void add_thing (Grob*, SCM, SCM);
+  static void add_thing (Grob*, String nm, SCM);
 };
 
-Group_interface group (Score_element*);
-Group_interface group (Score_element*, String);
+struct Pointer_group_interface : public Group_interface {
+public:
+  static void add_grob (Grob*, SCM nm, Grob*e);
+};
 
-/** 
-  Put all score elements of ELT's property called NAME into an array,
-  and return it.  */
 template<class T>
 Link_array<T>
-Group_interface__extract_elements (Score_element const *elt, T *, String name)
+Pointer_group_interface__extract_grobs (Grob const *elt, T *, const char* name)
 {
   Link_array<T> arr;
 
-  for (SCM s = elt->get_elt_property (name); gh_pair_p (s); s = gh_cdr (s))
+  for (SCM s = elt->get_grob_property (name); gh_pair_p (s); s = gh_cdr (s))
     {
       SCM e = gh_car (s);
-      assert (SMOB_IS_TYPE_B(Score_element,e));
-      Score_element* se = SMOB_TO_TYPE(Score_element, e);
-      arr.push (dynamic_cast<T*> (se));
+      arr.push (dynamic_cast<T*> (unsmob_grob (e)));
     }
 
   arr.reverse ();