home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / oclsrc15.zip / OCL / Include / OException.hpp < prev    next >
C/C++ Source or Header  |  1996-01-16  |  3KB  |  93 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OException.hpp
  5.  
  6.  
  7. /*
  8.  * Redistribution and use in source and binary forms, with or without
  9.  * modification, are permitted provided that the following conditions
  10.  * are met:
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  14.  *    endorse or promote products derived from this software
  15.  *    without specific prior written permission.
  16.  * 3. See OCL.INF for a detailed copyright notice.
  17.  *
  18.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  19.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  22.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28.  * SUCH DAMAGE.
  29.  */
  30.  
  31. // $Header: E:/Projects/OCL/Include/rcs/OException.hpp 1.13 1996/01/16 10:12:18 B.STEIN Release B.STEIN $
  32.  
  33. #ifndef OEXCEPTION_INCLUDED
  34.   #define OEXCEPTION_INCLUDED
  35.  
  36.  
  37. #ifndef OSTRING_INCLUDED
  38.   #include <OString.hpp>
  39. #endif
  40.  
  41.  
  42. typedef class OException *pOException;
  43.  
  44. class __CPP_EXPORT__ OException
  45.   : virtual public OCLObject
  46. {
  47.  protected:
  48.    ULONG   state;
  49.  
  50.  public:
  51.    OString description;
  52.    OString Source;
  53.    ULONG   Line;
  54.    ULONG   rc;
  55.  
  56.  enum Severity {
  57.    recoverable = 0,
  58.    unrecoverable,
  59.    fatal };
  60.  
  61.    OException       (const PSZ err,           // supplied error message
  62.                      const ULONG retcode,     // an API return code
  63.                      const ULONG severity,    // severity code
  64.                      const PSZ source = "",   // module name
  65.                      const ULONG line = 0);   // line number
  66.  
  67.    OException       (const OString& err,      // supplied error message
  68.                      const ULONG retcode,     // an API return code
  69.                      const ULONG severity,    // severity code
  70.                      const PSZ source = "",   // module name
  71.                      const ULONG line = 0);   // line number
  72.  
  73.    OException        (const OException& ex);
  74.  
  75.    virtual
  76.       ~OException    ();
  77.  
  78.    virtual
  79.       PSZ isOfType   () const;
  80.  
  81.    inline ULONG
  82.           severity   () { return(state); }
  83.  
  84.    virtual
  85.       void viewError () = 0;
  86. };
  87.  
  88.  
  89.  
  90. #endif // OEXCEPTION_INCLUDED
  91.  
  92. // end of source
  93.