8 bool cmp(char c, char h);
11 bool cmp<true>(char c, char h)
12 { return tolower(c)==tolower(h); }
15 bool cmp<false>(char c, char h)
19 bool globmatch(string::const_iterator pat_i, const string::const_iterator &pat_e, string::const_iterator str_i, const string::const_iterator &str_e)
21 while(pat_i!=pat_e && str_i!=str_e)
23 if(*pat_i=='?' || cmp<icase>(*str_i, *pat_i))
34 for(; str_i!=str_e; ++str_i)
35 if(cmp<icase>(*str_i, *pat_i) && globmatch<icase>(pat_i, pat_e, str_i, str_e))
44 return pat_i==pat_e && str_i==str_e;
51 bool globmatch(const string &pat, const string &str)
53 return ::globmatch<false>(pat.begin(), pat.end(), str.begin(), str.end());
56 bool globcasematch(const string &pat, const string &str)
58 return ::globmatch<true>(pat.begin(), pat.end(), str.begin(), str.end());