_range_errors.h

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 
00031 #if defined ( _STLP_OWN_IOSTREAMS  ) && ! defined (_STLP_EXTERN_RANGE_ERRORS) 
00032 #  define _STLP_EXTERN_RANGE_ERRORS
00033 # endif
00034 
00035 #if defined (_STLP_EXTERN_RANGE_ERRORS)
00036 _STLP_BEGIN_NAMESPACE
00037 void  _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg);
00038 void  _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg);
00039 void  _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg);
00040 void  _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg);
00041 void  _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg);
00042 _STLP_END_NAMESPACE
00043 #else
00044 
00045 #if defined(_STLP_THROW_RANGE_ERRORS)
00046 # ifndef _STLP_STDEXCEPT
00047 #  include <stdexcept>
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_WINCE)
00055 #  define _STLP_THROW_MSG(ex,msg)  TerminateProcess(GetCurrentProcess(), 0)
00056 # else
00057 #  include <cstdlib>
00058 #  include <cstdio>
00059 #  define _STLP_THROW_MSG(ex,msg)  puts(msg),_STLP_ABORT()
00060 # endif
00061 #endif
00062 
00063 // For wrapper mode and throwing range errors, include the
00064 // stdexcept header and throw the appropriate exceptions directly.
00065 
00066 _STLP_BEGIN_NAMESPACE
00067 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg) { 
00068   _STLP_THROW_MSG(range_error, __msg); 
00069 }
00070 
00071 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg) { 
00072   _STLP_THROW_MSG(out_of_range, __msg); 
00073 }
00074 
00075 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg) { 
00076   _STLP_THROW_MSG(length_error, __msg); 
00077 }
00078 
00079 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg) { 
00080   _STLP_THROW_MSG(invalid_argument, __msg); 
00081 }
00082 
00083 inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg) { 
00084   _STLP_THROW_MSG(overflow_error, __msg); 
00085 }
00086 _STLP_END_NAMESPACE
00087 
00088 # undef _STLP_THROW_MSG
00089 
00090 # endif /* EXTERN_RANGE_ERRORS */
00091 
00092 
00093 #endif /* _STLP_RANGE_ERRORS_H */
00094 
00095 // Local Variables:
00096 // mode:C++
00097 // End:

Generated on Mon Jun 5 10:20:46 2006 for Intelligence.kdevelop by  doxygen 1.4.6