Geant4 Cross Reference |
1 // Copyright (C) 2010, Guy Barrand. All rights 1 // Copyright (C) 2010, Guy Barrand. All rights reserved. 2 // See the file tools.license for terms. 2 // See the file tools.license for terms. 3 3 4 #ifndef tools_sout 4 #ifndef tools_sout 5 #define tools_sout 5 #define tools_sout 6 6 7 #include <string> 7 #include <string> 8 8 9 namespace tools { 9 namespace tools { 10 10 11 /* 11 /* 12 inline std::string sout(const std::string& a_s 12 inline std::string sout(const std::string& a_string) { 13 return "\""+a_string+"\""; 13 return "\""+a_string+"\""; 14 } 14 } 15 */ 15 */ 16 16 17 class sout : public std::string { 17 class sout : public std::string { 18 typedef std::string parent; 18 typedef std::string parent; 19 public: 19 public: 20 sout(const std::string& a_value) { 20 sout(const std::string& a_value) { 21 parent::operator+=("\""); 21 parent::operator+=("\""); 22 parent::operator+=(a_value); 22 parent::operator+=(a_value); 23 parent::operator+=("\""); 23 parent::operator+=("\""); 24 } 24 } 25 public: 25 public: 26 sout(const sout& a_from):parent(a_from){} 26 sout(const sout& a_from):parent(a_from){} 27 sout& operator=(const sout& a_from){parent:: 27 sout& operator=(const sout& a_from){parent::operator=(a_from);return *this;} 28 }; 28 }; 29 29 30 } 30 } 31 31 32 #endif 32 #endif