summaryrefslogtreecommitdiffstats
path: root/Source/cmGlob.h
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-07-08 18:18:17 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-07-08 18:18:17 (GMT)
commitdb77d2e0192893ad9dda95bec0ebd9d6287fea14 (patch)
tree5aedd49117119e12af9b50647fdb696042d5ab29 /Source/cmGlob.h
parent1a4ec91593b8133897c2741d6dd43b2216ebb590 (diff)
downloadCMake-db77d2e0192893ad9dda95bec0ebd9d6287fea14.zip
CMake-db77d2e0192893ad9dda95bec0ebd9d6287fea14.tar.gz
CMake-db77d2e0192893ad9dda95bec0ebd9d6287fea14.tar.bz2
ENH: Add globbing to FILE command
Diffstat (limited to 'Source/cmGlob.h')
-rw-r--r--Source/cmGlob.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/Source/cmGlob.h b/Source/cmGlob.h
new file mode 100644
index 0000000..1cfa4f8
--- /dev/null
+++ b/Source/cmGlob.h
@@ -0,0 +1,61 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmGlob_h
+#define cmGlob_h
+
+#include "cmStandardIncludes.h"
+
+class cmGlobInternal;
+
+/** \class cmGlob
+ * \brief Helper class for performing globbing searches.
+ *
+ * Finds all files that match a given globbing expression.
+ */
+class cmGlob
+{
+public:
+ cmGlob();
+ ~cmGlob();
+
+ //! Find all files that match the pattern.
+ bool FindFiles(const std::string& inexpr);
+
+ //! Return the list of files that matched.
+ std::vector<std::string>& GetFiles();
+
+protected:
+ //! Process directory
+ void ProcessDirectory(std::string::size_type start,
+ const std::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.
+ std::string ConvertExpression(const std::string& expr);
+
+ //! Add regular expression
+ void AddExpression(const char* expr);
+
+ cmGlobInternal* m_Internals;
+};
+
+
+#endif