1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/_range_errors.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,105 @@
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 +
1.34 +#if defined ( _STLP_OWN_IOSTREAMS ) && ! defined (_STLP_EXTERN_RANGE_ERRORS)
1.35 +# define _STLP_EXTERN_RANGE_ERRORS
1.36 +# endif
1.37 +
1.38 +#if defined (_STLP_EXTERN_RANGE_ERRORS)
1.39 +# ifndef _STLP_STDEXCEPT
1.40 +# include <stdexcept>
1.41 +# endif
1.42 +_STLP_BEGIN_NAMESPACE
1.43 +void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg);
1.44 +void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg);
1.45 +void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg);
1.46 +void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg);
1.47 +void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg);
1.48 +_STLP_END_NAMESPACE
1.49 +#else
1.50 +
1.51 +#if defined(_STLP_THROW_RANGE_ERRORS)
1.52 +# ifndef _STLP_STDEXCEPT
1.53 +# include <stdexcept>
1.54 +# endif
1.55 +# ifndef _STLP_STRING
1.56 +# include <string>
1.57 +# endif
1.58 +# define _STLP_THROW_MSG(ex,msg) throw ex(string(msg))
1.59 +#else
1.60 +# if defined (_STLP_WINCE)
1.61 +# define _STLP_THROW_MSG(ex,msg) TerminateProcess(GetCurrentProcess(), 0)
1.62 +# else
1.63 +# include <cstdlib>
1.64 +# include <cstdio>
1.65 +# ifdef _STLP_USE_TRAP_LEAVE
1.66 +# define _STLP_THROW_MSG(ex,msg) { STDEX_REPORT_EXCEPTION(msg) ; User::Leave(STDEX_##ex); }
1.67 +# include <stdexcept>
1.68 +# else
1.69 +# define _STLP_THROW_MSG(ex,msg) puts(msg),_STLP_ABORT()
1.70 +# endif
1.71 +# endif
1.72 +#endif
1.73 +
1.74 +// For wrapper mode and throwing range errors, include the
1.75 +// stdexcept header and throw the appropriate exceptions directly.
1.76 +
1.77 +_STLP_BEGIN_NAMESPACE
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 +
1.82 +inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg) {
1.83 + _STLP_THROW_MSG(out_of_range, __msg);
1.84 +}
1.85 +
1.86 +inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg) {
1.87 + _STLP_THROW_MSG(length_error, __msg);
1.88 +}
1.89 +
1.90 +inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg) {
1.91 + _STLP_THROW_MSG(invalid_argument, __msg);
1.92 +}
1.93 +
1.94 +inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg) {
1.95 + _STLP_THROW_MSG(overflow_error, __msg);
1.96 +}
1.97 +_STLP_END_NAMESPACE
1.98 +
1.99 +# undef _STLP_THROW_MSG
1.100 +
1.101 +# endif /* EXTERN_RANGE_ERRORS */
1.102 +
1.103 +
1.104 +#endif /* _STLP_RANGE_ERRORS_H */
1.105 +
1.106 +// Local Variables:
1.107 +// mode:C++
1.108 +// End: