2 translator.hh -- declare Translator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
14 #include "lily-proto.hh"
15 #include "virtual-methods.hh"
17 #include "dictionary.hh"
22 /** Make some kind of #Element#s from Requests. Elements are made by
23 hierarchically grouped #Translator#s
25 class Translator : public Input {
26 Dictionary<Scalar> properties_dict_;
28 Music_output_def * output_def_l_;
31 bool is_alias_b (String) const;
35 VIRTUAL_COPY_CONS(Translator);
36 Translator (Translator const &);
38 virtual ~Translator ();
40 Translator_group * daddy_trans_l_ ;
45 try to fit the request in this engraver
48 false: not noted, not taken.
50 true: request swallowed. Don't try to put the request elsewhere.
53 bool try_music (Music*);
54 void pre_move_processing();
55 void add_processing ();
56 void creation_processing ();
57 void process_requests();
58 void post_move_processing();
59 void removal_processing();
61 ask daddy for a feature
63 Scalar get_property (String type_str);
64 void set_property (String var_name, Scalar value);
65 Music_output_def *output_def_l () const;
67 virtual Moment now_moment () const;
83 Default: always return false
85 virtual void do_add_processing ();
86 virtual bool do_try_music (Music *req_l);
87 virtual void do_print () const;
88 virtual void do_pre_move_processing(){}
89 virtual void do_post_move_processing(){}
90 virtual void do_process_requests () {}
91 virtual void do_creation_processing() {}
92 virtual void do_removal_processing() {}
97 class Translator_adder
100 static Translator *ctor ()
103 t->type_str_ = classname (t);
106 Translator_adder () {
107 add_constructor (ctor);
112 A macro to automate administration of translators.
114 #define ADD_THIS_TRANSLATOR(c) \
115 Translator_adder<c> _ ## c ## init;
117 typedef Translator *(*Translator_ctor) ();
119 extern Dictionary<Translator*> *global_translator_dict_p;
120 void add_translator (Translator*trans_p);
121 void add_constructor (Translator_ctor ctor);
123 Translator*get_translator_l (String s);
125 #endif // TRANSLATOR_HH