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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/field (Version 11.3.0) and /externals/g4tools/include/tools/sg/field (Version 11.1)


  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_sg_field                              4 #ifndef tools_sg_field
  5 #define tools_sg_field                              5 #define tools_sg_field
  6                                                     6 
  7 #include <ostream>                                  7 #include <ostream>
  8                                                     8 
  9 #include "../scast"                                 9 #include "../scast"
 10 #include "../S_STRING"                             10 #include "../S_STRING"
 11                                                    11 
 12 #ifdef TOOLS_MEM                                   12 #ifdef TOOLS_MEM
 13 #include "../mem"                                  13 #include "../mem"
 14 #endif                                             14 #endif
 15                                                    15 
 16 namespace tools {                                  16 namespace tools {
 17 namespace io {                                     17 namespace io {
 18 class iwbuf;                                       18 class iwbuf;
 19 class irbuf;                                       19 class irbuf;
 20 }}                                                 20 }}
 21                                                    21 
 22 namespace tools {                                  22 namespace tools {
 23 namespace sg {                                     23 namespace sg {
 24                                                    24 
 25 class field {                                      25 class field {
 26 public:                                            26 public:
 27   TOOLS_SCLASS(tools::sg::field)                   27   TOOLS_SCLASS(tools::sg::field)
 28   virtual void* cast(const std::string& a_clas     28   virtual void* cast(const std::string& a_class) const {
 29     if(void* p = cmp_cast<field>(this,a_class)     29     if(void* p = cmp_cast<field>(this,a_class)) {return p;}
 30     else return 0;                                 30     else return 0;
 31   }                                                31   }
 32   virtual const std::string& s_cls() const = 0     32   virtual const std::string& s_cls() const = 0;
 33 public:                                            33 public:
 34   virtual bool write(io::iwbuf&) = 0;              34   virtual bool write(io::iwbuf&) = 0;
 35   virtual bool read(io::irbuf&) = 0;               35   virtual bool read(io::irbuf&) = 0;
 36   virtual bool dump(std::ostream&) = 0;            36   virtual bool dump(std::ostream&) = 0;
 37   virtual bool s_value(std::string&) const = 0     37   virtual bool s_value(std::string&) const = 0;
 38   virtual bool s2value(const std::string&) = 0     38   virtual bool s2value(const std::string&) = 0;
 39 protected:                                         39 protected:
 40   field():m_touched(true){                         40   field():m_touched(true){
 41 #ifdef TOOLS_MEM                                   41 #ifdef TOOLS_MEM
 42     mem::increment(s_class().c_str());             42     mem::increment(s_class().c_str());
 43 #endif                                             43 #endif
 44   }                                                44   }
 45 public:                                            45 public:
 46   virtual ~field(){                                46   virtual ~field(){
 47 #ifdef TOOLS_MEM                                   47 #ifdef TOOLS_MEM
 48     mem::decrement(s_class().c_str());             48     mem::decrement(s_class().c_str());
 49 #endif                                             49 #endif
 50   }                                                50   }
 51 protected:                                         51 protected:
 52   field(const field&):m_touched(true){             52   field(const field&):m_touched(true){
 53 #ifdef TOOLS_MEM                                   53 #ifdef TOOLS_MEM
 54     mem::increment(s_class().c_str());             54     mem::increment(s_class().c_str());
 55 #endif                                             55 #endif
 56   }                                                56   }
 57   field& operator=(const field&){m_touched=fal     57   field& operator=(const field&){m_touched=false;return *this;}
 58 public:                                            58 public:
 59   void touch() {m_touched = true;}                 59   void touch() {m_touched = true;}
 60   bool touched() const {return m_touched;}         60   bool touched() const {return m_touched;}
 61   void reset_touched() {m_touched = false;}        61   void reset_touched() {m_touched = false;}
 62 protected:                                         62 protected:
 63   bool m_touched;                                  63   bool m_touched;
 64 };                                                 64 };
 65                                                    65 
 66 }}                                                 66 }}
 67                                                    67 
 68 #define TOOLS_FIELD_DESC_NODE_CLASS(a__class)      68 #define TOOLS_FIELD_DESC_NODE_CLASS(a__class) \
 69   static const std::string s_node_class(#a__cl     69   static const std::string s_node_class(#a__class);
 70                                                    70 
 71 #define TOOLS_ARG_FIELD_DESC(a__field) \           71 #define TOOLS_ARG_FIELD_DESC(a__field) \
 72   new tools::sg::field_desc(s_node_class+"."+#     72   new tools::sg::field_desc(s_node_class+"."+#a__field,this->a__field.s_cls(),(char*)((tools::sg::field*)&(this->a__field))-(char*)((tools::sg::node*)this),true)
 73                                                    73 
 74 #define TOOLS_ARG_FIELD_DESC_NOT_EDITABLE(a__f     74 #define TOOLS_ARG_FIELD_DESC_NOT_EDITABLE(a__field) \
 75   new tools::sg::field_desc(s_node_class+"."+#     75   new tools::sg::field_desc(s_node_class+"."+#a__field,this->a__field.s_cls(),(char*)((tools::sg::field*)&(this->a__field))-(char*)((tools::sg::node*)this),false)
 76                                                    76 
 77 #define TOOLS_ARG_FIELD_DESC_ENUMS_BEG(a__fiel     77 #define TOOLS_ARG_FIELD_DESC_ENUMS_BEG(a__field,a__num) \
 78   new tools::sg::field_desc_enums(s_node_class     78   new tools::sg::field_desc_enums(s_node_class+"."+#a__field,this->a__field.s_cls(),(char*)((tools::sg::field*)&(this->a__field))-(char*)((tools::sg::node*)this),true,a__num,
 79 #define TOOLS_ARG_FIELD_DESC_ENUMS_END )           79 #define TOOLS_ARG_FIELD_DESC_ENUMS_END )
 80                                                    80 
 81 #define TOOLS_ARG_FIELD_DESC_NOT_EDITABLE_ENUM     81 #define TOOLS_ARG_FIELD_DESC_NOT_EDITABLE_ENUMS_BEG(a__field,a__num) \
 82   new tools::sg::field_desc_enums(s_node_class     82   new tools::sg::field_desc_enums(s_node_class+"."+#a__field,this->a__field.s_cls(),(char*)((tools::sg::field*)&(this->a__field))-(char*)((tools::sg::node*)this),false,a__num,
 83 #define TOOLS_ARG_FIELD_DESC_ENUMS_END )           83 #define TOOLS_ARG_FIELD_DESC_ENUMS_END )
 84                                                    84 
 85 #define TOOLS_ARG_ENUM(a__value) #a__value,a__     85 #define TOOLS_ARG_ENUM(a__value) #a__value,a__value
 86                                                    86 
 87 #define TOOLS_ARG_FIELD_DESC_OPTS_BEG(a__field     87 #define TOOLS_ARG_FIELD_DESC_OPTS_BEG(a__field,a__num) \
 88   new tools::sg::field_desc_opts(s_node_class+     88   new tools::sg::field_desc_opts(s_node_class+"."+#a__field,this->a__field.s_cls(),(char*)((tools::sg::field*)&(this->a__field))-(char*)((tools::sg::node*)this),true,a__num,
 89 #define TOOLS_ARG_FIELD_DESC_OPTS_END )            89 #define TOOLS_ARG_FIELD_DESC_OPTS_END )
 90                                                    90 
 91 #endif                                             91 #endif
 92                                                    92