| // RTTI support for -*- C++ -*- |
| // Copyright (C) 1994, 1995, 1996 Free Software Foundation |
| |
| #ifndef __TYPEINFO__ |
| #define __TYPEINFO__ |
| |
| #include <exception> |
| |
| extern "C++" { |
| |
| #ifdef __HONOR_STD |
| namespace std { |
| #endif |
| |
| class type_info { |
| private: |
| // assigning type_info is not supported. made private. |
| type_info& operator= (const type_info&); |
| type_info (const type_info&); |
| |
| protected: |
| type_info (const char *n): _name (n) { } |
| |
| const char *_name; |
| |
| public: |
| // destructor |
| virtual ~type_info (); |
| |
| bool before (const type_info& arg) const; |
| const char* name () const |
| { return _name; } |
| bool operator== (const type_info& arg) const; |
| bool operator!= (const type_info& arg) const; |
| }; |
| |
| // We can't rely on common symbols being shared between translation units |
| // under Windows. Sigh. |
| |
| #ifndef _WIN32 |
| inline bool type_info:: |
| operator== (const type_info& arg) const |
| { |
| return &arg == this; |
| } |
| |
| inline bool type_info:: |
| operator!= (const type_info& arg) const |
| { |
| return &arg != this; |
| } |
| #endif |
| |
| class bad_cast : public exception { |
| public: |
| bad_cast() { } |
| virtual ~bad_cast() { } |
| }; |
| |
| class bad_typeid : public exception { |
| public: |
| bad_typeid () { } |
| virtual ~bad_typeid () { } |
| }; |
| |
| #ifdef __HONOR_STD |
| } // namespace std |
| #endif |
| |
| } // extern "C++" |
| #endif |