while (pWild != pWildEnd)
{ switch (*pWild)
{ case'?': if ( pStr == pStrEnd ) returnfalse; break; // Match -> proceed to the next character case'\\': // Escaping '?' and '*'; don't we need to escape '\\'? if ((pWild + 1 != pWildEnd) && ((*(pWild + 1) == '?') || (*(pWild + 1) == '*')))
pWild++;
[[fallthrough]]; default: // No wildcard, literal match if (pStr == pStrEnd) returnfalse; if (*pWild == *pStr) break; // Match -> proceed to the next character if (!pPosAfterAsterisk) returnfalse;
pWild = pPosAfterAsterisk;
[[fallthrough]]; case'*': while ( pWild != pWildEnd && *pWild == '*' )
pWild++; if ( pWild == pWildEnd ) returntrue; // Consider strange things like "**?*?*" while (*pWild == '?')
{ if (pStr == pStrEnd) returnfalse;
pWild++;
pStr++; while (pWild != pWildEnd && *pWild == '*')
pWild++; if (pWild == pWildEnd) returntrue;
} // At this point, we are past wildcards, and a literal match must follow if ( pStr == pStrEnd ) returnfalse;
pPosAfterAsterisk = pWild; if ((*pWild == '\\') && (pWild + 1 != pWildEnd) && ((*(pWild + 1) == '?') || (*(pWild + 1) == '*')))
pWild++; while (*pStr != *pWild)
{
pStr++; if ( pStr == pStrEnd ) returnfalse;
} break; // Match -> proceed to the next character
} // We arrive here when the current characters in pWild and pStr match
assert(pWild != pWildEnd);
pWild++;
assert(pStr != pStrEnd);
pStr++; if (pWild == pWildEnd && pPosAfterAsterisk && pStr != pStrEnd)
pWild = pPosAfterAsterisk; // Try again on the rest of pStr
}
assert(pWild == pWildEnd); return pStr == pStrEnd;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.