/home/ntakagi/work/STLport-5.1.5/stlport/stl/_stdexcept_base.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1996,1997
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Copyright (c) 1999
00006  * Boris Fomitchev
00007  *
00008  * This material is provided "as is", with absolutely no warranty expressed
00009  * or implied. Any use is at your own risk.
00010  *
00011  * Permission to use or copy this software for any purpose is hereby granted
00012  * without fee, provided the above notices are retained on all copies.
00013  * Permission to modify the code and to distribute modified code is granted,
00014  * provided the above notices are retained, and a notice that the code was
00015  * modified is included with the above copyright notice.
00016  *
00017  */
00018 
00019 #ifndef _STLP_INTERNAL_STDEXCEPT_BASE
00020 #define _STLP_INTERNAL_STDEXCEPT_BASE
00021 
00022 #if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE)
00023 
00024 #  ifndef _STLP_INTERNAL_EXCEPTION
00025 #    include <stl/_exception.h>
00026 #  endif
00027 
00028 #  if defined(_STLP_USE_EXCEPTIONS) || \
00029     !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32))
00030 
00031 #    ifndef _STLP_INTERNAL_CSTRING
00032 #      include <stl/_cstring.h>
00033 #    endif
00034 
00035 #    ifndef _STLP_STRING_FWD_H
00036 #      include <stl/_string_fwd.h>
00037 #    endif
00038 
00039 #    ifndef _STLP_USE_NO_IOSTREAMS
00040 #      define _STLP_OWN_STDEXCEPT 1
00041 #    endif
00042 
00043 _STLP_BEGIN_NAMESPACE
00044 
00045 /* We disable the 4275 warning for
00046  *  - WinCE where there are only static version of the native C++ runtime.
00047  *  - The MSVC compilers when the STLport user wants to make an STLport dll linked to
00048  *    the static C++ native runtime. In this case the std::exception base class is no more
00049  *    exported from native dll but is used as a base class for the exported __Named_exception
00050  *    class.
00051  */
00052 #    if defined (_STLP_WCE_NET) || \
00053         defined (_STLP_USE_DYNAMIC_LIB) && defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
00054 #      define _STLP_DO_WARNING_POP
00055 #      pragma warning (push)
00056 #      pragma warning (disable: 4275) // Non dll interface class 'exception' used as base
00057                                       // for dll-interface class '__Named_exception'
00058 #    endif
00059 
00060 #    if !defined (_STLP_NO_EXCEPTION_HEADER)
00061 #      if !defined (_STLP_EXCEPTION_BASE) && !defined (_STLP_BROKEN_EXCEPTION_CLASS) && \
00062            defined (_STLP_USE_NAMESPACES) &&  defined (_STLP_USE_OWN_NAMESPACE)
00063 using _STLP_VENDOR_EXCEPT_STD::exception;
00064 #      endif
00065 #    endif
00066 #    define _STLP_EXCEPTION_BASE exception
00067 
00068 class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE {
00069 public:
00070   __Named_exception(const string& __str)
00071 #    ifndef _STLP_USE_NO_IOSTREAMS
00072     ;
00073   const char* what() const _STLP_NOTHROW_INHERENTLY;
00074   ~__Named_exception() _STLP_NOTHROW_INHERENTLY;
00075 #    else
00076   {
00077 #      if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
00078     strncpy(_M_name, _STLP_PRIV __get_c_string(__str), _S_bufsize);
00079     _M_name[_S_bufsize - 1] = '\0';
00080 #      else
00081     strncpy_s(_STLP_ARRAY_AND_SIZE(_M_name), _STLP_PRIV __get_c_string(__str), _TRUNCATE);
00082 #      endif
00083   }
00084   const char* what() const _STLP_NOTHROW_INHERENTLY { return _M_name; }
00085 #    endif
00086 
00087 private:
00088   enum { _S_bufsize = 256 };
00089   char _M_name[_S_bufsize];
00090 };
00091 
00092 #    if defined (_STLP_DO_WARNING_POP)
00093 #      pragma warning (pop)
00094 #      undef _STLP_DO_WARNING_POP
00095 #    endif
00096 
00097 _STLP_END_NAMESPACE
00098 
00099 #  endif /* Not o32, and no exceptions */
00100 #endif /* _STLP_STDEXCEPT_SEEN */
00101 
00102 #endif /* _STLP_INTERNAL_STDEXCEPT_BASE */



Generated on Mon Mar 10 15:32:36 2008 by  doxygen 1.5.1