OSDN Git Service

91th Cygnus<->FSF merge
[pf3gnuchains/gcc-fork.git] / gcc / cp / inc / typeinfo
1 // RTTI support for -*- C++ -*-
2 // Copyright (C) 1994, 1995, 1996 Free Software Foundation
3
4 #ifndef __TYPEINFO__
5 #define __TYPEINFO__
6
7 #include <exception>
8
9 extern "C++" {
10
11 #if 0
12 namespace std {
13 #endif
14
15 class type_info {
16 private:
17   // assigning type_info is not supported.  made private.
18   type_info& operator= (const type_info&);
19   type_info (const type_info&);
20
21 protected:
22   type_info (const char *n): _name (n) { }
23
24   const char *_name;
25
26 public:
27   // destructor
28   virtual ~type_info ();
29     
30   bool before (const type_info& arg) const;
31   const char* name () const
32     { return _name; }
33   bool operator== (const type_info& arg) const;
34   bool operator!= (const type_info& arg) const;
35 };
36
37 // We can't rely on common symbols being shared between translation units
38 // under Windows.  Sigh.
39
40 #ifndef _WIN32
41 inline bool type_info::
42 operator== (const type_info& arg) const
43 {
44   return &arg == this;
45 }
46
47 inline bool type_info::
48 operator!= (const type_info& arg) const
49 {
50   return &arg != this;
51 }
52 #endif
53
54 class bad_cast : public exception {
55 public:
56   bad_cast() { }
57   virtual ~bad_cast() { }
58 };
59
60 class bad_typeid : public exception {
61  public:
62   bad_typeid () { }
63   virtual ~bad_typeid () { }
64 };
65
66 #if 0
67 } // namespace std
68 #endif
69
70 } // extern "C++"
71 #endif