diff options
author | Brad King <brad.king@kitware.com> | 2015-03-04 13:53:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-03-04 13:53:24 (GMT) |
commit | 44ef47000eb4f4ac7b4fc041afd3579ebe355469 (patch) | |
tree | eae650b9fa154c1f049cc67f7f779d0a73e8b173 /Source/kwsys/Glob.hxx.in | |
parent | df5def5334249eb01195c1f24f3e728519dc742c (diff) | |
parent | aa84d26e631e11d73328c24ac0301c43f661869b (diff) | |
download | CMake-44ef47000eb4f4ac7b4fc041afd3579ebe355469.zip CMake-44ef47000eb4f4ac7b4fc041afd3579ebe355469.tar.gz CMake-44ef47000eb4f4ac7b4fc041afd3579ebe355469.tar.bz2 |
Merge branch 'upstream-kwsys' into update-kwsys
Diffstat (limited to 'Source/kwsys/Glob.hxx.in')
-rw-r--r-- | Source/kwsys/Glob.hxx.in | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/Source/kwsys/Glob.hxx.in b/Source/kwsys/Glob.hxx.in index d8b8491..39b7ce7 100644 --- a/Source/kwsys/Glob.hxx.in +++ b/Source/kwsys/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. |