]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/virtual-methods.hh
(parse_symbol_list): Bugfix.
[lilypond.git] / flower / include / virtual-methods.hh
1 /*
2   virtual-methods.hh -- declare macros for our do-it-yourself RTTI
3
4   source file of the Flower Library
5
6   (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #ifndef VIRTUAL_METHODS_HH
10 #define VIRTUAL_METHODS_HH
11
12 #include <typeinfo>
13
14 #define classname(class_ptr) demangle_classname (typeid (* (class_ptr)))
15
16 char const *
17 demangle_classname (std::type_info const &);
18
19 /* Virtual copy constructor.  Make up for C++'s lack of a standard
20    factory or clone () function.  Uses a typeof hack.  Usage:
21
22    class Foo : Baseclass
23    {
24    VIRTUAL_COPY_CONSTRUCTOR (Baseclass, Foo);
25    }; */
26
27 #define VIRTUAL_COPY_CONSTRUCTOR(Base, name)    \
28   virtual Base *clone () const                  \
29   {                                             \
30     return new name (*this);                    \
31   }
32
33 #endif /* VIRTUAL_METHODS_HH */