/home/ntakagi/work/STLport-5.1.5/stlport/stl/_range_errors.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1999
00003  * Silicon Graphics
00004  *
00005  * Permission to use, copy, modify, distribute and sell this software
00006  * and its documentation for any purpose is hereby granted without fee,
00007  * provided that the above copyright notice appear in all copies and
00008  * that both that copyright notice and this permission notice appear
00009  * in supporting documentation.  Silicon Graphics makes no
00010  * representations about the suitability of this software for any
00011  * purpose.  It is provided "as is" without express or implied warranty.
00012  *
00013  */
00014 
00015 #ifndef _STLP_RANGE_ERRORS_H
00016 #define _STLP_RANGE_ERRORS_H
00017 
00018 // A few places in the STL throw range errors, using standard exception
00019 // classes defined in <stdexcept>.  This header file provides functions
00020 // to throw those exception objects.
00021 
00022 // _STLP_DONT_THROW_RANGE_ERRORS is a hook so that users can disable
00023 // this exception throwing.
00024 #if defined (_STLP_CAN_THROW_RANGE_ERRORS) && defined (_STLP_USE_EXCEPTIONS) && \
00025    !defined (_STLP_DONT_THROW_RANGE_ERRORS)
00026 #  define _STLP_THROW_RANGE_ERRORS
00027 #endif
00028 
00029 // For the STLport iostreams, only declaration here, definition is in the lib
00030 #if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_EXTERN_RANGE_ERRORS)
00031 #  define _STLP_EXTERN_RANGE_ERRORS
00032 #endif
00033 
00034 _STLP_BEGIN_NAMESPACE
00035 void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg);
00036 void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg);
00037 void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg);
00038 void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg);
00039 void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg);
00040 void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg);
00041 _STLP_END_NAMESPACE
00042 
00043 #if !defined (_STLP_EXTERN_RANGE_ERRORS)
00044 
00045 #  if defined(_STLP_THROW_RANGE_ERRORS)
00046 #    ifndef _STLP_INTERNAL_STDEXCEPT
00047 #      include <stl/_stdexcept.h>
00048 #    endif
00049 #    ifndef _STLP_STRING
00050 #      include <string>
00051 #    endif
00052 #    define _STLP_THROW_MSG(ex,msg)  throw ex(string(msg))
00053 #  else
00054 #    if defined (_STLP_RTTI_BUG)
00055 #      define _STLP_THROW_MSG(ex,msg)  TerminateProcess(GetCurrentProcess(), 0)
00056 #    else
00057 #      ifndef _STLP_INTERNAL_CSTDLIB
00058 #        include <stl/_cstdlib.h>
00059 #      endif
00060 #      ifndef _STLP_INTERNAL_CSTDIO
00061 #        include <stl/_cstdio.h>
00062 #      endif
00063 #      define _STLP_THROW_MSG(ex,msg)  puts(msg),_STLP_ABORT()
00064 #    endif
00065 #  endif
00066 
00067 // For mode without library and throwing range errors, include the
00068 // stdexcept header and throw the appropriate exceptions directly.
00069 
00070 _STLP_BEGIN_NAMESPACE
00071 
00072 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg)
00073 { _STLP_THROW_MSG(runtime_error, __msg); }
00074 
00075 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg)
00076 { _STLP_THROW_MSG(range_error, __msg); }
00077 
00078 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg)
00079 { _STLP_THROW_MSG(out_of_range, __msg); }
00080 
00081 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg)
00082 { _STLP_THROW_MSG(length_error, __msg); }
00083 
00084 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg)
00085 { _STLP_THROW_MSG(invalid_argument, __msg); }
00086 
00087 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg)
00088 { _STLP_THROW_MSG(overflow_error, __msg); }
00089 
00090 _STLP_END_NAMESPACE
00091 
00092 #  undef _STLP_THROW_MSG
00093 
00094 #endif /* EXTERN_RANGE_ERRORS */
00095 
00096 #endif /* _STLP_RANGE_ERRORS_H */
00097 
00098 // Local Variables:
00099 // mode:C++
00100 // End:



Generated on Mon Mar 10 15:32:32 2008 by  doxygen 1.5.1