]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/pointer-group-interface.hh
e265bedc79d0cf29d72debc26af7c7eaa0d242b2
[lilypond.git] / lily / include / pointer-group-interface.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2005--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef POINTER_GROUP_INTERFACE_HH
21 #define POINTER_GROUP_INTERFACE_HH
22
23 #include "std-vector.hh"
24 #include "lily-proto.hh"
25 #include "lily-guile.hh"
26
27 struct Pointer_group_interface
28 {
29 public:
30   static int count (Grob *, SCM);
31   static void add_grob (Grob *, SCM nm, Grob *e);
32   static void add_grob (Grob *, SCM nm, SCM x);
33   static void add_unordered_grob (Grob *, SCM nm, Grob *);
34   static void set_ordered (Grob *, SCM, bool);
35   static Grob_array *get_grob_array (Grob *, SCM);
36   static Grob *find_grob (Grob *, SCM, bool (*pred) (Grob *));
37 };
38
39 vector<Grob *> const &internal_extract_grob_array (Grob const *elt, SCM symbol);
40 vector<Item *> internal_extract_item_array (Grob const *elt, SCM symbol);
41
42 #define extract_grob_array(x, prop) internal_extract_grob_array (x, ly_symbol2scm (prop))
43 #define extract_item_array(x, prop) internal_extract_item_array (x, ly_symbol2scm (prop))
44
45 /*
46   This is dubious coding style, but lets not risk that we change the
47   representation of grob sets again.
48 */
49 #define extract_grob_set(grob, prop, set)                               \
50   vector<Grob*> const &set (internal_extract_grob_array (grob, ly_symbol2scm (prop)))
51 #define extract_item_set(grob, prop, set)                               \
52   vector<Item*> set (internal_extract_item_array (grob, ly_symbol2scm (prop)))
53
54 #endif /* POINTER_GROUP_INTERFACE_HH */
55