Back to home page

EIC code displayed by LXR

 
 

    


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 "../cstr"
0010 #include "../HEADER"
0011 
0012 namespace tools {
0013 namespace sg {
0014 
0015 class sf_string : public bsf<std::string> {
0016   TOOLS_HEADER(sf_string,tools::sg::sf_string,bsf<std::string>)
0017 public:
0018   virtual bool write(io::iwbuf& a_buffer) {
0019     return a_buffer.write_cstr(m_value.c_str());
0020   }
0021   virtual bool read(io::irbuf& a_buffer) {
0022     char* cstr = 0;
0023     if(!a_buffer.read_cstr(cstr)) return false;
0024     m_value = cstr;
0025     str_del(cstr);
0026     return true;
0027   }
0028   virtual bool dump(std::ostream& a_out) {
0029     a_out << m_value << std::endl;
0030     return true;
0031   }
0032   virtual bool s_value(std::string& a_s) const {
0033     a_s = m_value;
0034     return true;
0035   }
0036   virtual bool s2value(const std::string& a_s) {
0037     value(a_s);
0038     return true;
0039   }
0040 public:
0041   sf_string():parent(){}
0042   sf_string(const std::string& a_value):parent(a_value){}
0043   virtual ~sf_string(){}
0044 public:
0045   sf_string(const sf_string& a_from):parent(a_from){}
0046   sf_string& operator=(const sf_string& a_from){
0047     parent::operator=(a_from);
0048     return *this;
0049   }
0050 public:
0051   sf_string& operator=(const std::string& a_value){
0052     parent::operator=(a_value);
0053     return *this;
0054   }
0055 };
0056 
0057 }}
0058 
0059 #endif