xref: /haiku/headers/os/support/ClassInfo.h (revision 9522c1e4f21b0292084467c927e4169770db1329)
1 /*
2  * Copyright 2007 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _CLASS_INFO_H
6 #define _CLASS_INFO_H
7 
8 
9 #include <typeinfo>
10 
11 
12 // deprecated, use standard RTTI calls instead
13 // TODO: maybe get rid of this header completely?
14 
15 #define class_name(object) \
16 	((typeid(*(object))).name())
17 #define cast_as(object, class) \
18 	(dynamic_cast<class*>(object))
19 #define is_kind_of(object, class) \
20 	(dynamic_cast<class*>(object) != NULL)
21 #define is_instance_of(object, class) \
22 	(typeid(*(object)) == typeid(class))
23 
24 #endif // _CLASS_INFO_H
25