ossrv_pub/typeinfo/inc/stdapis/stlport/typeinfo.h
changeset 0 e4d67989cc36
child 22 ddc455616bd6
child 56 acd3cd4aaceb
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /*
       
     2  * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
       
     3  *
       
     4  * Copyright (c) 1999 
       
     5  * Boris Fomitchev
       
     6  *
       
     7  * This material is provided "as is", with absolutely no warranty expressed
       
     8  * or implied. Any use is at your own risk.
       
     9  *
       
    10  * Permission to use or copy this software for any purpose is hereby granted 
       
    11  * without fee, provided the above notices are retained on all copies.
       
    12  * Permission to modify the code and to distribute modified code is granted,
       
    13  * provided the above notices are retained, and a notice that the code was
       
    14  * modified is included with the above copyright notice.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef _STLP_OLDSTD_typeinfo
       
    19 # define _STLP_OLDSTD_typeinfo
       
    20 
       
    21 # ifndef _STLP_OUTERMOST_HEADER_ID
       
    22 #  define _STLP_OUTERMOST_HEADER_ID 0x874
       
    23 #  include <stl/_prolog.h>
       
    24 # endif
       
    25 
       
    26 # ifndef _STLP_NO_TYPEINFO
       
    27 #ifdef __SYMBIAN32__
       
    28 #  include <exception>
       
    29 _STLP_BEGIN_NAMESPACE
       
    30 #ifdef __WINSCW__
       
    31 class type_info
       
    32 {
       
    33 	const char* tname;
       
    34 public:
       
    35 	bool operator== (const type_info& rhs) const {return static_cast<bool>(strcmp(tname, rhs.tname) == 0);}
       
    36 	bool operator!= (const type_info& rhs) const {return static_cast<bool>(strcmp(tname, rhs.tname) != 0);}
       
    37 	bool before (const type_info& rhs) const {return static_cast<bool>(strcmp(tname, rhs.tname) < 0);}
       
    38 	const char* name () const {return tname;}
       
    39 private:
       
    40 	type_info (const type_info& rhs);               //  not defined
       
    41 	type_info& operator= (const type_info& rhs);    //  not defined
       
    42 };
       
    43 #else
       
    44 #pragma define_type_info
       
    45 class type_info 
       
    46 {
       
    47   public:
       
    48     virtual ~type_info();
       
    49     bool operator==(const type_info&) const;
       
    50     bool operator!=(const type_info&) const;
       
    51     bool before(const type_info&) const;
       
    52     const char* name() const;
       
    53   private:
       
    54     static void operator delete(void*) { /* nothing */ }
       
    55     type_info& operator=(const type_info&);  // Not actually defined
       
    56     type_info(const type_info&);  // Not actually defined
       
    57   private:
       
    58     const char *__type_name;
       
    59   };
       
    60 #endif
       
    61 
       
    62 class bad_cast : public exception 
       
    63   {
       
    64   public:
       
    65     bad_cast() throw() { }
       
    66 	bad_cast(const bad_cast&) throw() {}
       
    67 	bad_cast& operator=(const bad_cast&) throw() {return *this;}
       
    68     virtual ~bad_cast() throw() {}
       
    69 	virtual const char* what() const throw() {return "bad_cast";}
       
    70   };
       
    71   
       
    72 class bad_typeid : public exception 
       
    73   {
       
    74   public:
       
    75     bad_typeid () throw() { }
       
    76 	bad_typeid(const bad_typeid&) throw() {}
       
    77 	bad_typeid& operator=(const bad_typeid&) throw() {return *this;}
       
    78     virtual ~bad_typeid() throw() {}
       
    79 	virtual const char* what() const throw() {return "bad_typeid";}
       
    80   };
       
    81 
       
    82 _STLP_END_NAMESPACE
       
    83 
       
    84 #else
       
    85 #if defined (__GNUC__)
       
    86 # undef _STLP_OLDSTD_typeinfo
       
    87 #  include <typeinfo>
       
    88 # define _STLP_OLDSTD_typeinfo
       
    89 #else
       
    90 #  include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo.h)
       
    91 #endif
       
    92 
       
    93 // if <typeinfo> already included, do not import anything
       
    94 
       
    95 # if defined  (_STLP_USE_OWN_NAMESPACE) && ! (defined (_STLP_TYPEINFO) && !defined(_STLP_NO_NEW_NEW_HEADER))
       
    96 
       
    97 _STLP_BEGIN_NAMESPACE
       
    98 
       
    99 using /*_STLP_VENDOR_EXCEPT_STD */ :: type_info;
       
   100 # if !(defined(__MRC__) || (defined(__SC__) && !defined(__DMC__)))
       
   101 using /* _STLP_VENDOR_EXCEPT_STD */ :: bad_typeid;
       
   102 # endif
       
   103 using /* _STLP_VENDOR_EXCEPT_STD */ :: bad_cast;
       
   104 
       
   105 _STLP_END_NAMESPACE
       
   106 
       
   107 #endif /* _STLP_OWN_NAMESPACE */
       
   108 
       
   109 #endif // __SYMBIAN32__
       
   110 
       
   111 # endif /* _STLP_NO_TYPEINFO */
       
   112 
       
   113 # if (_STLP_OUTERMOST_HEADER_ID == 0x874)
       
   114 #  include <stl/_epilog.h>
       
   115 #  undef _STLP_OUTERMOST_HEADER_ID
       
   116 # endif
       
   117 
       
   118 #endif /* _STLP_OLDSTD_typeinfo */
       
   119