]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/type-swallow-translator.hh
2d63ee49675b25280950bea830066d56a59a6850
[lilypond.git] / lily / include / type-swallow-translator.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1997--2009 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 TYPESWALLOW_TRANSLATOR_HH
21 #define TYPESWALLOW_TRANSLATOR_HH
22
23 #include "translator.hh"
24
25 /** eat a certain type of event
26     (Duh, it's good for your skin)
27 */
28 class Type_swallow_translator : public Translator
29 {
30 protected:
31   string swallow_string_;
32   bool try_music (Music *);
33 public:
34   VIRTUAL_COPY_CONS (Translator);
35 };
36
37 #define DECLARE_EVENT_SWALLOWER(TYPE)                                   \
38   struct TYPE ## _swallow_translator : public Type_swallow_translator   \
39   {                                                                     \
40     TRANSLATOR_DECLARATIONS (TYPE ## _swallow_translator);              \
41   };                                                                    \
42   TYPE ## _swallow_translator ::TYPE ## _swallow_translator ()          \
43   {                                                                     \
44     swallow_string_ = #TYPE;                                            \
45   }                                                                     \
46   ADD_TRANSLATOR (TYPE ## _swallow_translator,                          \
47                   "Swallow events of " #TYPE " type.",                  \
48                   "",                                                   \
49                   "general-music",                                      \
50                   "",                                                   \
51                   "",                                                   \
52                   "");
53
54 #endif // TYPESWALLOW_TRANSLATOR_HH
55