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