• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/amule/wxWidgets-2.8.12/src/common/

Lines Matching refs:pattern

13 //	wxIsWild(const char *pattern)
14 // wxMatchWild(const char *pattern, const char *str, bool dot_special)
34 * wxIsWild checks whether the pattern contains wildcards, and
36 * pattern is NULL -- i.e. no string).
40 * 1) pattern - a character string
43 wxIsWild (const char *pattern)
45 while (*pattern)
47 switch (*pattern++)
58 if (!*pattern++)
83 wxMatchWild (const char *pattern, const char *str, bool dot_special)
92 if (strcmp(pattern, "*.*") == 0)
93 pattern = "*"; // Hack for MS-DOS compat.
97 if (dot_special && *str == '.' && *pattern != *str)
100 while ((*pattern != '\0') && (!done) && (((*str == '\0') &&
101 ((*pattern == OB) || (*pattern == '*'))) || (*str != '\0')))
103 switch (*pattern)
106 pattern++;
107 if (*pattern != '\0')
108 pattern++;
111 pattern++;
113 while ((*str != '\0') && (!(ret_code = wxMatchWild (pattern, str++, FALSE))));
118 while (*pattern != '\0')
119 pattern++;
123 pattern++;
125 if ((*pattern == '\0') || (*pattern == ']'))
130 if (*pattern == '\\')
132 pattern++;
133 if (*pattern == '\0')
139 if (*(pattern + 1) == '-')
141 c = *pattern;
142 pattern += 2;
143 if (*pattern == ']')
148 if (*pattern == '\\')
150 pattern++;
151 if (*pattern == '\0')
157 if ((*str < c) || (*str > *pattern))
159 pattern++;
163 else if (*pattern != *str)
165 pattern++;
168 pattern++;
169 while ((*pattern != ']') && (*pattern != '\0'))
171 if ((*pattern == '\\') && (*(pattern + 1) != '\0'))
172 pattern++;
173 pattern++;
175 if (*pattern != '\0')
177 pattern++, str++;
181 pattern++;
185 pattern++;
186 while ((*pattern != CB) && (*pattern != '\0'))
190 while (ok && (*cp != '\0') && (*pattern != '\0') &&
191 (*pattern != ',') && (*pattern != CB))
193 if (*pattern == '\\')
194 pattern++;
195 ok = (*pattern++ == *cp++);
197 if (*pattern == '\0')
206 while ((*pattern != CB) && (*pattern != '\0'))
208 if (*++pattern == '\\')
210 if (*++pattern == CB)
211 pattern++;
217 while (*pattern != CB && *pattern != ',' && *pattern != '\0')
219 if (*++pattern == '\\')
221 if (*++pattern == CB || *pattern == ',')
222 pattern++;
226 if (*pattern != '\0')
227 pattern++;
231 if (*str == *pattern)
233 str++, pattern++;
241 while (*pattern == '*')
242 pattern++;
243 return ((*str == '\0') && (*pattern == '\0'));
249 * wxMatchWild matches the given pattern string against
253 * The pattern can contain the following wildcards.
262 static bool wxPatternMatch (const char *pattern, const char *text, size_t i, size_t j);
266 wxMatchWild (const char *pattern, const char *text, bool /* dotSpecial */ )
268 if (pattern == NULL || text == NULL || *pattern == '\0' || *text == '\0')
270 return wxPatternMatch (pattern, text, 0, 0);
276 * the given pattern string against a text string, and returns TRUE if
281 * The pattern can contain the following wildcards.
286 * wxPatternMatch works by going down the pattern trying to match the
287 * the same index character in the pattern and string arrays, and stops
288 * when the end of the pattern or text string is reached. However, if a
290 * pattern (after the wildcard) matches the rest of the text (i.e. the
295 wxPatternMatch (const char *pattern, const char *text, size_t i, size_t j)
297 size_t pattern_length = strlen (pattern);
310 if (EQU(text[i], pattern[j]) || pattern[j] == '?')
315 else if (pattern[j] == '*')
317 // If pattern ends in '*'
326 // after wildcard check to see whether rest of pattern matches
330 match = wxPatternMatch (pattern, text, i, j);
334 // the text string starts to match the rest of the pattern
338 else if (! EQU(text[i], pattern[j]))
349 // special case where pattern and text are the same except that pattern
351 if (i == text_length && pattern[j] == '*' && match == TRUE)
355 if (pattern[j] != '*')