]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/context-def.hh
21af176327ff2e36a2a5ef5a6d13b50c94e25261
[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--2007 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 #include "virtual-methods.hh"
17 #include <set>
18
19
20 /*
21   The definition of a interpretation context as given in the
22   input. The lists are stored in order of definition.
23 */
24 struct Context_def
25 {
26 private:
27   /*
28     these lists store the definition, in opposite order of entry
29   */
30   SCM translator_mods_;
31   SCM accept_mods_;
32   SCM property_ops_;
33   SCM description_;
34   SCM context_name_;
35   SCM context_aliases_;
36   SCM translator_group_type_;
37   SCM default_child_;
38   SCM input_location_;
39 public:
40   Input *origin () const;
41   void add_context_mod (SCM);
42   SCM get_default_child (SCM user_mods) const;
43   SCM get_context_name () const { return context_name_; }
44   SCM get_accepted (SCM user_mods) const;
45   SCM get_property_ops () const { return property_ops_; }
46   SCM get_translator_names (SCM) const;
47   SCM get_translator_group_type () const { return translator_group_type_; }
48   void set_acceptor (SCM accepts, bool add);
49
50   VIRTUAL_COPY_CONSTRUCTOR(Context_def, Context_def);
51
52   vector<Context_def*> path_to_acceptable_context (SCM type_string,
53                                                    Output_def *,
54                                                    SCM) const;
55   vector<Context_def*> internal_path_to_acceptable_context (SCM type_string,
56                                                             Output_def *,
57                                                             SCM,
58                                                             set<const Context_def *> *seen) const;
59   Context *instantiate (SCM extra_ops);
60
61   SCM to_alist () const;
62   static SCM make_scm ();
63
64   void apply_default_property_operations (Context *);
65
66 private:
67   DECLARE_SMOBS (Context_def);
68   Context_def ();
69   Context_def (Context_def const &);
70 };
71
72 DECLARE_UNSMOB (Context_def, context_def);
73
74 #endif /* CONTEXT_DEF_HH */
75