2 pointer-group-interface.cc -- implement Pointer_group_interface
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 #include "pointer-group-interface.hh"
11 #include "lily-proto.hh"
13 #include "grob-array.hh"
17 Pointer_group_interface::count (Grob
*me
, SCM sym
)
19 Grob_array
*arr
= unsmob_grob_array (me
->internal_get_object (sym
));
20 return arr
? arr
->size () : 0;
24 Pointer_group_interface::add_grob (Grob
*me
, SCM sym
, SCM p
)
26 add_grob (me
, sym
, unsmob_grob (p
));
30 Pointer_group_interface::set_ordered (Grob
*me
, SCM sym
, bool ordered
)
32 Grob_array
*arr
= get_grob_array (me
, sym
);
33 arr
->set_ordered (ordered
);
37 Pointer_group_interface::get_grob_array (Grob
*me
, SCM sym
)
39 SCM scm_arr
= me
->internal_get_object (sym
);
40 Grob_array
*arr
= unsmob_grob_array (scm_arr
);
43 scm_arr
= Grob_array::make_array ();
44 arr
= unsmob_grob_array (scm_arr
);
45 me
->set_object (sym
, scm_arr
);
51 Pointer_group_interface::add_grob (Grob
*me
, SCM sym
, Grob
*p
)
53 Grob_array
*arr
= get_grob_array (me
, sym
);
58 Pointer_group_interface::add_unordered_grob (Grob
*me
, SCM sym
, Grob
*p
)
60 Grob_array
*arr
= get_grob_array (me
, sym
);
62 arr
->set_ordered (false);
65 static vector
<Grob
*> empty_array
;
68 ly_scm2link_array (SCM x
)
70 Grob_array
*arr
= unsmob_grob_array (x
);
71 return arr
? arr
->array () : empty_array
;
75 internal_extract_grob_array (Grob
const *elt
, SCM symbol
)
77 return ly_scm2link_array (elt
->internal_get_object (symbol
));
81 internal_extract_item_array (Grob
const *elt
, SCM symbol
)
83 Grob_array
*arr
= unsmob_grob_array (elt
->internal_get_object (symbol
));
85 for (vsize i
= 0; arr
&& i
< arr
->size (); i
++)
86 items
.push_back (arr
->item (i
));