Back to index

salome-kernel  6.5.0
Classes | Defines | Functions
Utils_SALOME_Exception.hxx File Reference
#include <exception>
#include <iostream>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

protocol  UTILS_EXPORT
 Ce composant prend en charge la connexion et la deconnexion a l'orb Il est souhaitable de l'utiliser dans un SINGLETON. More...

Defines

#define LOCALIZED(message)   #message
#define UTILS_EXPORT

Functions

UTILS_EXPORT std::ostream & operator<< (std::ostream &, const SALOME_Exception &)
UTILS_EXPORT const char * makeText (const char *text, const char *fileName, const unsigned int lineNumber)

Define Documentation

#define LOCALIZED (   message)    #message

Definition at line 43 of file Utils_SALOME_Exception.hxx.

#define UTILS_EXPORT

Definition at line 58 of file Utils_SALOME_Exception.hxx.


Function Documentation

UTILS_EXPORT const char* makeText ( const char *  text,
const char *  fileName,
const unsigned int  lineNumber 
)

Definition at line 55 of file Utils_SALOME_Exception.cxx.

{
        char *newText = 0 ;

        ASSERT(text) ;
        const size_t l1 = 1+strlen(text) ;
        ASSERT(l1>1) ;

        const char* prefix = "Salome Exception" ;
        const size_t l0 = 2+strlen(prefix) ;

        if ( fileName )
        {
                const size_t l2 = 4+strlen(fileName) ;
                ASSERT(l2>4) ;

                ASSERT(lineNumber>=1) ;
                const size_t l3 = 4+int(log10(float(lineNumber))) ;
                
                newText = new char [ 1+l0+l1+l2+l3 ] ;
                sprintf( newText , "%s in %s [%u] : %s" , prefix, fileName, lineNumber, text ) ;
        }
        else
        {
                newText = new char [ 1+l0+l1 ] ;
                sprintf( newText , "%s : %s" , prefix, text ) ;
        }
        ASSERT(newText) ;
        return newText ;
}
UTILS_EXPORT std::ostream& operator<< ( std::ostream &  ,
const SALOME_Exception &   
)

Definition at line 111 of file Utils_SALOME_Exception.cxx.

{
        os << ex._text ;
        return os ;
}