/project/jni/stlport/stlport/stl/_stdexcept_base.h

https://github.com/aichunyu/FFPlayer · C Header · 102 lines · 61 code · 16 blank · 25 comment · 16 complexity · 6af60b9a0e28334dc457c5943e133ce7 MD5 · raw file

  1. /*
  2. * Copyright (c) 1996,1997
  3. * Silicon Graphics Computer Systems, Inc.
  4. *
  5. * Copyright (c) 1999
  6. * Boris Fomitchev
  7. *
  8. * This material is provided "as is", with absolutely no warranty expressed
  9. * or implied. Any use is at your own risk.
  10. *
  11. * Permission to use or copy this software for any purpose is hereby granted
  12. * without fee, provided the above notices are retained on all copies.
  13. * Permission to modify the code and to distribute modified code is granted,
  14. * provided the above notices are retained, and a notice that the code was
  15. * modified is included with the above copyright notice.
  16. *
  17. */
  18. #ifndef _STLP_INTERNAL_STDEXCEPT_BASE
  19. #define _STLP_INTERNAL_STDEXCEPT_BASE
  20. #if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE)
  21. # ifndef _STLP_INTERNAL_EXCEPTION
  22. # include <stl/_exception.h>
  23. # endif
  24. # if defined(_STLP_USE_EXCEPTIONS) || \
  25. !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32))
  26. # ifndef _STLP_INTERNAL_CSTRING
  27. # include <stl/_cstring.h>
  28. # endif
  29. # ifndef _STLP_STRING_FWD_H
  30. # include <stl/_string_fwd.h>
  31. # endif
  32. # ifndef _STLP_USE_NO_IOSTREAMS
  33. # define _STLP_OWN_STDEXCEPT 1
  34. # endif
  35. _STLP_BEGIN_NAMESPACE
  36. /* We disable the 4275 warning for
  37. * - WinCE where there are only static version of the native C++ runtime.
  38. * - The MSVC compilers when the STLport user wants to make an STLport dll linked to
  39. * the static C++ native runtime. In this case the std::exception base class is no more
  40. * exported from native dll but is used as a base class for the exported __Named_exception
  41. * class.
  42. */
  43. # if defined (_STLP_WCE_NET) || \
  44. defined (_STLP_USE_DYNAMIC_LIB) && defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
  45. # define _STLP_DO_WARNING_POP
  46. # pragma warning (push)
  47. # pragma warning (disable: 4275) // Non dll interface class 'exception' used as base
  48. // for dll-interface class '__Named_exception'
  49. # endif
  50. # if !defined (_STLP_NO_EXCEPTION_HEADER)
  51. # if !defined (_STLP_EXCEPTION_BASE) && !defined (_STLP_BROKEN_EXCEPTION_CLASS) && \
  52. defined (_STLP_USE_NAMESPACES) && defined (_STLP_USE_OWN_NAMESPACE)
  53. using _STLP_VENDOR_EXCEPT_STD::exception;
  54. # endif
  55. # endif
  56. # define _STLP_EXCEPTION_BASE exception
  57. class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE {
  58. public:
  59. __Named_exception(const string& __str)
  60. # ifndef _STLP_USE_NO_IOSTREAMS
  61. ;
  62. const char* what() const _STLP_NOTHROW_INHERENTLY;
  63. ~__Named_exception() _STLP_NOTHROW_INHERENTLY;
  64. # else
  65. {
  66. # if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
  67. strncpy(_M_name, _STLP_PRIV __get_c_string(__str), _S_bufsize);
  68. _M_name[_S_bufsize - 1] = '\0';
  69. # else
  70. strncpy_s(_STLP_ARRAY_AND_SIZE(_M_name), _STLP_PRIV __get_c_string(__str), _TRUNCATE);
  71. # endif
  72. }
  73. const char* what() const _STLP_NOTHROW_INHERENTLY { return _M_name; }
  74. # endif
  75. private:
  76. enum { _S_bufsize = 256 };
  77. char _M_name[_S_bufsize];
  78. };
  79. # if defined (_STLP_DO_WARNING_POP)
  80. # pragma warning (pop)
  81. # undef _STLP_DO_WARNING_POP
  82. # endif
  83. _STLP_END_NAMESPACE
  84. # endif /* Not o32, and no exceptions */
  85. #endif /* _STLP_STDEXCEPT_SEEN */
  86. #endif /* _STLP_INTERNAL_STDEXCEPT_BASE */