]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/context-def.hh
dd7045015b60c2d2939f91c3e6a3d677e4106256
[lilypond.git] / lily / include / context-def.hh
1 /*
2   context-def.hh -- declare Context_def
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2000--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef CONTEXT_DEF_HH
10 #define CONTEXT_DEF_HH
11
12 #include "std-vector.hh"
13 #include "lily-proto.hh"
14 #include "smobs.hh"
15 #include "input.hh"
16
17 /*
18   The definition of a interpretation context as given in the
19   input. The lists are stored in order of definition.
20 */
21 struct Context_def
22 {
23 private:
24   /*
25     these lists store the definition, in opposite order of entry
26   */
27   SCM translator_mods_;
28   SCM accept_mods_;
29   SCM property_ops_;
30   SCM description_;
31   SCM context_name_;
32   SCM context_aliases_;
33   SCM translator_group_type_;
34   SCM default_child_;
35   SCM input_location_;
36 public:
37   Input *origin () const;
38   void add_context_mod (SCM);
39   SCM get_default_child (SCM user_mods) const;
40   SCM get_context_name () const { return context_name_; }
41   SCM get_accepted (SCM user_mods) const;
42   SCM get_property_ops () const { return property_ops_; }
43   SCM get_translator_names (SCM) const;
44   SCM get_translator_group_type () const { return translator_group_type_; }
45   void set_acceptor (SCM accepts, bool add);
46
47   VIRTUAL_COPY_CONSTRUCTOR(Context_def, Context_def);
48
49   vector<Context_def*> path_to_acceptable_context (SCM type_string,
50                                                       Output_def *) const;
51   Context *instantiate (SCM extra_ops, Object_key const *);
52
53   SCM to_alist () const;
54   static SCM make_scm ();
55
56   void apply_default_property_operations (Context *);
57
58 private:
59   DECLARE_SMOBS (Context_def, foo);
60   Context_def ();
61   Context_def (Context_def const &);
62 };
63
64 DECLARE_UNSMOB (Context_def, context_def);
65
66 #endif /* CONTEXT_DEF_HH */
67