Core: LanguageInfo completely refactored

git-svn-id: svn://ultimatepp.org/upp/trunk@1810 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-12-13 22:16:46 +00:00
parent acd590d240
commit 4e19e35baa
9 changed files with 956 additions and 1005 deletions

View file

@ -1305,4 +1305,36 @@ String GetRelativePath(String fn, String pathlist, String curdir)
return fn.Mid(GetRelativePathPos(fn, curdir));
}
WildcardCompare::WildcardCompare(const wchar *templ)
{
raw_templ = templ;
cvt_templ = ToUpper(raw_templ);
}
bool WildcardCompare::RawMatches(const wchar *s, const wchar *templ) const
{
for(;;)
switch(*templ++)
{
case 0: return true;
case '.': if(*templ == 0) return *s == 0; // force end of string
case '?': if(*s++ == 0) return false; break;
case '*':
do
if(RawMatches(s, templ))
return true;
while(*s++);
return false;
case '\\':
if(*templ == 0 || *templ++ != *s++)
return false;
break;
default:
if(templ[-1] != ToUpper(*s++))
return false;
break;
}
return true;
}
END_UPP_NAMESPACE