// -*- C++ -*- #ifndef _RWSTD_STDEXCEPT_INCLUDED #define _RWSTD_STDEXCEPT_INCLUDED /*************************************************************************** * * stdexcept - declarations for the Standard Library standard exception class * * $Id: stdexcept 172106 2011-11-02 17:04:12Z statham $ * *************************************************************************** * * Copyright (c) 1994-2001 Rogue Wave Software, Inc. All Rights Reserved. * * This computer software is owned by Rogue Wave Software, Inc. and is * protected by U.S. copyright laws and other laws and by international * treaties. This computer software is furnished by Rogue Wave Software, * Inc. pursuant to a written license agreement and may be used, copied, * transmitted, and stored only in accordance with the terms of such * license and with the inclusion of the above copyright notice. This * computer software or any other copies thereof may not be provided or * otherwise made available to any other person. * * U.S. Government Restricted Rights. This computer software is provided * with Restricted Rights. Use, duplication, or disclosure by the * Government is subject to restrictions as set forth in subparagraph (c) * (1) (ii) of The Rights in Technical Data and Computer Software clause * at DFARS 252.227-7013 or subparagraphs (c) (1) and (2) of the * Commercial Computer Software--Restricted Rights at 48 CFR 52.227-19, * as applicable. Manufacturer is Rogue Wave Software, Inc., 5500 * Flatiron Parkway, Boulder, Colorado 80301 USA. * **************************************************************************/ #include #include _RWSTD_NAMESPACE_BEGIN (std) #ifndef _RWSTD_LOGIC_ERROR_DEFINED // 19.1.1 class logic_error: public __rw_exception { public: _EXPLICIT logic_error (const string& __str) _THROWS (()) : __rw_exception (__str) { } // extension _EXPLICIT logic_error (const char *__s = 0) _THROWS (()) : __rw_exception (__s) { } }; # define _LOGIC_ERROR logic_error #else // if defined (_RWSTD_LOGIC_ERROR_DEFINED) // some compilers (e.g., MSVC) provide their own class logic_error // __rw_logic_error inherits from this class but wraps and uses // __rw_exception instead of the native class class __rw_logic_error: public logic_error { __rw_exception _C_ex; public: _EXPLICIT __rw_logic_error (const string& __str) _THROWS (()) : logic_error (), _C_ex (__str) { } // extension _EXPLICIT __rw_logic_error (const char *__s = 0) _THROWS (()) : logic_error (), _C_ex (__s) { } virtual const char* what () _THROWS (()) { return _C_ex.what (); } }; # define _LOGIC_ERROR __rw_logic_error #endif // _RWSTD_LOGIC_ERROR_DEFINED // 19.1.2 class domain_error : public _LOGIC_ERROR { public: _EXPLICIT domain_error (const string &__str) _THROWS (()) : _LOGIC_ERROR (__str) { } // extension _EXPLICIT domain_error (const char *__s = 0) _THROWS (()) : _LOGIC_ERROR (__s) { } }; // 19.1.3 class invalid_argument : public _LOGIC_ERROR { public: _EXPLICIT invalid_argument (const string &__str) _THROWS (()) : _LOGIC_ERROR (__str) { } // extension _EXPLICIT invalid_argument (const char *__s = 0) _THROWS (()) : _LOGIC_ERROR (__s) { } }; // 19.1.4 class length_error : public _LOGIC_ERROR { public: _EXPLICIT length_error (const string &__str) _THROWS (()) : _LOGIC_ERROR (__str) { } // extension _EXPLICIT length_error (const char *__s = 0) _THROWS (()) : _LOGIC_ERROR (__s) { } }; // 19.1.5 class out_of_range : public _LOGIC_ERROR { public: _EXPLICIT out_of_range (const string &__str) _THROWS (()) : _LOGIC_ERROR (__str) { } // extension _EXPLICIT out_of_range (const char *__s = 0) _THROWS (()) : _LOGIC_ERROR (__s) { } }; #undef _LOGIC_ERROR // 19.1.6 class runtime_error : public __rw_exception { public: _EXPLICIT runtime_error (const string &__str) _THROWS (()) : __rw_exception (__str) { } // extension _EXPLICIT runtime_error (const char *__s = 0) _THROWS (()) : __rw_exception (__s) { } }; // 19.1.7 class range_error : public runtime_error { public: _EXPLICIT range_error (const string &__str) _THROWS (()) : runtime_error (__str) { } // extension _EXPLICIT range_error (const char *__s = 0) _THROWS (()) : runtime_error (__s) { } }; // 19.1.8 class overflow_error : public runtime_error { public: _EXPLICIT overflow_error (const string &__str) _THROWS (()) : runtime_error (__str) { } // extension _EXPLICIT overflow_error (const char *__s = 0) _THROWS (()) : runtime_error (__s) { } }; // 19.1.9 class underflow_error : public runtime_error { public: _EXPLICIT underflow_error (const string &__str) _THROWS (()) : runtime_error (__str) { } // extension _EXPLICIT underflow_error (const char *__s = 0) _THROWS (()) : runtime_error (__s) { } }; _RWSTD_NAMESPACE_END // std #endif // _RWSTD_STDEXCEPT_INCLUDED