Return TypeFunction nameArguments
hzEcodehdbClass::DescCheck(hzChain&,hzChain&,)

Declared in file: hzDatabase.h
Defined in file : hdbClass.cpp

Function Logic:

0:START 1:hzDocXml::Load rc 2:rc!=E_OK 3:items 4:Return E_SYNTAX 5:hzDocXml::GetRoot pRoot 6:!pRoot 7:items 8:Return E_SYNTAX 9:!pRoot->NameEQ(class) 10:items 11:Return E_SYNTAX 12:cname str_id ai 13:ai.Valid(); 14:ai.NameEQ(id) 15:hzAttrset::Value str_id hzAttrset::NameEQ 16:ai.NameEQ(name) 17:hzAttrset::Value cname 18:rc hzXmlNode::Line hzAttrset::Name hzAttrset::Value hzChain::Printf 19:!cname 20:items 21:cname!=m_Typename 22:hzChain::Printf 23:!str_id 24:items 25:!IsInteger(n,*str_id) 26:hzChain::Printf 27:n!=m_ClassUID 28:hzChain::Printf 29:pN2; 30:!pN2->NameEQ(member) 31:hzXmlNode::txtName hzChain::Printf 32:str_nam str_sub str_typ str_max str_min str_uid str_id ai 33:ai.Valid(); 34:ai.NameEQ(posn) 35:hzAttrset::Value str_id hzAttrset::NameEQ 36:ai.NameEQ(uid) 37:hzAttrset::Value str_uid hzAttrset::NameEQ 38:ai.NameEQ(min) 39:hzAttrset::Value str_min hzAttrset::NameEQ 40:ai.NameEQ(max) 41:hzAttrset::Value str_max hzAttrset::NameEQ 42:ai.NameEQ(datatype) 43:hzAttrset::Value str_typ hzAttrset::NameEQ 44:ai.NameEQ(subclass) 45:hzAttrset::Value str_sub hzAttrset::NameEQ 46:ai.NameEQ(name) 47:hzAttrset::Value str_nam 48:hzXmlNode::Line hzAttrset::Name hzAttrset::Value hzChain::Printf 49:!str_id 50:hzXmlNode::Line hzChain::Printf 51:!str_uid 52:hzXmlNode::Line hzChain::Printf 53:!str_min 54:hzXmlNode::Line hzChain::Printf 55:!str_max 56:hzXmlNode::Line hzChain::Printf 57:!str_nam 58:hzXmlNode::Line hzChain::Printf IsInteger 59:!IsInteger(n,*str_id) 60:hzXmlNode::Line hzChain::Printf IsInteger 61:!IsInteger(n,*str_uid) 62:hzXmlNode::Line hzChain::Printf IsInteger 63:!IsInteger(n,*str_min) 64:hzXmlNode::Line hzChain::Printf IsInteger 65:!IsInteger(n,*str_max) 66:hzXmlNode::Line hzChain::Printf 67:!str_typ 68:str_typ 69:hdbADP::GetDatatype pType 70:!pType 71:hzXmlNode::Line hzChain::Printf 72:report.Size() 73:Return E_FORMAT 74:Return E_OK

Function body:

hzEcode hdbClass::DescCheck (hzChain& report, hzChain& desc)
{
   _hzfunc("hdbClass::DescCheck") ;
   const hdbDatatype*  pType ;
   hzDocXml        doc ;
   hzXmlNode*      pRoot ;
   hzXmlNode*      pN2 ;
   hzAttrset       ai ;
   hzString        cname ;
   hzString        str_id ;
   hzString        str_uid ;
   hzString        str_min ;
   hzString        str_max ;
   hzString        str_typ ;
   hzString        str_sub ;
   hzString        str_nam ;
   hzEcode         rc = E_OK ;
   int16_t         n ;
   rc = doc.Load(desc) ;
   if (rc != E_OK)
       { report << "Could not load XML document with supplied description\n" ; return E_SYNTAX ; }
   pRoot = doc.GetRoot() ;
   if (!pRoot)
       { report << "No XML root found in supplied description\n" ; return E_SYNTAX ; }
   if (!pRoot->NameEQ("class"))
       { report << "Expected first tag of <class>\n" ; return E_SYNTAX ; }
   str_id = cname = (char*) 0;
   for (ai = pRoot ; ai.Valid() ; ai.Advance())
   {
       if      (ai.NameEQ("id"))   str_id = ai.Value() ;
       else if (ai.NameEQ("name")) cname = ai.Value() ;
       else
           { rc = E_SYNTAX ; report.Printf("Line %d: <class> bad param %s=%s\n", pRoot->Line(), ai.Name(), ai.Value()) ; break ; }
   }
   if (!cname)
       report << "No class name supplied\n" ;
   else
   {
       if (cname != m_Typename)
           report.Printf("Name mismatch. Class actual name is %s. Description names class as %s.\n", *m_Typename, *cname) ;
   }
   if (!str_id)
       report << "No class id supplied\n" ;
   else
   {
       if (!IsInteger(n, *str_id))
           report.Printf("Illegal Class ID: Must be integer. (%s)\n", *str_id) ;
       if (n != m_ClassUID)
           report.Printf("Class Delta ID mismatch. Class actual %d: Description id is %s\n", m_ClassUID, *str_id) ;
   }
   for (pN2 = pRoot->GetFirstChild() ; pN2 ; pN2 = pN2->Sibling())
   {
       if (!pN2->NameEQ("member"))
           { report.Printf("<class> only <member> allowed. %s unexpected\n", pN2->txtName()) ; continue ; }
       str_id = str_uid = str_min = str_max = str_typ = str_sub = str_nam = (char*) 0;
       for (ai = pN2 ; ai.Valid() ; ai.Advance())
       {
           if      (ai.NameEQ("posn"))     str_id = ai.Value() ;
           else if (ai.NameEQ("uid"))      str_uid = ai.Value() ;
           else if (ai.NameEQ("min"))      str_min = ai.Value() ;
           else if (ai.NameEQ("max"))      str_max = ai.Value() ;
           else if (ai.NameEQ("datatype")) str_typ = ai.Value() ;
           else if (ai.NameEQ("subclass")) str_sub = ai.Value() ;
           else if (ai.NameEQ("name"))     str_nam = ai.Value() ;
           else
               report.Printf("Line %d: <member> bad param %s=%s\n", pN2->Line(), ai.Name(), ai.Value()) ;
       }
       if (!str_id)    report.Printf("No member position suplied (line %d)\n", pN2->Line()) ;
       if (!str_uid)   report.Printf("No member UID suplied (line %d)\n", pN2->Line()) ;
       if (!str_min)   report.Printf("No member min pop suplied (line %d)\n", pN2->Line()) ;
       if (!str_max)   report.Printf("No member max pop suplied (line %d)\n", pN2->Line()) ;
       if (!str_nam)   report.Printf("No member name suplied (line %d)\n", pN2->Line()) ;
       if (!IsInteger(n, *str_id))     report.Printf("Illegal member position: Must be integer 0+ (line %d)\n", pN2->Line()) ;
       if (!IsInteger(n, *str_uid))    report.Printf("Illegal member ID: Must be integer 0+ (line %d)\n", pN2->Line()) ;
       if (!IsInteger(n, *str_min))    report.Printf("Illegal member min-POP: Must be integer 0+ (line %d)\n", pN2->Line()) ;
       if (!IsInteger(n, *str_max))    report.Printf("Illegal member max-POP: Must be integer 0+ (line %d)\n", pN2->Line()) ;
       if (!str_typ)
           str_typ = str_sub ;
       pType = m_pADP->GetDatatype(str_typ) ;
       if (!pType)
           report.Printf("<member> No such data type or sub-class as %s\n", pN2->Line(), *str_typ) ;
   }
   if (report.Size())
       return E_FORMAT ;
   return E_OK ;
}