X-Git-Url: http://git.buserror.net/cgi-bin/gitweb.cgi?p=polintos%2Fscott%2Fpriv.git;a=blobdiff_plain;f=include%2Fc%2B%2B%2Fstl%2Fstl%2F_stdexcept_base.h;fp=include%2Fc%2B%2B%2Fstl%2Fstl%2F_stdexcept_base.h;h=3bcd8490536a8ad5ce7bbf8e4f86f9759116a0bf;hp=0000000000000000000000000000000000000000;hb=173d8903eb9d51a4ea7d7fa3e52dc86c9bb6d4f1;hpb=b024710fe2b60cd4a42a8993b61333d6cdb56ca3 diff --git a/include/c++/stl/stl/_stdexcept_base.h b/include/c++/stl/stl/_stdexcept_base.h new file mode 100644 index 0000000..3bcd849 --- /dev/null +++ b/include/c++/stl/stl/_stdexcept_base.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_STDEXCEPT_BASE +#define _STLP_INTERNAL_STDEXCEPT_BASE + +#if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE) + +# ifndef _STLP_INTERNAL_EXCEPTION +# include +# endif + +# if defined(_STLP_USE_EXCEPTIONS) || \ + !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32)) + +# ifndef _STLP_INTERNAL_CSTRING +# include +# endif + +# ifndef _STLP_STRING_FWD_H +# include +# endif + +# ifndef _STLP_USE_NO_IOSTREAMS +# define _STLP_OWN_STDEXCEPT 1 +# endif + +_STLP_BEGIN_NAMESPACE + +/* We disable the 4275 warning for + * - WinCE where there are only static version of the native C++ runtime. + * - The MSVC compilers when the STLport user wants to make an STLport dll linked to + * the static C++ native runtime. In this case the std::exception base class is no more + * exported from native dll but is used as a base class for the exported __Named_exception + * class. + */ +# if defined (_STLP_WCE_NET) || \ + defined (_STLP_USE_DYNAMIC_LIB) && defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) +# define _STLP_DO_WARNING_POP +# pragma warning (push) +# pragma warning (disable: 4275) // Non dll interface class 'exception' used as base + // for dll-interface class '__Named_exception' +# endif + +# if !defined (_STLP_NO_EXCEPTION_HEADER) +# if !defined (_STLP_EXCEPTION_BASE) && !defined (_STLP_BROKEN_EXCEPTION_CLASS) && \ + defined (_STLP_USE_NAMESPACES) && defined (_STLP_USE_OWN_NAMESPACE) +using _STLP_VENDOR_EXCEPT_STD::exception; +# endif +# endif +# define _STLP_EXCEPTION_BASE exception + +class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE { +public: + __Named_exception(const string& __str) +# ifndef _STLP_USE_NO_IOSTREAMS + ; + const char* what() const _STLP_NOTHROW_INHERENTLY; + ~__Named_exception() _STLP_NOTHROW_INHERENTLY; +# else + { +# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS) + strncpy(_M_name, _STLP_PRIV __get_c_string(__str), _S_bufsize); + _M_name[_S_bufsize - 1] = '\0'; +# else + strncpy_s(_STLP_ARRAY_AND_SIZE(_M_name), _STLP_PRIV __get_c_string(__str), _TRUNCATE); +# endif + } + const char* what() const _STLP_NOTHROW_INHERENTLY { return _M_name; } +# endif + +private: + enum { _S_bufsize = 256 }; + char _M_name[_S_bufsize]; +}; + +# if defined (_STLP_DO_WARNING_POP) +# pragma warning (pop) +# undef _STLP_DO_WARNING_POP +# endif + +_STLP_END_NAMESPACE + +# endif /* Not o32, and no exceptions */ +#endif /* _STLP_STDEXCEPT_SEEN */ + +#endif /* _STLP_INTERNAL_STDEXCEPT_BASE */