2 virtual-methods.hh -- declare macros for our do-it-yourself RTTI
4 source file of the Flower Library
6 (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #ifndef VIRTUAL_METHODS_HH
10 #define VIRTUAL_METHODS_HH
14 #define classname(class_ptr) demangle_classname (typeid (* (class_ptr)))
17 demangle_classname (std::type_info const &);
19 /* Virtual copy constructor. Make up for C++'s lack of a standard
20 factory or clone () function. Uses a typeof hack. Usage:
24 VIRTUAL_COPY_CONSTRUCTOR (Baseclass, Foo);
27 #define VIRTUAL_COPY_CONSTRUCTOR(Base, name) \
28 virtual Base *clone () const \
30 return new name (*this); \
33 #endif /* VIRTUAL_METHODS_HH */