]> Dogcows Code - chaz/yoink/blobdiff - src/stlplus/portability/wildcard.hpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / portability / wildcard.hpp
diff --git a/src/stlplus/portability/wildcard.hpp b/src/stlplus/portability/wildcard.hpp
new file mode 100644 (file)
index 0000000..398c3dd
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef STLPLUS_WILDCARD\r
+#define STLPLUS_WILDCARD\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+//   Author:    Andy Rushton\r
+//   Copyright: (c) Southampton University 1999-2004\r
+//              (c) Andy Rushton           2004-2009\r
+//   License:   BSD License, see ../docs/license.html\r
+\r
+//   This is a portable interface to wildcard matching.\r
+\r
+//   The problem:\r
+//     *  matches any number of characters - this is achieved by matching 1 and seeing if the remainder matches\r
+//        if not, try 2 characters and see if the remainder matches etc.\r
+//        this must be recursive, not iterative, so that multiple *s can appear in the same wildcard expression\r
+//     ?  matches exactly one character so doesn't need the what-if approach\r
+//     \  escapes special characters such as *, ? and [\r
+//     [] matches exactly one character in the set - the difficulty is the set can contain ranges, e.g [a-zA-Z0-9]\r
+//        a set cannot be empty and the ] character can be included by making it the first character\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+#include "portability_fixes.hpp"\r
+#include <string>\r
+\r
+namespace stlplus\r
+{\r
+\r
+  // wild = the wildcard expression\r
+  // match = the string to test against that expression\r
+  // e.g. wildcard("[a-f]*", "fred") returns true\r
+  bool wildcard(const std::string& wild, const std::string& match);\r
+\r
+}\r
+\r
+#endif\r
This page took 0.024036 seconds and 4 git commands to generate.