home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / STDEXCEP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  5.7 KB  |  192 lines

  1. /* This file is included specially and does not have a normal header guard */
  2. #pragma option push -b -a8 -pc -Vx- -Ve- -w-inl -w-aus -w-sig
  3. // -*- C++ -*-
  4. #ifndef __STD_STDEXCEPT
  5.  
  6. /***************************************************************************
  7.  *
  8.  * stdexcept - declarations for the Standard Library standard exception class
  9.  *
  10.  ***************************************************************************
  11.  *
  12.  * (c) Copyright 1994, 1998 Rogue Wave Software, Inc.
  13.  * ALL RIGHTS RESERVED
  14.  *
  15.  * The software and information contained herein are proprietary to, and
  16.  * comprise valuable trade secrets of, Rogue Wave Software, Inc., which
  17.  * intends to preserve as trade secrets such software and information.
  18.  * This software is furnished pursuant to a written license agreement and
  19.  * may be used, copied, transmitted, and stored only in accordance with
  20.  * the terms of such license and with the inclusion of the above copyright
  21.  * notice.  This software and information or any other copies thereof may
  22.  * not be provided or otherwise made available to any other person.
  23.  *
  24.  * Notwithstanding any other lease or license that may pertain to, or
  25.  * accompany the delivery of, this computer software and information, the
  26.  * rights of the Government regarding its use, reproduction and disclosure
  27.  * are as set forth in Section 52.227-19 of the FARS Computer
  28.  * Software-Restricted Rights clause.
  29.  * 
  30.  * Use, duplication, or disclosure by the Government is subject to
  31.  * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
  32.  * Technical Data and Computer Software clause at DFARS 252.227-7013.
  33.  * Contractor/Manufacturer is Rogue Wave Software, Inc.,
  34.  * P.O. Box 2328, Corvallis, Oregon 97339.
  35.  *
  36.  * This computer software and information is distributed with "restricted
  37.  * rights."  Use, duplication or disclosure is subject to restrictions as
  38.  * set forth in NASA FAR SUP 18-52.227-79 (April 1985) "Commercial
  39.  * Computer Software-Restricted Rights (April 1985)."  If the Clause at
  40.  * 18-52.227-74 "Rights in Data General" is specified in the contract,
  41.  * then the "Alternate III" clause applies.
  42.  *
  43.  **************************************************************************/
  44.  
  45. #include <stdcomp.h>
  46. #include <string>
  47. #ifndef __RWSTD_EXCEPT_SEEN
  48. #include <exception>
  49.  
  50. #ifndef _RWSTD_NO_NAMESPACE 
  51. namespace std {
  52. #endif
  53.  
  54. // MSVC provides its own exception class and logic_error class.  
  55. // In order to allow the use of MSVC classes derived from these
  56. // We have to use them to, instead of our own.  The drawback is 
  57. // that we don't have a logic_error(const string&) constructor any
  58. // more.  Now we have a logic_error(const char *) constructor.
  59.  
  60. #ifndef _RWSTD_LOGIC_ERROR_DEFINED
  61.   class _RWSTDExport logic_error : public exception
  62.   {
  63.   public:
  64.     logic_error (const string& what_arg)  _RWSTD_THROW_SPEC_NULL       
  65.     : str_(what_arg)
  66.     { ; }
  67.  
  68.     virtual ~logic_error ()  _RWSTD_THROW_SPEC_NULL;
  69.  
  70.     virtual const char * what () const  _RWSTD_THROW_SPEC_NULL
  71.     {
  72.       return str_.data();
  73.     }
  74.  
  75.   private:
  76.     string str_;
  77.   };
  78. #endif
  79.  
  80.   class _RWSTDExport domain_error : public logic_error
  81.   {
  82.   public:
  83.     domain_error (const string& what_arg) _RWSTD_THROW_SPEC_NULL 
  84. #ifndef _RWSTD_LOGIC_ERROR_DEFINED
  85.     : logic_error(what_arg) {;}
  86. #else
  87.     : logic_error(what_arg.c_str()) {;}
  88. #endif
  89.  
  90.     virtual ~domain_error ()  _RWSTD_THROW_SPEC_NULL;
  91.   };
  92.  
  93.   class _RWSTDExport invalid_argument : public logic_error
  94.   {
  95.   public:
  96.     invalid_argument (const string& what_arg) _RWSTD_THROW_SPEC_NULL 
  97. #ifndef  _RWSTD_LOGIC_ERROR_DEFINED
  98.     : logic_error(what_arg) {;}
  99. #else
  100.     : logic_error(what_arg.c_str()) {;}
  101. #endif
  102.  
  103.     virtual ~invalid_argument ()  _RWSTD_THROW_SPEC_NULL;
  104.   };
  105.  
  106.   class _RWSTDExport length_error : public logic_error
  107.   {
  108.   public:
  109.     length_error (const string& what_arg) _RWSTD_THROW_SPEC_NULL 
  110. #ifndef  _RWSTD_LOGIC_ERROR_DEFINED
  111.     : logic_error(what_arg) {;}
  112. #else
  113.     : logic_error(what_arg.c_str()) {;}
  114. #endif
  115.  
  116.     virtual ~length_error ()  _RWSTD_THROW_SPEC_NULL;
  117.   };
  118.  
  119.   class _RWSTDExport out_of_range : public logic_error
  120.   {
  121.   public:
  122.     out_of_range (const string& what_arg) _RWSTD_THROW_SPEC_NULL 
  123. #ifndef  _RWSTD_LOGIC_ERROR_DEFINED
  124.     : logic_error(what_arg) {;}
  125. #else
  126.     : logic_error(what_arg.c_str()) {;}
  127. #endif
  128.  
  129.     virtual ~out_of_range ()  _RWSTD_THROW_SPEC_NULL;
  130.   };
  131.  
  132.   class _RWSTDExport runtime_error : public exception
  133.   {
  134.   public:
  135.     runtime_error (const string& what_arg) _RWSTD_THROW_SPEC_NULL  
  136.     : str_(what_arg)
  137.     { ; }
  138.  
  139.     virtual ~runtime_error ()  _RWSTD_THROW_SPEC_NULL;
  140.  
  141.     virtual const char * what () const  _RWSTD_THROW_SPEC_NULL
  142.     {
  143.       return str_.data();
  144.     }
  145.  
  146.   private:
  147.     string str_;
  148.   };
  149.  
  150.   class _RWSTDExport range_error : public runtime_error
  151.   {
  152.   public:
  153.     range_error (const string& what_arg) _RWSTD_THROW_SPEC_NULL 
  154.     : runtime_error(what_arg) {;}
  155.  
  156.     virtual ~range_error ()  _RWSTD_THROW_SPEC_NULL;
  157.   };
  158.  
  159.   class _RWSTDExport overflow_error : public runtime_error
  160.   {
  161.   public:
  162.     overflow_error (const string& what_arg) _RWSTD_THROW_SPEC_NULL 
  163.     : runtime_error(what_arg) {;}
  164.  
  165.     virtual ~overflow_error ()  _RWSTD_THROW_SPEC_NULL;
  166.   };
  167.  
  168.   class _RWSTDExport underflow_error : public runtime_error
  169.   {
  170.   public:
  171.     underflow_error (const string& what_arg) _RWSTD_THROW_SPEC_NULL 
  172.     : runtime_error(what_arg) {;}
  173.  
  174.     virtual ~underflow_error ()  _RWSTD_THROW_SPEC_NULL;
  175.   };
  176.  
  177. #ifndef _RWSTD_NO_NAMESPACE 
  178. #endif
  179.  
  180. #define __RWSTD_EXCEPT_SEEN
  181.  
  182. #endif //__RWSTD_EXCEPT_SEEN
  183.  
  184. //
  185. // Yes, the complete file has been processed!
  186. //
  187. #define __STD_STDEXCEPT
  188.  
  189. #endif //__STD_STDEXCEPT
  190. #pragma option pop
  191.