This determines if the implied string (at the current supplied chain iterator) is of the supplied form
| Return Type | Function name | Arguments |
|---|---|---|
| uint32_t | FormCheckChain | (hzChain::Iter&,const char*,) |
Declared in file: hzTextproc.h
Defined in file : hzRegex.cpp
Function Logic:
Function body:
uint32_t FormCheckChain (hzChain::Iter& ci)const char* cpCtrl,
{
// Category: Regular Expression
//
// This determines if the implied string (at the current supplied chain iterator) is of the supplied form
//
// Arguments: 1) ci The input chain as chain iterator
// 2) cpCtrl The control string
//
// Returns: Number of chars in the chain that comprise the construct of the supplied form
_hzfunc(__func__) ;
chIter z ; // For processing ctrl string into parts
const char* c ; // Progressive ptr for test string
uint32_t len = 0; // Length of construct
if (!cpCtrl || !cpCtrl[0])
return true ;
if (ci.eof())
return false ;
// Process the CTRL string
for (c = cpCtrl, z = ci ; *c && !z.eof() ;)
{
if (*c == CHAR_QUERY)
{ c++ ; len++ ; z++ ; continue ; }
if (*c == CHAR_SQOPEN)
{
if (memcmp(c, "[0-9]", 5)== 0&& *z >&eq; ''0''&&*z <&eq; ''9''){c += 5; len++ ; z++ ; continue ; }
if (memcmp(c, "[a-z]", 5)== 0&& *z >&eq; ''a''&&*z <&eq; ''z''){c += 5; len++ ; z++ ; continue ; }
if (memcmp(c, "[A-Z]", 5)== 0&& *z >&eq; ''A''&&*z <&eq; ''Z''){c += 5; len++ ; z++ ; continue ; }
}
if (*c == CHAR_ASTERISK)
{
// Advance the control until no longer on an asterisk. Then look for the first occurence of the control char in the test
for (; *c == CHAR_ASTERISK ; c++) ;
for (; !z.eof() && *z != *c ; len++, z++) ;
continue ;
}
if (*c == *z)
{ c++ ; len++ ; z++ ; continue ; }
break ;
}
if (*c == 0)
return len ;
return 0;
}