Fix InstrumentSwitch grob definition.
[lilypond.git] / flower / include / virtual-methods.hh
blob7c97716e4229f573836e28140e6dd1811d363df4
1 /*
2 virtual-methods.hh -- declare macros for our do-it-yourself RTTI
4 source file of the Flower Library
6 (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #ifndef VIRTUAL_METHODS_HH
10 #define VIRTUAL_METHODS_HH
12 #include <typeinfo>
13 using namespace std;
15 #define classname(class_ptr) demangle_classname (typeid (* (class_ptr)))
17 char const *
18 demangle_classname (type_info const &);
22 Virtual copy constructor. Make up for C++'s lack of a standard
23 factory or clone () function. Usage:
25 class Foo : Baseclass
27 VIRTUAL_COPY_CONSTRUCTOR (Baseclass, Foo);
32 #define DECLARE_CLASSNAME(name) \
33 virtual const char *class_name () const { \
34 return #name; \
37 #define VIRTUAL_COPY_CONSTRUCTOR(Base, name) \
38 DECLARE_CLASSNAME(name);\
39 virtual Base *clone () const \
40 { \
41 return new name (*this); \
44 #endif /* VIRTUAL_METHODS_HH */