]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/context-def.hh
Run grand replace for 2015.
[lilypond.git] / lily / include / context-def.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2000--2015 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 CONTEXT_DEF_HH
21 #define CONTEXT_DEF_HH
22
23 #include "std-vector.hh"
24 #include "lily-proto.hh"
25 #include "smobs.hh"
26 #include "input.hh"
27 #include "virtual-methods.hh"
28 #include <set>
29
30 /*
31   The definition of an interpretation context as given in the
32   input. The lists are stored in order of definition.
33 */
34 struct Context_def : public Smob<Context_def>
35 {
36   SCM mark_smob ();
37   int print_smob (SCM, scm_print_state *);
38   static const char type_p_name_[];
39   virtual ~Context_def ();
40 private:
41   /*
42     these lists store the definition, in opposite order of entry
43   */
44   SCM translator_mods_;
45   SCM accept_mods_;
46   SCM property_ops_;
47   SCM description_;
48   SCM context_name_;
49   SCM context_aliases_;
50   SCM translator_group_type_;
51   SCM default_child_;
52   SCM input_location_;
53 public:
54   Input *origin () const;
55   void add_context_mod (SCM);
56   SCM get_default_child (SCM user_mods) const;
57   SCM get_context_name () const { return context_name_; }
58   SCM get_accepted (SCM user_mods) const;
59   SCM get_property_ops () const { return property_ops_; }
60   SCM get_translator_names (SCM) const;
61   SCM get_translator_group_type () const { return translator_group_type_; }
62   void set_acceptor (SCM accepts, bool add);
63   SCM lookup (SCM sym) const;
64   bool is_alias (SCM sym) const;
65
66   VIRTUAL_COPY_CONSTRUCTOR (Context_def, Context_def);
67
68   vector<Context_def *> path_to_acceptable_context (SCM type_string,
69                                                     Output_def *,
70                                                     SCM) const;
71   vector<Context_def *> internal_path_to_acceptable_context (SCM type_string,
72                                                              Output_def *,
73                                                              SCM,
74                                                              set<const Context_def *> *seen) const;
75   Context *instantiate (SCM extra_ops);
76
77   SCM to_alist () const;
78   static SCM make_scm ();
79
80   void apply_default_property_operations (Context *);
81
82 private:
83   Context_def ();
84   Context_def (Context_def const &);
85 };
86
87
88 #endif /* CONTEXT_DEF_HH */