Scans a string looking for percent entities to test. If none found then the supplied text is automatically deemed valid. If there are percent entities, these are tested for valididity by calling PcEntTest(). If any of these are invalid or out of scope the supplied string is deemed invalid.

Return TypeFunction nameArguments
hzEcodehdsApp::PcEntScanStr(hzString&,hdsFormdef*,hdbClass*,hzString&,)

Declared in file: hzDissemino.h
Defined in file : hdsSystem.cpp

Function Logic:

0:START 1:unknown 2:unknown 3:unknown 4:i 5:unknown 6:unknown 7:peType 8:unknown 9:rc items 10:i 11:rc items 12:items 13:err 14:Return rc

Function body:

hzEcode hdsApp::PcEntScanStr (hzString& err)hdsFormdef* pFormdef, hdbClass* pHost, hzString& input, 
{
   //  Scans a string looking for percent entities to test. If none found then the supplied text is automatically deemed valid. If there are percent entities,
   //  these are tested for valididity by calling PcEntTest(). If any of these are invalid or out of scope the supplied string is deemed invalid.
   //  
   //  Arguments: 1) err  The error report string.
   //     2) pFormdef The currently applicable form (if any)
   //     3) pHost The currently applicable class. If this is NULL the class will be that of the supplied form (if any)
   //     4) input The input text
   //  
   //  Returns: E_FORMAT If the input is not of the form %a:a
   //     E_NOTFOUND If the percent entity does not reference an actual entity
   //     E_OK  If the supplied input contain no percent entities or valid percent entities.
   _hzfunc("hdsApp::PcEntScanStr") ;
   hzChain         erep ;          //  For error report
   const char*     i ;             //  Input iterator
   hzString        pcntEnt ;       //  Current percent entity
   hzString        cerr ;          //  Current entity error
   hdbBasetype     peType ;        //  Returned datatype
   hzEcode         rc = E_OK ;     //  Return code
   for (i = *input ; *i ;)
   {
       if (*i == CHAR_PERCENT)
       {
           if (i[1]== CHAR_PERCENT)
               { i += 2; continue ; }
           if (IsAlpha(i[1])&& i[2]== CHAR_COLON && IsAlpha(i[3]))
           {
               if (IsPcEnt(pcntEnt, i))
               {
                   peType = PcEntTest(cerr, pFormdef, pHost, pcntEnt) ;
                   if (peType == BASETYPE_UNDEF)
                       { rc = E_NOTFOUND ; erep.Printf("(%s %s)", *pcntEnt, *cerr) ; }
                   else
                       { i += pcntEnt.Length() ; continue ; }
               }
               else
               {
                   //  Sonething like %a:a but is not actually a percent entity is not allowed
                   rc = E_FORMAT ;
                   erep.Printf("(%c%c%c%c - malformed percent entity)", i[0],i[1],i[2],i[3]);
               }
           }
       }
       i++ ;
   }
   err = erep ;
   return rc ;
}