<?xml?>

<tm2>

  <typedef id="list1_base" type="pointer" lang="c" >

    <codedefs>

      <codedef id="construct">
        <code>
          $(dst)=$(preset);
        </code>
      </codedef>

      <codedef id="destruct">
        <code>
          $(member_prefix)_free($(src));
          $(src)=NULL;
        </code>
      </codedef>

      <codedef id="assign">
        <code>
          $(dst)=$(src);
        </code>
      </codedef>

      <codedef id="dup">
        <code>
          $(dst)=$(member_prefix)_dup($(src));
        </code>
      </codedef>

      <codedef id="compare">
        <code>
        </code>
      </codedef>

      <codedef id="toXml">
        <code>
          {
            if ($(src)) {
              GWEN_XMLNODE *dbDest;
              $(member_basetype_type) *elem;
              
              dbDest=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "$(name)");
              elem=$(member_prefix)_First($(src));
              while(elem) {
                GWEN_XMLNODE *dbElem;
                
                dbElem=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "$(element_name)");
                assert(dbElem);
                $(member_basetype_prefix)_toXml(elem, dbElem);
                GWEN_XMLNode_AddChild(dbDest, dbElem);
                elem=$(member_prefix)_Next(elem);
              }
              
              GWEN_XMLNode_AddChild($(db), dbDest);
            }
          }
        </code>
      </codedef>

      <codedef id="fromXml">
        <code>
           {
            GWEN_XMLNODE *dbSource;
            
            dbSource=GWEN_XMLNode_FindFirstTag($(db), "$(name)", NULL, NULL);
            if (dbSource) {
              $(member_type) *t;
              GWEN_XMLNODE *dbT;
              
              t=$(member_prefix)_new();
              dbT=GWEN_XMLNode_FindFirstTag(dbSource, "$(element_name)", NULL, NULL);
              while(dbT) {
                $(member_basetype_type) *elem;
                
                elem=$(member_basetype_prefix)_fromXml(dbT);
                if (elem)
                  $(member_prefix)_Add(elem, t);
                dbT=GWEN_XMLNode_FindNextTag(dbT, "$(element_name)", NULL, NULL);
              }
              $(dst)=t;
            }
            else
              $(dst)=$(preset);
          }
       </code>
      </codedef>




      <codedef id="toObject">
        <code>
        </code>
      </codedef>



      <codedef id="fromObject">
        <code>
        </code>
      </codedef>



      <codedef id="toDb">
        <code>
          {
            if ($(src)) {
              GWEN_DB_NODE *dbDest;
              $(member_basetype_type) *elem;
              
              dbDest=GWEN_DB_GetGroup($(db), GWEN_DB_FLAGS_OVERWRITE_GROUPS, "$(name)");
              assert(dbDest);

              $(retval)=0;
              
              elem=$(member_prefix)_First($(src));
              while(elem) {
                GWEN_DB_NODE *dbElem;
                
                dbElem=GWEN_DB_GetGroup(dbDest, GWEN_PATH_FLAGS_CREATE_GROUP, "$(element_name)");
                assert(dbElem);
                $(retval)=$(member_basetype_prefix)_toDb(elem, dbElem);
                if ($(retval)&lt;0) {
                  DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", $(retval));
                  break;
                }
                elem=$(member_prefix)_Next(elem);
              }
            }
            else
              $(retval)=0;
          }
        </code>
      </codedef>



      <codedef id="fromDb">
        <code>
          {
            GWEN_DB_NODE *dbSource;
            
            dbSource=GWEN_DB_GetGroup($(db), GWEN_PATH_FLAGS_NAMEMUSTEXIST, "$(name)");
            if (dbSource) {
              $(member_type) *t;
              GWEN_DB_NODE *dbT;
              
              t=$(member_prefix)_new();
              dbT=GWEN_DB_FindFirstGroup(dbSource, "$(element_name)");
              while(dbT) {
                $(member_basetype_type) *elem;
                
                elem=$(member_basetype_prefix)_fromDb(dbT);
                if (elem)
                  $(member_prefix)_Add(elem, t);
                dbT=GWEN_DB_FindNextGroup(dbT, "$(element_name)");
              }
              $(dst)=t;
            }
            else
              $(dst)=$(preset);
          }
        </code>
      </codedef>



      <codedef id="toHashString">
        <code>
        </code>
      </codedef>




    </codedefs>



    <defaults>
      <!-- defaults flags etc for member declarations of this type -->
      <default>NULL</default>
      <preset>NULL</preset>
      <setflags>const dup</setflags>
      <getflags>const</getflags>
      <dupflags>const</dupflags>
    </defaults>
  
  </typedef>

</tm2>
