epoc32/include/stdapis/stlportv5/stl/_range_errors.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/stdapis/stlport/stl/_range_errors.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     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 
    31 #if defined ( _STLP_OWN_IOSTREAMS  ) && ! defined (_STLP_EXTERN_RANGE_ERRORS) 
    32 #  define _STLP_EXTERN_RANGE_ERRORS
    33 # endif
    34 
    35 #if defined (_STLP_EXTERN_RANGE_ERRORS)
    36 # ifndef _STLP_STDEXCEPT
    37 #  include <stdexcept>
    38 # endif
    39 _STLP_BEGIN_NAMESPACE
    40 void  _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg);
    41 void  _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg);
    42 void  _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg);
    43 void  _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg);
    44 void  _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg);
    45 _STLP_END_NAMESPACE
    46 #else
    47 
    48 #if defined(_STLP_THROW_RANGE_ERRORS)
    49 # ifndef _STLP_STDEXCEPT
    50 #  include <stdexcept>
    51 # endif
    52 # ifndef _STLP_STRING
    53 #  include <string>
    54 # endif
    55 # define _STLP_THROW_MSG(ex,msg)  throw ex(string(msg))
    56 #else
    57 # if defined (_STLP_WINCE)
    58 #  define _STLP_THROW_MSG(ex,msg)  TerminateProcess(GetCurrentProcess(), 0)
    59 # else
    60 #  include <cstdlib>
    61 #  include <cstdio>
    62 # ifdef _STLP_USE_TRAP_LEAVE
    63 #  define _STLP_THROW_MSG(ex,msg) { STDEX_REPORT_EXCEPTION(msg) ; User::Leave(STDEX_##ex); }
    64 #  include <stdexcept>
    65 # else
    66 #  define _STLP_THROW_MSG(ex,msg)  puts(msg),_STLP_ABORT()
    67 # endif
    68 # endif
    69 #endif
    70 
    71 // For wrapper mode and throwing range errors, include the
    72 // stdexcept header and throw the appropriate exceptions directly.
    73 
    74 _STLP_BEGIN_NAMESPACE
    75 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg) { 
    76   _STLP_THROW_MSG(range_error, __msg); 
    77 }
    78 
    79 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg) { 
    80   _STLP_THROW_MSG(out_of_range, __msg); 
    81 }
    82 
    83 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg) { 
    84   _STLP_THROW_MSG(length_error, __msg); 
    85 }
    86 
    87 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg) { 
    88   _STLP_THROW_MSG(invalid_argument, __msg); 
    89 }
    90 
    91 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg) { 
    92   _STLP_THROW_MSG(overflow_error, __msg); 
    93 }
    94 _STLP_END_NAMESPACE
    95 
    96 # undef _STLP_THROW_MSG
    97 
    98 # endif /* EXTERN_RANGE_ERRORS */
    99 
   100 
   101 #endif /* _STLP_RANGE_ERRORS_H */
   102 
   103 // Local Variables:
   104 // mode:C++
   105 // End: