Return TypeFunction nameArguments
boolFormCheckDate(hzXDate&,const char*,const char*,)

Declared in file: hzTextproc.h
Defined in file : hzRegex.cpp

Function Logic:

0:START 1:hzXDate::Clear 2:!cpCtrl||!cpCtrl[0] 3:Return true 4:!cpTest||!cpTest[0] 5:Return false 6:test ctrl 7:*test&&*ctrl; 8:*ctrl=='*' 9:*ctrl=='*'; 10:*test; 11:FormCheckDate(xdate,test,ctrl) 12:Return true 13:Return false 14:*ctrl=='?' 15:items items 16:*ctrl=='{' 17:!_set_psudo_date(pd,&test,&ctrl) 18:Return false 19:*ctrl==(char)92 20:ctrl[1]==(char)92 21:*test==(char)92 22:items ctrl 23:ctrl[1]=='n' 24:*test==(char)10 25:items ctrl 26:ctrl[1]=='s' 27:*test==(char)12||*test==(char)10||*test==(char)13||*test==(char)9||*test==(char)11 28:items ctrl 29:ctrl[1]=='S' 30:*test>(char)32 31:items ctrl 32:ctrl[1]=='c' 33:ctrl[2]>='a'&&ctrl[2]<='z' 34:*test==(ctrl[2]-'a') 35:items ctrl 36:ctrl[2]>='A'&&ctrl[2]<='Z' 37:*test==(ctrl[2]-'A') 38:items ctrl 39:*test=='c' 40:items ctrl 41:ctrl[1]=='x' 42:IsHexnum(val,ctrl+1) 43:*test==(uchar)(val&0xff) 44:items ctrl 45:ctrl[1]=='t' 46:*test==(char)9 47:items ctrl 48:ctrl[1]=='v' 49:*test==(char)9 50:items ctrl 51:*test==ctrl[1] 52:items ctrl 53:*test==*ctrl 54:items items 55:Return false 56:pd.Y||pd.M||pd.D 57:pd.Y&&pd.M&&pd.D 58:hzXDate::SetDate 59:pd.Y&&pd.M&&!pd.D 60:hzXDate::SetDate 61:pd.Y&&!pd.M&&pd.D 62:hzXDate::Clear 63:pd.Y&&!pd.M&&!pd.D 64:hzXDate::Clear 65:!pd.Y&&pd.M&&pd.D 66:xdate.IsSet() 67:hzXDate::Year pd 68:hzXDate::SysDateTime hzXDate::Year pd 69:hzXDate::SetDate 70:!pd.Y&&pd.M&&!pd.D 71:hzXDate::Clear 72:!pd.Y&&!pd.M&&pd.D 73:hzXDate::Clear 74:!pd.Y&&!pd.M&&!pd.D 75:hzXDate::Clear hzXDate::IsSet 76:!xdate.IsSet() 77:Return false 78:Return true

Function body:

bool FormCheckDate (hzXDate& xdate, const char* cpTest, const char* cpCtrl)
{
   _hzfunc(__func__) ;
   _psudoDate  pd ;
   const char* ctrl ;
   const char* test ;
   uint32_t    val ;
   xdate.Clear() ;
   if (!cpCtrl || !cpCtrl[0])  return true ;
   if (!cpTest || !cpTest[0])  return false ;
   test = cpTest ;
   ctrl = cpCtrl ;
   for (; *test && *ctrl ;)
   {
       if (*ctrl == ''*'')
       {
           for (; *ctrl == ''*'';ctrl++) ;
           for (; *test ; test++)
           {
               if (FormCheckDate(xdate, test, ctrl))
                   return true ;
           }
           return false ;
       }
       if (*ctrl == ''?'')
           { test++ ; ctrl++ ; continue ; }
       if (*ctrl == ''{'')
       {
           if (!_set_psudo_date(pd, &test, &ctrl))
               return false ;
           continue ;
       }
       if (*ctrl == CHAR_BKSLASH)
       {
           if (ctrl[1]== CHAR_BKSLASH)
               if (*test == CHAR_BKSLASH)
                   { test++ ; ctrl += 2; continue ; }
           if (ctrl[1]== ''n'')
               if (*test == CHAR_NL)
                   { test++ ; ctrl += 2; continue ; }
           if (ctrl[1]== ''s'')
               if (*test == CHAR_CTRLL || *test == CHAR_NL || *test == CHAR_CR || *test == CHAR_TAB || *test == CHAR_CTRLK)
                   { test++ ; ctrl += 2; continue ; }
           if (ctrl[1]== ''S'')
               if (*test > CHAR_SPACE)
                   { test++ ; ctrl += 2; continue ; }
           if (ctrl[1]== ''c'')
           {
               if (ctrl[2]>&eq; ''a''&&ctrl[2]<&eq; ''z'')
                   if (*test == (ctrl[2]-''a''))
                       { test++ ; ctrl += 3; continue ; }
               if (ctrl[2]>&eq; ''A''&&ctrl[2]<&eq; ''Z'')
                   if (*test == (ctrl[2]-''A''))
                       { test++ ; ctrl += 3; continue ; }
               if (*test == ''c'')
                   { test++ ; ctrl += 2; continue ; }
           }
           if (ctrl[1]== ''x'')
               if (IsHexnum(val, ctrl+1))
                   if (*test == (uchar) (val & 0xff))
                       { test++ ; ctrl += 4; continue ; }
           if (ctrl[1]== ''t'')
               if (*test == CHAR_TAB)
                   { test++ ; ctrl += 2; continue ; }
           if (ctrl[1]== ''v'')
               if (*test == CHAR_CTRLI)
                   { test++ ; ctrl += 2; continue ; }
           if (*test == ctrl[1])
               { test++ ; ctrl += 2; continue ; }
       }
       if (*test == *ctrl)
           { test++ ; ctrl++ ; continue ; }
       return false ;
   }
   if (pd.Y || pd.M || pd.D)
   {
       if ( pd.Y &&  pd.M &&  pd.D)
           xdate.SetDate(pd.Y, pd.M, pd.D) ;
       else if ( pd.Y &&  pd.M && !pd.D)
           xdate.SetDate(pd.Y, pd.M, 1);
       else if ( pd.Y && !pd.M &&  pd.D)   xdate.Clear() ;
       else if ( pd.Y && !pd.M && !pd.D)   xdate.Clear() ;
       else if (!pd.Y &&  pd.M &&  pd.D)
       {
           if (xdate.IsSet())
               pd.Y = xdate.Year() ;
           else
               { xdate.SysDateTime() ; pd.Y = xdate.Year() ; }
           xdate.SetDate(pd.Y, pd.M, pd.D) ;
       }
       else if (!pd.Y &&  pd.M && !pd.D)   xdate.Clear() ;
       else if (!pd.Y && !pd.M &&  pd.D)   xdate.Clear() ;
       else if (!pd.Y && !pd.M && !pd.D)   xdate.Clear() ;
       if (!xdate.IsSet())
           return false ;
   }
   return true ;
}