home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ssvpar.zip / SSEXCEPT.INL < prev    next >
Text File  |  1994-08-19  |  4KB  |  172 lines

  1. /*---------------------------------------------------------------------------
  2.  
  3.                Copyright (c) 1994 SandStone Software Inc.
  4.                           All rights reserved
  5.  
  6. ----------------------------------------------------------------------------*/
  7.    SSInline SSException::SSException( const char* qpszText, 
  8.       SSUnsigned32 qulId) : oulId( qulId)
  9.       {
  10.       setText( qpszText);
  11.       }
  12.  
  13.    SSInline SSException::SSException( const SSException& qExcept) :
  14.       oulId( qExcept.oulId)
  15.       {
  16.       setText( qExcept.oachText);
  17.       }
  18.  
  19.    SSInline const char* SSException::text( void) const
  20.       {
  21.       return oachText;
  22.       }
  23.  
  24.    SSInline SSUnsigned32 SSException::errorId( void) const
  25.       {
  26.       return oulId;
  27.       }
  28.  
  29.    SSInline SSExceptionParm* SSException::parm( SSUnsigned32 qulIndex)
  30.       {
  31.       if ( qulIndex >= SSExceptionParmArray) return 0;
  32.       return &oaParm[ qulIndex];
  33.       }
  34.  
  35.    SSInline SSException::~SSException( void)
  36.       {
  37.       }
  38.  
  39.    SSInline SSExceptionParm::SSExceptionParm( void) :
  40.       oType( unsigned32), oulParm( 0)
  41.       {
  42.       }
  43.  
  44.    SSInline SSExceptionParm::SSExceptionParm( const void* qpParm) : 
  45.       oType( constVoid), opParm( qpParm)
  46.       {
  47.       }
  48.  
  49.    SSInline SSExceptionParm::SSExceptionParm( const char* qpchParm) :
  50.       oType( constChar)
  51.       {
  52.       opchParm = new char[ strlen( qpchParm) + 1];
  53.       strcpy( opchParm, qpchParm);
  54.       }
  55.  
  56.    SSInline SSExceptionParm::SSExceptionParm( SSUnsigned32 qulParm) :
  57.       oType( unsigned32), oulParm( qulParm)
  58.       {
  59.       }
  60.  
  61.    SSInline SSExceptionParm::SSExceptionParm( const SSExceptionParm& qParm) :
  62.       oType( qParm.oType), opParm( qParm.opParm)
  63.       {
  64.       if ( oType == constChar)
  65.          {
  66.          opchParm = new char[ strlen( qParm.opchParm) + 1];
  67.          strcpy( opchParm, qParm.opchParm);
  68.          }
  69.       }
  70.  
  71.    SSInline const void* SSExceptionParm::asConstVoid( void) const
  72.       {
  73.       return opParm;
  74.       }
  75.  
  76.    SSInline const char* SSExceptionParm::asConstChar( void) const
  77.       {
  78.       return opchParm;
  79.       }
  80.  
  81.    SSInline SSUnsigned32 SSExceptionParm::asUnsigned32( void) const
  82.       {
  83.       return oulParm;
  84.       }
  85.  
  86.    SSInline SSExceptionParm::operator const void*( void)
  87.       {
  88.       return opParm;
  89.       }
  90.  
  91.    SSInline SSExceptionParm::operator const char*( void)
  92.       {
  93.       return opchParm;
  94.       }
  95.  
  96.    SSInline SSExceptionParm::operator SSUnsigned32( void)
  97.       {
  98.       return oulParm;
  99.       }
  100.  
  101.    SSInline SSExceptionParm::SSExceptionParmType SSExceptionParm::type( void)
  102.       const
  103.       {
  104.       return oType;
  105.       }
  106.  
  107.    SSInline SSBooleanValue SSExceptionParm::isConstVoid( void) const
  108.       {
  109.       return oType == constVoid ? SSTrue : SSFalse;
  110.       }
  111.  
  112.    SSInline SSBooleanValue SSExceptionParm::isConstChar( void) const
  113.       {
  114.       return oType == constChar ? SSTrue : SSFalse;
  115.       }
  116.  
  117.    SSInline SSBooleanValue SSExceptionParm::isUnsigned32( void) const
  118.       {
  119.       return oType == unsigned32 ? SSTrue : SSFalse;
  120.       }
  121.  
  122.    SSInline SSExceptionParm& SSExceptionParm::operator=( const void* qpParm)
  123.       {
  124.       oType = constVoid;
  125.       opParm = qpParm;
  126.       return *this;
  127.       }
  128.  
  129.    SSInline SSExceptionParm& SSExceptionParm::operator=( const char* qpchParm)
  130.       {
  131.       if ( oType == constChar && opchParm) delete [] opchParm;
  132.       oType = constChar;
  133.       opchParm = new char[ strlen( qpchParm) + 1];
  134.       strcpy( opchParm, qpchParm);
  135.       return *this;
  136.       }
  137.  
  138.    SSInline SSExceptionParm& SSExceptionParm::operator=( SSUnsigned32 qulParm)
  139.       {
  140.       oType = unsigned32;
  141.       oulParm = qulParm;
  142.       return *this;
  143.       }
  144.  
  145.    SSInline SSExceptionParm::~SSExceptionParm( void)
  146.       {
  147.       if ( isConstChar()) delete [] opchParm;
  148.       }
  149.  
  150.    SSInline SSExceptionPresent::SSExceptionPresent( void) : opException( 0)
  151.       {
  152.       }
  153.  
  154.    SSInline SSException* SSExceptionPresent::hasException( void) const
  155.       {
  156.       return opException;
  157.       }
  158.  
  159.    SSInline SSException* SSExceptionPresent::getException( void)
  160.       {
  161.       SSException* zpException = opException;
  162.       opException = 0;
  163.       return zpException;
  164.       }
  165.  
  166.    SSInline SSException* SSExceptionPresent::setException( 
  167.       SSException* qpException)
  168.       {
  169.       opException = qpException;
  170.       return opException;
  171.       }
  172.