00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00049 #ifndef RANGELIB_INCL_RANGELIB_ERROR_HPP_EXCEPTIONS
00050 #define RANGELIB_INCL_RANGELIB_ERROR_HPP_EXCEPTIONS
00051
00052 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00053 # define RANGELIB_VER_RANGELIB_ERROR_HPP_EXCEPTIONS_MAJOR 2
00054 # define RANGELIB_VER_RANGELIB_ERROR_HPP_EXCEPTIONS_MINOR 0
00055 # define RANGELIB_VER_RANGELIB_ERROR_HPP_EXCEPTIONS_REVISION 2
00056 # define RANGELIB_VER_RANGELIB_ERROR_HPP_EXCEPTIONS_EDIT 17
00057 #endif
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 #ifndef RANGELIB_INCL_RANGELIB_HPP_RANGELIB
00074 # include <rangelib/rangelib.hpp>
00075 #endif
00076 #ifndef STLSOFT_INCL_STLSOFT_UTIL_HPP_EXCEPTION_STRING
00077 # include <stlsoft/util/exception_string.hpp>
00078 #endif
00079
00080 #ifndef STLSOFT_INCL_STDEXCEPT
00081 # define STLSOFT_INCL_STDEXCEPT
00082 # include <stdexcept>
00083 #endif
00084
00085 #ifdef STLSOFT_UNITEST
00086 # include <string.h>
00087 #endif
00088
00089
00090
00091
00092
00093 #ifndef RANGELIB_NO_NAMESPACE
00094 # if defined(_STLSOFT_NO_NAMESPACE) || \
00095 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00096
00097 namespace rangelib
00098 {
00099 # else
00100
00101
00102 namespace stlsoft
00103 {
00104
00105 namespace rangelib_project
00106 {
00107
00108 # endif
00109 #endif
00110
00111
00112
00113
00114
00120 class range_exception
00121 #if defined(STLSOFT_COMPILER_IS_DMC)
00122 : public std::exception
00123 #else
00124 : public stlsoft_ns_qual_std(exception)
00125 #endif
00126 {
00129 private:
00130 typedef stlsoft_ns_qual(exception_string) string_type;
00131 public:
00132 typedef range_exception class_type;
00133 #if defined(STLSOFT_COMPILER_IS_DMC)
00134 typedef std::exception parent_class_type;
00135 #else
00136 typedef stlsoft_ns_qual_std(exception) parent_class_type;
00137 #endif
00139
00142 public:
00143 ss_explicit_k range_exception(char const* reason = NULL)
00144 : m_reason((NULL == reason) ? "" : reason)
00145 {}
00151 virtual ~range_exception() stlsoft_throw_0()
00152 {}
00154
00157 public:
00158 virtual char const* what() const stlsoft_throw_0()
00159 {
00160 return m_reason.empty() ? this->real_what_() : m_reason.c_str();
00161 }
00163
00166 private:
00167 virtual char const* real_what_() const throw()
00168 {
00169 return "Range exception";
00170 }
00172
00175 private:
00176 const string_type m_reason;
00178
00181 private:
00182 class_type& operator =(class_type const&);
00184 };
00185
00192 class empty_range_exception
00193 : public range_exception
00194 {
00195 public:
00196 typedef range_exception parent_class_type;
00197 typedef empty_range_exception class_type;
00198
00201 public:
00202 ss_explicit_k empty_range_exception(char const* reason = NULL)
00203 : parent_class_type(reason)
00204 {}
00210 virtual ~empty_range_exception() stlsoft_throw_0()
00211 {}
00213
00216 private:
00217 virtual char const* real_what_() const throw()
00218 {
00219 return "Range was empty";
00220 }
00222 };
00223
00225
00226
00227 #ifdef STLSOFT_UNITTEST
00228 # include "./unittest/exceptions_unittest_.h"
00229 #endif
00230
00231
00232
00233 #ifndef RANGELIB_NO_NAMESPACE
00234 # if defined(_STLSOFT_NO_NAMESPACE) || \
00235 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00236 }
00237 # else
00238 }
00239 }
00240 # endif
00241 #endif
00242
00243
00244
00245 #endif
00246
00247