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 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/sg/sf (Version 11.3.0) and /externals/g4tools/include/tools/sg/sf (Version 10.0.p4)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_sg_sf                               
  5 #define tools_sg_sf                               
  6                                                   
  7 // sf for simple field.                           
  8                                                   
  9 #include "bsf"                                    
 10                                                   
 11 //#include "../sto"                               
 12                                                   
 13 #include "../io/iwbuf"                            
 14 #include "../io/irbuf"                            
 15 #include "../stype"                               
 16                                                   
 17 #include <sstream>                                
 18 #include <istream>                                
 19                                                   
 20 namespace tools {                                 
 21 namespace sg {                                    
 22                                                   
 23 template <class T>                                
 24 class sf : public bsf<T> {                        
 25   typedef bsf<T> parent;                          
 26 public:                                           
 27   static const std::string& s_class() {           
 28     static const std::string s_v("tools::sg::s    
 29     return s_v;                                   
 30   }                                               
 31   virtual void* cast(const std::string& a_clas    
 32     if(void* p = cmp_cast< sf<T> >(this,a_clas    
 33     return parent::cast(a_class);                 
 34   }                                               
 35   virtual const std::string& s_cls() const {re    
 36 public:                                           
 37   virtual bool write(io::iwbuf& a_buffer) {       
 38     return a_buffer.write(parent::m_value);       
 39   }                                               
 40   virtual bool read(io::irbuf& a_buffer) {        
 41     return a_buffer.read(parent::m_value);        
 42   }                                               
 43   virtual bool dump(std::ostream& a_out) {        
 44     a_out << parent::m_value << std::endl;        
 45     return true;                                  
 46   }                                               
 47   virtual bool s_value(std::string& a_s) const    
 48     std::ostringstream strm;                      
 49     strm << parent::m_value;                      
 50     a_s = strm.str();                             
 51     return true;                                  
 52   }                                               
 53   virtual bool s2value(const std::string& a_s)    
 54     std::istringstream strm(a_s.c_str());         
 55     T v;                                          
 56     strm >> v;                                    
 57     if(strm.fail()) return false;                 
 58     parent::value(v);                             
 59     return true;                                  
 60   }                                               
 61 public:                                           
 62   sf(){}                                          
 63   sf(const T& a_value):parent(a_value){}          
 64   virtual ~sf(){}                                 
 65 public:                                           
 66   sf(const sf& a_from)                            
 67   :parent(a_from)                                 
 68   {}                                              
 69   sf& operator=(const sf& a_from){                
 70     parent::operator=(a_from);                    
 71     return *this;                                 
 72   }                                               
 73 public:                                           
 74   sf& operator=(const T& a_value){                
 75     parent::operator=(a_value);                   
 76     return *this;                                 
 77   }                                               
 78 };                                                
 79                                                   
 80 /*                                                
 81 template <class T>                                
 82 class sf_no_io : public bsf<T> {                  
 83 public:                                           
 84   virtual bool write(io::iwbuf&) {return true;    
 85   virtual bool read(io::irbuf&) {return true;}    
 86   virtual bool dump(std::ostream& a_out) {        
 87     a_out << parent::m_value << std::endl;        
 88     return true;                                  
 89   }                                               
 90 public:                                           
 91   sf_no_io(){}                                    
 92   sf_no_io(const T& a_value):parent(a_value){}    
 93 public:                                           
 94   sf_no_io(const sf_no_io& a_from)                
 95   :parent(a_from)                                 
 96   {}                                              
 97   sf_no_io& operator=(const sf_no_io& a_from){    
 98     parent::operator=(a_from);                    
 99     return *this;                                 
100   }                                               
101 public:                                           
102   sf_no_io& operator=(const T& a_value){          
103     parent::operator=(a_value);                   
104     return *this;                                 
105   }                                               
106 };                                                
107 */                                                
108                                                   
109 }}                                                
110                                                   
111 #endif