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