summaryrefslogtreecommitdiffstats
path: root/Glob.hxx.in
diff options
context:
space:
mode:
authorKWSys Robot <kwrobot@kitware.com>2015-03-03 13:50:09 (GMT)
committerBrad King <brad.king@kitware.com>2015-03-04 13:53:20 (GMT)
commitaa84d26e631e11d73328c24ac0301c43f661869b (patch)
treecfceaf416b380e0a2c350fa68793436ec3d59bd1 /Glob.hxx.in
parent7c9afb573844fdef0a8c29bb7f8c4474b910d83f (diff)
downloadCMake-aa84d26e631e11d73328c24ac0301c43f661869b.zip
CMake-aa84d26e631e11d73328c24ac0301c43f661869b.tar.gz
CMake-aa84d26e631e11d73328c24ac0301c43f661869b.tar.bz2
KWSys 2015-03-03 (4890f30c)
Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 4890f30c | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' d2aa1afd..4890f30c Domen Vrankar (2): 5d6204e9 Glob: Handle symlink cycles in directory paths 4890f30c Glob: Add support for directory listing Change-Id: Id8b77dabf8f50efeffdeaf1c826154fd2a25e17b
Diffstat (limited to 'Glob.hxx.in')
-rw-r--r--Glob.hxx.in47
1 files changed, 43 insertions, 4 deletions
diff --git a/Glob.hxx.in b/Glob.hxx.in
index d8b8491..39b7ce7 100644
--- a/Glob.hxx.in
+++ b/Glob.hxx.in
@@ -40,11 +40,36 @@ class GlobInternals;
class @KWSYS_NAMESPACE@_EXPORT Glob
{
public:
+ enum MessageType
+ {
+ error,
+ cyclicRecursion
+ };
+
+ struct Message
+ {
+ MessageType type;
+ kwsys_stl::string content;
+
+ Message(MessageType t, const kwsys_stl::string& c) :
+ type(t),
+ content(c)
+ {}
+ Message(const Message& msg) :
+ type(msg.type),
+ content(msg.content)
+ {}
+ };
+
+ typedef kwsys_stl::vector<Message> GlobMessages;
+ typedef kwsys_stl::vector<Message>::iterator GlobMessagesIterator;
+public:
Glob();
~Glob();
//! Find all files that match the pattern.
- bool FindFiles(const kwsys_stl::string& inexpr);
+ bool FindFiles(const kwsys_stl::string& inexpr,
+ GlobMessages* messages = 0);
//! Return the list of files that matched.
kwsys_stl::vector<kwsys_stl::string>& GetFiles();
@@ -80,15 +105,26 @@ public:
bool require_whole_string = true,
bool preserve_case = false);
+ /** Getters and setters for enabling and disabling directory
+ listing in recursive and non recursive globbing mode.
+ If listing is enabled in recursive mode it also lists
+ directory symbolic links even if follow symlinks is enabled. */
+ void SetListDirs(bool list) { this->ListDirs=list; }
+ bool GetListDirs() const { return this->ListDirs; }
+ void SetRecurseListDirs(bool list) { this->RecurseListDirs=list; }
+ bool GetRecurseListDirs() const { return this->RecurseListDirs; }
+
protected:
//! Process directory
void ProcessDirectory(kwsys_stl::string::size_type start,
- const kwsys_stl::string& dir);
+ const kwsys_stl::string& dir,
+ GlobMessages* messages);
//! Process last directory, but only when recurse flags is on. That is
// effectively like saying: /path/to/file/**/file
- void RecurseDirectory(kwsys_stl::string::size_type start,
- const kwsys_stl::string& dir);
+ bool RecurseDirectory(kwsys_stl::string::size_type start,
+ const kwsys_stl::string& dir,
+ GlobMessages* messages);
//! Add regular expression
void AddExpression(const kwsys_stl::string& expr);
@@ -101,6 +137,9 @@ protected:
kwsys_stl::string Relative;
bool RecurseThroughSymlinks;
unsigned int FollowedSymlinkCount;
+ kwsys_stl::vector<kwsys_stl::string> VisitedSymlinks;
+ bool ListDirs;
+ bool RecurseListDirs;
private:
Glob(const Glob&); // Not implemented.