]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/type-swallow-trans.hh
release: 1.1.1
[lilypond.git] / lily / include / type-swallow-trans.hh
1 /*
2   type-swallow-engraver.hh -- declare Type_swallow_translator
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10 #ifndef TYPESWALLOW_GRAV_HH
11 #define TYPESWALLOW_GRAV_HH
12
13 #include "translator.hh"
14
15 /// eat a certain type of request
16 class Type_swallow_translator : public virtual Translator
17 {
18 protected:
19   const type_info * type_;
20   bool do_try_request (Request*);
21 public:
22   DECLARE_MY_RUNTIME_TYPEINFO;
23   TRANSLATOR_CLONE(Type_swallow_translator);
24   Type_swallow_translator ();
25 };
26
27 #define DECLARE_REQUEST_SWALLOWER(TYPE)  \
28 struct TYPE ## _swallow_translator : public Type_swallow_translator {\
29   TYPE ## _swallow_translator() { \
30     type_ = &typeid (TYPE);\
31   }\
32   DECLARE_MY_RUNTIME_TYPEINFO;\
33   TRANSLATOR_CLONE(TYPE ## _swallow_translator);\
34 };\
35 IMPLEMENT_IS_TYPE_B1(TYPE ## _swallow_translator, Type_swallow_translator);\
36 ADD_THIS_TRANSLATOR(TYPE ## _swallow_translator);\
37
38 #endif // TYPESWALLOW_GRAV_HH
39