]> Dogcows Code - chaz/yoink/blob - src/stlplus/portability/wildcard.hpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / portability / wildcard.hpp
1 #ifndef STLPLUS_WILDCARD
2 #define STLPLUS_WILDCARD
3 ////////////////////////////////////////////////////////////////////////////////
4
5 // Author: Andy Rushton
6 // Copyright: (c) Southampton University 1999-2004
7 // (c) Andy Rushton 2004-2009
8 // License: BSD License, see ../docs/license.html
9
10 // This is a portable interface to wildcard matching.
11
12 // The problem:
13 // * matches any number of characters - this is achieved by matching 1 and seeing if the remainder matches
14 // if not, try 2 characters and see if the remainder matches etc.
15 // this must be recursive, not iterative, so that multiple *s can appear in the same wildcard expression
16 // ? matches exactly one character so doesn't need the what-if approach
17 // \ escapes special characters such as *, ? and [
18 // [] matches exactly one character in the set - the difficulty is the set can contain ranges, e.g [a-zA-Z0-9]
19 // a set cannot be empty and the ] character can be included by making it the first character
20
21 ////////////////////////////////////////////////////////////////////////////////
22 #include "portability_fixes.hpp"
23 #include <string>
24
25 namespace stlplus
26 {
27
28 // wild = the wildcard expression
29 // match = the string to test against that expression
30 // e.g. wildcard("[a-f]*", "fred") returns true
31 bool wildcard(const std::string& wild, const std::string& match);
32
33 }
34
35 #endif
This page took 0.029973 seconds and 4 git commands to generate.