epoc32/include/tools/stlport/stl/_range_errors.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/tools/stlport/stl/_range_errors.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,100 @@
     1.4 +/*
     1.5 + * Copyright (c) 1999
     1.6 + * Silicon Graphics
     1.7 + *
     1.8 + * Permission to use, copy, modify, distribute and sell this software
     1.9 + * and its documentation for any purpose is hereby granted without fee,
    1.10 + * provided that the above copyright notice appear in all copies and
    1.11 + * that both that copyright notice and this permission notice appear
    1.12 + * in supporting documentation.  Silicon Graphics makes no
    1.13 + * representations about the suitability of this software for any
    1.14 + * purpose.  It is provided "as is" without express or implied warranty.
    1.15 + *
    1.16 + */
    1.17 +
    1.18 +#ifndef _STLP_RANGE_ERRORS_H
    1.19 +#define _STLP_RANGE_ERRORS_H
    1.20 +
    1.21 +// A few places in the STL throw range errors, using standard exception
    1.22 +// classes defined in <stdexcept>.  This header file provides functions
    1.23 +// to throw those exception objects.
    1.24 +
    1.25 +// _STLP_DONT_THROW_RANGE_ERRORS is a hook so that users can disable
    1.26 +// this exception throwing.
    1.27 +#if defined (_STLP_CAN_THROW_RANGE_ERRORS) && defined (_STLP_USE_EXCEPTIONS) && \
    1.28 +   !defined (_STLP_DONT_THROW_RANGE_ERRORS)
    1.29 +#  define _STLP_THROW_RANGE_ERRORS
    1.30 +#endif
    1.31 +
    1.32 +// For the STLport iostreams, only declaration here, definition is in the lib
    1.33 +#if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_EXTERN_RANGE_ERRORS)
    1.34 +#  define _STLP_EXTERN_RANGE_ERRORS
    1.35 +#endif
    1.36 +
    1.37 +_STLP_BEGIN_NAMESPACE
    1.38 +void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg);
    1.39 +void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg);
    1.40 +void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg);
    1.41 +void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg);
    1.42 +void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg);
    1.43 +void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg);
    1.44 +_STLP_END_NAMESPACE
    1.45 +
    1.46 +#if !defined (_STLP_EXTERN_RANGE_ERRORS)
    1.47 +
    1.48 +#  if defined(_STLP_THROW_RANGE_ERRORS)
    1.49 +#    ifndef _STLP_INTERNAL_STDEXCEPT
    1.50 +#      include <stl/_stdexcept.h>
    1.51 +#    endif
    1.52 +#    ifndef _STLP_STRING
    1.53 +#      include <string>
    1.54 +#    endif
    1.55 +#    define _STLP_THROW_MSG(ex,msg)  throw ex(string(msg))
    1.56 +#  else
    1.57 +#    if defined (_STLP_RTTI_BUG)
    1.58 +#      define _STLP_THROW_MSG(ex,msg)  TerminateProcess(GetCurrentProcess(), 0)
    1.59 +#    else
    1.60 +#      ifndef _STLP_INTERNAL_CSTDLIB
    1.61 +#        include <stl/_cstdlib.h>
    1.62 +#      endif
    1.63 +#      ifndef _STLP_INTERNAL_CSTDIO
    1.64 +#        include <stl/_cstdio.h>
    1.65 +#      endif
    1.66 +#      define _STLP_THROW_MSG(ex,msg)  puts(msg),_STLP_ABORT()
    1.67 +#    endif
    1.68 +#  endif
    1.69 +
    1.70 +// For mode without library and throwing range errors, include the
    1.71 +// stdexcept header and throw the appropriate exceptions directly.
    1.72 +
    1.73 +_STLP_BEGIN_NAMESPACE
    1.74 +
    1.75 +inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg)
    1.76 +{ _STLP_THROW_MSG(runtime_error, __msg); }
    1.77 +
    1.78 +inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg)
    1.79 +{ _STLP_THROW_MSG(range_error, __msg); }
    1.80 +
    1.81 +inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg)
    1.82 +{ _STLP_THROW_MSG(out_of_range, __msg); }
    1.83 +
    1.84 +inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg)
    1.85 +{ _STLP_THROW_MSG(length_error, __msg); }
    1.86 +
    1.87 +inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg)
    1.88 +{ _STLP_THROW_MSG(invalid_argument, __msg); }
    1.89 +
    1.90 +inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg)
    1.91 +{ _STLP_THROW_MSG(overflow_error, __msg); }
    1.92 +
    1.93 +_STLP_END_NAMESPACE
    1.94 +
    1.95 +#  undef _STLP_THROW_MSG
    1.96 +
    1.97 +#endif /* EXTERN_RANGE_ERRORS */
    1.98 +
    1.99 +#endif /* _STLP_RANGE_ERRORS_H */
   1.100 +
   1.101 +// Local Variables:
   1.102 +// mode:C++
   1.103 +// End: