Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
2.9 KiB

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