Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

exceptions.hh

00001 /*
00002 *  Name:      exceptions.hh
00003 *  Author:    Rafael Jesus Alcantara Perez
00004 *  Summary:   UESQLC exceptions
00005 *  Date:      $Date: 2003/10/06 13:21:36 $
00006 *  Revision:  $Revision: 1.18 $
00007 *
00008 *  Copyright (C) 1996-2002  Rafael Jesus Alcantara Perez <rafa@dedalo-ing.com>
00009 *
00010 *  This program is free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  This program is distributed in the hope that it will be useful,
00016 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 *  GNU General Public License for more details.
00019 *
00020 *  You should have received a copy of the GNU General Public License
00021 *  along with this program; if not, write to the Free Software
00022 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00023 *  MA 02111-1307, USA.
00024 */
00025 
00026 #ifndef _EXCEPTIONS_UESQLC__
00027 #define _EXCEPTIONS_UESQLC__
00028 
00029 #include <ostream>
00030 #include <mpcl/error_exception.hh>
00031 #include <mpcl/exception.hh>
00032 #include <mpcl/fatal_exception.hh>
00033 #include <mpcl/warning_exception.hh>
00034 
00035 
00043 class TException: public virtual mpcl::TException 
00044 {
00045 
00046   protected:
00047 
00048     //
00049     //  S E L E C T O R S
00050     //
00051 
00052     void write (std::basic_ostream<char>& rtTARGET_OSTREAM) const
00053     {
00054       if ( !fileName().empty() )
00055       {
00056         mpcl::TException::write (rtTARGET_OSTREAM);
00057       }
00058       else
00059       {
00060         rtTARGET_OSTREAM << generalDescription();
00061         if ( !specificDescription().empty() )
00062         {
00063           rtTARGET_OSTREAM << specificDescription();
00064         }
00065         rtTARGET_OSTREAM << std::endl;
00066       }
00067     }
00068 
00069 };  // class TException
00070 
00071 
00073 class TWarningException                   :
00074   private virtual mpcl::TException        ,
00075   public          mpcl::TWarningException ,
00076   public          TException
00077 {
00078 
00079   private:
00080 
00082     static const char*   _pkcSynopsis;
00083 
00084 
00085   public:
00086 
00087     //
00088     //  C O N S T R U C T O R S
00089     //
00090 
00098     TWarningException ( const std::string& rkyRATIONALE  ,
00099                         const std::string& rkyFILE_NAME  ,
00100                         const int          kiLINE_NUMBER )                              :
00101       mpcl::TException          (_pkcSynopsis, rkyRATIONALE, rkyFILE_NAME, kiLINE_NUMBER) ,
00102       mpcl::TWarningException ()                                                        ,
00103       TException              ()                                                        {}
00104 
00105 };  // class TWarningException
00106 
00107 
00109 class TErrorException                   :
00110   private virtual mpcl::TException      ,
00111   public          mpcl::TErrorException ,
00112   public          TException
00113 {
00114 
00115   private:
00116 
00118     static const char*   _pkcSynopsis;
00119 
00120 
00121   public:
00122 
00123     //
00124     //  C O N S T R U C T O R S
00125     //
00126 
00134     TErrorException ( const std::string& rkyRATIONALE  ,
00135                       const std::string& rkyFILE_NAME  ,
00136                       const int          kiLINE_NUMBER )                              :
00137       mpcl::TException        (_pkcSynopsis, rkyRATIONALE, rkyFILE_NAME, kiLINE_NUMBER) ,
00138       mpcl::TErrorException ()                                                        ,
00139       TException            ()                                                        {}
00140 
00141 };  // class TErrorException
00142 
00143 
00151 class TFatalException                   :
00152   private virtual mpcl::TException      ,
00153   public          mpcl::TFatalException ,
00154   public          TException
00155 {
00156 
00157   private:
00158 
00160     static const char*   _pkcSynopsis;
00161 
00162 
00163   protected:
00164 
00165     //
00166     //  S E L E C T O R S
00167     //
00168 
00169     void write (std::basic_ostream<char>& rtTARGET_OSTREAM) const
00170     {
00171       //
00172       //  Fatal errors doesn't depend on files.
00173       //
00174       rtTARGET_OSTREAM << generalDescription();
00175       if ( !specificDescription().empty() )
00176       {
00177         rtTARGET_OSTREAM << specificDescription();
00178       }
00179       rtTARGET_OSTREAM << std::endl;
00180     }
00181 
00182 
00183   public:
00184 
00185     //
00186     //  C O N S T R U C T O R S
00187     //
00188 
00196     TFatalException ( const std::string& rkyRATIONALE                  ,
00197                       const std::string& rkyFILE_NAME  = std::string() ,
00198                       const int          kiLINE_NUMBER = 0             )              :
00199       mpcl::TException        (_pkcSynopsis, rkyRATIONALE, rkyFILE_NAME, kiLINE_NUMBER) ,
00200       mpcl::TFatalException ()                                                        ,
00201       TException            ()                                                        {}
00202 
00203 };  // class TFatalException
00204 
00205 
00206 #endif  // not _EXCEPTIONS_UESQLC__

Generated on Mon Oct 13 02:40:10 2003 for UESQLC by doxygen1.2.18