_typeinfo.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright (c) 1999
  3. * Boris Fomitchev
  4. *
  5. * This material is provided "as is", with absolutely no warranty expressed
  6. * or implied. Any use is at your own risk.
  7. *
  8. * Permission to use or copy this software for any purpose is hereby granted
  9. * without fee, provided the above notices are retained on all copies.
  10. * Permission to modify the code and to distribute modified code is granted,
  11. * provided the above notices are retained, and a notice that the code was
  12. * modified is included with the above copyright notice.
  13. *
  14. */
  15. #ifndef _STLP_INTERNAL_TYPEINFO
  16. #define _STLP_INTERNAL_TYPEINFO
  17. #if !defined (_STLP_NO_TYPEINFO)
  18. # if defined (_STLP_NO_NEW_NEW_HEADER)
  19. # include <typeinfo.h>
  20. # else
  21. # if defined (_STLP_HAS_INCLUDE_NEXT)
  22. # include_next <typeinfo>
  23. # else
  24. # include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo)
  25. # endif
  26. # endif
  27. // We need to import std::exception into _STLP_STD_NAME
  28. # if defined(_STLP_SGX_CONFIG) && !defined(_STLP_INTERNAL_EXCEPTION)
  29. # include <stl/_exception.h>
  30. # endif
  31. # if (defined(_STLP_MSVC) && (_STLP_MSVC >= 1300)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800))
  32. // In .NET, <typeinfo> actually includes <typeinfo.h>
  33. # undef _STLP_OLDSTD_typeinfo
  34. # endif
  35. // if <typeinfo.h> already included, do not import anything
  36. # if defined(_STLP_USE_NAMESPACES) && !defined(_STLP_OLDSTD_typeinfo) && \
  37. (defined(_STLP_VENDOR_GLOBAL_EXCEPT_STD) || \
  38. defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_DEBUG))
  39. # if defined(_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined(_STLP_WCE_NET)
  40. class bad_cast : public exception {};
  41. # endif
  42. _STLP_BEGIN_NAMESPACE
  43. // VC 6 and eVC 4 have type_info in the global namespace
  44. # if (defined(_STLP_MSVC) && (_STLP_MSVC < 1300)) || defined(_STLP_WCE_NET)
  45. using ::type_info;
  46. # else
  47. using _STLP_VENDOR_EXCEPT_STD::type_info;
  48. # endif
  49. # if !defined (__DMC__)
  50. using _STLP_VENDOR_EXCEPT_STD::bad_typeid;
  51. # endif
  52. # if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined (_STLP_WCE_NET)
  53. using ::bad_cast;
  54. # else
  55. using _STLP_VENDOR_EXCEPT_STD::bad_cast;
  56. # endif
  57. _STLP_END_NAMESPACE
  58. # endif
  59. #else
  60. # ifndef _STLP_INTERNAL_EXCEPTION
  61. # include <stl/_exception.h>
  62. # endif
  63. _STLP_BEGIN_NAMESPACE
  64. # if !defined (__DMC__)
  65. struct bad_cast : exception {};
  66. # endif
  67. _STLP_END_NAMESPACE
  68. #endif
  69. #endif