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