epoc32/include/tools/stlport/stl/_range_errors.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
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  * Copyright (c) 1999
     3  * Silicon Graphics
     4  *
     5  * Permission to use, copy, modify, distribute and sell this software
     6  * and its documentation for any purpose is hereby granted without fee,
     7  * provided that the above copyright notice appear in all copies and
     8  * that both that copyright notice and this permission notice appear
     9  * in supporting documentation.  Silicon Graphics makes no
    10  * representations about the suitability of this software for any
    11  * purpose.  It is provided "as is" without express or implied warranty.
    12  *
    13  */
    14 
    15 #ifndef _STLP_RANGE_ERRORS_H
    16 #define _STLP_RANGE_ERRORS_H
    17 
    18 // A few places in the STL throw range errors, using standard exception
    19 // classes defined in <stdexcept>.  This header file provides functions
    20 // to throw those exception objects.
    21 
    22 // _STLP_DONT_THROW_RANGE_ERRORS is a hook so that users can disable
    23 // this exception throwing.
    24 #if defined (_STLP_CAN_THROW_RANGE_ERRORS) && defined (_STLP_USE_EXCEPTIONS) && \
    25    !defined (_STLP_DONT_THROW_RANGE_ERRORS)
    26 #  define _STLP_THROW_RANGE_ERRORS
    27 #endif
    28 
    29 // For the STLport iostreams, only declaration here, definition is in the lib
    30 #if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_EXTERN_RANGE_ERRORS)
    31 #  define _STLP_EXTERN_RANGE_ERRORS
    32 #endif
    33 
    34 _STLP_BEGIN_NAMESPACE
    35 void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg);
    36 void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg);
    37 void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg);
    38 void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg);
    39 void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg);
    40 void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg);
    41 _STLP_END_NAMESPACE
    42 
    43 #if !defined (_STLP_EXTERN_RANGE_ERRORS)
    44 
    45 #  if defined(_STLP_THROW_RANGE_ERRORS)
    46 #    ifndef _STLP_INTERNAL_STDEXCEPT
    47 #      include <stl/_stdexcept.h>
    48 #    endif
    49 #    ifndef _STLP_STRING
    50 #      include <string>
    51 #    endif
    52 #    define _STLP_THROW_MSG(ex,msg)  throw ex(string(msg))
    53 #  else
    54 #    if defined (_STLP_RTTI_BUG)
    55 #      define _STLP_THROW_MSG(ex,msg)  TerminateProcess(GetCurrentProcess(), 0)
    56 #    else
    57 #      ifndef _STLP_INTERNAL_CSTDLIB
    58 #        include <stl/_cstdlib.h>
    59 #      endif
    60 #      ifndef _STLP_INTERNAL_CSTDIO
    61 #        include <stl/_cstdio.h>
    62 #      endif
    63 #      define _STLP_THROW_MSG(ex,msg)  puts(msg),_STLP_ABORT()
    64 #    endif
    65 #  endif
    66 
    67 // For mode without library and throwing range errors, include the
    68 // stdexcept header and throw the appropriate exceptions directly.
    69 
    70 _STLP_BEGIN_NAMESPACE
    71 
    72 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg)
    73 { _STLP_THROW_MSG(runtime_error, __msg); }
    74 
    75 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg)
    76 { _STLP_THROW_MSG(range_error, __msg); }
    77 
    78 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg)
    79 { _STLP_THROW_MSG(out_of_range, __msg); }
    80 
    81 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg)
    82 { _STLP_THROW_MSG(length_error, __msg); }
    83 
    84 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg)
    85 { _STLP_THROW_MSG(invalid_argument, __msg); }
    86 
    87 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg)
    88 { _STLP_THROW_MSG(overflow_error, __msg); }
    89 
    90 _STLP_END_NAMESPACE
    91 
    92 #  undef _STLP_THROW_MSG
    93 
    94 #endif /* EXTERN_RANGE_ERRORS */
    95 
    96 #endif /* _STLP_RANGE_ERRORS_H */
    97 
    98 // Local Variables:
    99 // mode:C++
   100 // End: