Salome HOME
NRI : Comment unused ComponentType enum.
[modules/kernel.git] / src / Utils / SalomeString.hxx
1 # ifndef SALOME_STRING
2 # define SALOME_STRING
3
4 # include <string>
5 # include <sstream>
6
7 class SALOME_STRING : public string
8 {
9 private :
10         ostringstream _s ;
11 public :
12         operator const char*() const
13         {
14                 return _s.str().c_str() ;
15         }
16         SALOME_STRING() : _s()
17         {
18         }
19         template <class T> SALOME_STRING( const T &valeur ) : _s()
20         {
21                 _s << valeur ;
22         }
23         template <class T> SALOME_STRING &operator<<( const T &valeur )
24         {
25                 _s << valeur ;
26                 return *this ;
27         }
28 } ;
29
30 // Exemple d'utilisation avec les exceptions SALOME
31 //      SALOME_STRING msgErr;
32 //      msgErr << "ESSAI::ESSAI() : This Object cannot be instanciated by now ! Try "<< 11 << "times just to see what happens ";
33 //      throw SALOME_EXCEPTION (LOCALIZED(msgErr)) ;
34
35 # endif