home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / stdxcept < prev    next >
Text File  |  1998-06-16  |  3KB  |  134 lines

  1. // stdexcept standard header
  2.  
  3. #if     _MSC_VER > 1000
  4. #pragma once
  5. #endif
  6.  
  7. #ifndef _STDEXCEPT_
  8. #define _STDEXCEPT_
  9. #include <exception>
  10. #include <xstring>
  11.  
  12. #ifdef  _MSC_VER
  13. #pragma pack(push,8)
  14. #endif  /* _MSC_VER */
  15. _STD_BEGIN
  16.         // CLASS logic_error
  17. class _CRTIMP logic_error : public exception {
  18. public:
  19.     explicit logic_error(const string& _S)
  20.         : exception(""), _Str(_S) {}
  21.     virtual ~logic_error()
  22.         {}
  23.     virtual const char *what() const
  24.         {return (_Str.c_str()); }
  25. protected:
  26.     virtual void _Doraise() const
  27.         {_RAISE(*this); }
  28. private:
  29.     string _Str;
  30.     };
  31.         // CLASS domain_error
  32. class _CRTIMP domain_error : public logic_error {
  33. public:
  34.     explicit domain_error(const string& _S)
  35.         : logic_error(_S) {}
  36.     virtual ~domain_error()
  37.         {}
  38. protected:
  39.     virtual void _Doraise() const
  40.         {_RAISE(*this); }
  41.     };
  42.         // CLASS invalid_argument
  43. class invalid_argument : public logic_error {
  44. public:
  45.     explicit invalid_argument(const string& _S)
  46.         : logic_error(_S) {}
  47.     virtual ~invalid_argument()
  48.         {}
  49. protected:
  50.     virtual void _Doraise() const
  51.         {_RAISE(*this); }
  52.     };
  53.         // CLASS length_error
  54. class _CRTIMP length_error : public logic_error {
  55. public:
  56.     explicit length_error(const string& _S)
  57.         : logic_error(_S) {}
  58.     virtual ~length_error()
  59.         {}
  60. protected:
  61.     virtual void _Doraise() const
  62.         {_RAISE(*this); }
  63.     };
  64.         // CLASS out_of_range
  65. class _CRTIMP out_of_range : public logic_error {
  66. public:
  67.     explicit out_of_range(const string& _S)
  68.         : logic_error(_S) {}
  69.     virtual ~out_of_range()
  70.         {}
  71. protected:
  72.     virtual void _Doraise() const
  73.         {_RAISE(*this); }
  74.     };
  75.         // CLASS runtime_error
  76. class _CRTIMP runtime_error : public exception {
  77. public:
  78.     explicit runtime_error(const string& _S)
  79.         : exception(""), _Str(_S) {}
  80.     virtual ~runtime_error()
  81.         {}
  82.     virtual const char *what() const
  83.         {return (_Str.c_str()); }
  84. protected:
  85.     virtual void _Doraise() const
  86.         {_RAISE(*this); }
  87. private:
  88.     string _Str;
  89.     };
  90.         // CLASS overflow_error
  91. class _CRTIMP overflow_error : public runtime_error {
  92. public:
  93.     explicit overflow_error(const string& _S)
  94.         : runtime_error(_S) {}
  95.     virtual ~overflow_error()
  96.         {}
  97. protected:
  98.     virtual void _Doraise() const
  99.         {_RAISE(*this); }
  100.     };
  101.         // CLASS underflow_error
  102. class _CRTIMP underflow_error : public runtime_error {
  103. public:
  104.     explicit underflow_error(const string& _S)
  105.         : runtime_error(_S) {}
  106.     virtual ~underflow_error()
  107.         {}
  108. protected:
  109.     virtual void _Doraise() const
  110.         {_RAISE(*this); }
  111.     };
  112.         // CLASS range_error
  113. class _CRTIMP range_error : public runtime_error {
  114. public:
  115.     explicit range_error(const string& _S)
  116.         : runtime_error(_S) {}
  117.     virtual ~range_error()
  118.         {}
  119. protected:
  120.     virtual void _Doraise() const
  121.         {_RAISE(*this); }
  122.     };
  123. _STD_END
  124. #ifdef  _MSC_VER
  125. #pragma pack(pop)
  126. #endif  /* _MSC_VER */
  127.  
  128. #endif /* _STDEXCEPT_ */
  129.  
  130. /*
  131.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  132.  * Consult your license regarding permissions and restrictions.
  133.  */
  134.