summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/Glob.hxx.in
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-08-21 18:17:58 (GMT)
committerBrad King <brad.king@kitware.com>2006-08-21 18:17:58 (GMT)
commitf1ea7e88dc8322d4344e6b7acde6bf7bcffd7806 (patch)
tree38896ce80fa14e5c7e2dabd2842ff40332675afd /Source/kwsys/Glob.hxx.in
parent07fa9ac09c69b098af08429eccaf332c15b97f1e (diff)
downloadCMake-f1ea7e88dc8322d4344e6b7acde6bf7bcffd7806.zip
CMake-f1ea7e88dc8322d4344e6b7acde6bf7bcffd7806.tar.gz
CMake-f1ea7e88dc8322d4344e6b7acde6bf7bcffd7806.tar.bz2
ENH: Exposed pattern->regex API. Cleaned up and commented implementation of pattern->regex conversion.
Diffstat (limited to 'Source/kwsys/Glob.hxx.in')
-rw-r--r--Source/kwsys/Glob.hxx.in18
1 files changed, 10 insertions, 8 deletions
diff --git a/Source/kwsys/Glob.hxx.in b/Source/kwsys/Glob.hxx.in
index 728276f..6bb740d 100644
--- a/Source/kwsys/Glob.hxx.in
+++ b/Source/kwsys/Glob.hxx.in
@@ -61,6 +61,16 @@ public:
void SetRelative(const char* dir);
const char* GetRelative();
+ /** Convert the given globbing pattern to a regular expression.
+ There is no way to quote meta-characters. The
+ require_whole_string argument specifies whether the regex is
+ automatically surrounded by "^" and "$" to match the whole
+ string. This is on by default because patterns always match
+ whole strings, but may be disabled to support concatenating
+ expressions more easily (regex1|regex2|etc). */
+ static kwsys_stl::string PatternToRegex(const kwsys_stl::string& pattern,
+ bool require_whole_string = true);
+
protected:
//! Process directory
void ProcessDirectory(kwsys_stl::string::size_type start,
@@ -71,14 +81,6 @@ protected:
void RecurseDirectory(kwsys_stl::string::size_type start,
const kwsys_stl::string& dir, bool dir_only);
- //! Escape all non-alphanumeric characters in pattern.
- void Escape(int ch, char* buffer);
-
- //!
- // Translate a shell PATTERN to a regular expression.
- // There is no way to quote meta-characters.
- kwsys_stl::string ConvertExpression(const kwsys_stl::string& expr);
-
//! Add regular expression
void AddExpression(const char* expr);