Warning, /include/Geant4/tools/sg/sf_string is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef tools_sg_sf_string
0005 #define tools_sg_sf_string
0006
0007 #include "sf"
0008
0009 #include "../HEADER"
0010
0011 namespace tools {
0012 namespace sg {
0013
0014 class sf_string : public bsf<std::string> {
0015 TOOLS_HEADER(sf_string,tools::sg::sf_string,bsf<std::string>)
0016 public:
0017 virtual bool write(io::iwbuf& a_buffer) {
0018 return a_buffer.write_cstr(m_value.c_str());
0019 }
0020 virtual bool read(io::irbuf& a_buffer) {
0021 char* cstr = 0;
0022 if(!a_buffer.read_cstr(cstr)) return false;
0023 m_value = cstr;
0024 ::free(cstr);
0025 return true;
0026 }
0027 virtual bool dump(std::ostream& a_out) {
0028 a_out << m_value << std::endl;
0029 return true;
0030 }
0031 virtual bool s_value(std::string& a_s) const {
0032 a_s = m_value;
0033 return true;
0034 }
0035 virtual bool s2value(const std::string& a_s) {
0036 value(a_s);
0037 return true;
0038 }
0039 public:
0040 sf_string():parent(){}
0041 sf_string(const std::string& a_value):parent(a_value){}
0042 virtual ~sf_string(){}
0043 public:
0044 sf_string(const sf_string& a_from):parent(a_from){}
0045 sf_string& operator=(const sf_string& a_from){
0046 parent::operator=(a_from);
0047 return *this;
0048 }
0049 public:
0050 sf_string& operator=(const std::string& a_value){
0051 parent::operator=(a_value);
0052 return *this;
0053 }
0054 };
0055
0056 }}
0057
0058 #endif