00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #if !defined( __Utils_SALOME_Exception_hxx__ )
00030 #define __Utils_SALOME_Exception_hxx__
00031
00032
00033
00034 # include <exception>
00035 # include <iostream>
00036
00037 #ifdef LOCALIZED
00038 #undef LOCALIZED
00039 #endif
00040 #if defined(_DEBUG_) || defined(_DEBUG)
00041 # define LOCALIZED(message) #message , __FILE__ , __LINE__
00042 #else
00043 # define LOCALIZED(message) #message
00044 #endif
00045
00046
00047
00048
00049 #ifdef WIN32
00050 # if defined UTILS_EXPORTS || defined OpUtil_EXPORTS
00051 # define UTILS_EXPORT __declspec( dllexport )
00052 # else
00053 # define UTILS_EXPORT __declspec( dllimport )
00054 # undef LOCALIZED
00055 # define LOCALIZED(message) #message
00056 # endif
00057 #else
00058 # define UTILS_EXPORT
00059 #endif
00060
00061 class SALOME_Exception;
00062
00063 UTILS_EXPORT std::ostream& operator<<( std::ostream&, const SALOME_Exception& );
00064
00065 UTILS_EXPORT const char *makeText( const char *text, const char *fileName, const unsigned int lineNumber );
00066
00067 class UTILS_EXPORT SALOME_Exception : public std::exception
00068 {
00069
00070 private :
00071 SALOME_Exception( void );
00072
00073 protected :
00074 const char* _text ;
00075
00076 public :
00077 SALOME_Exception( const char *text, const char *fileName=0, const unsigned int lineNumber=0 );
00078 SALOME_Exception( const SALOME_Exception &ex );
00079 virtual ~SALOME_Exception() throw ();
00080 UTILS_EXPORT friend std::ostream & operator<<( std::ostream &os , const SALOME_Exception &ex );
00081 virtual const char *what( void ) const throw () ;
00082 } ;
00083
00084
00085 #endif