1 /***************************************************************
2  * Name:      ThreadSearchFindData
3  *
4  * Purpose:   This class stores search data.
5  *
6  * Author:    Jerome ANTOINE
7  * Created:   2007-10-08
8  * Copyright: Jerome ANTOINE
9  * License:   GPL
10  **************************************************************/
11 
12 #ifndef THREAD_SEARCH_FIND_DATA_H
13 #define THREAD_SEARCH_FIND_DATA_H
14 
15 
16 #include <wx/string.h>
17 
18 // Possible search scopes.
19 enum eSearchScope
20 {
21     ScopeOpenFiles      = 1,
22     ScopeProjectFiles   = 2,
23     ScopeWorkspaceFiles = 4,
24     ScopeDirectoryFiles = 8,
25     ScopeTargetFiles    = 16
26 };
27 
28 // No comments, basic class
29 class ThreadSearchFindData
30 {
31 public:
32     ThreadSearchFindData();
33     ThreadSearchFindData(const ThreadSearchFindData& findData);
34     ThreadSearchFindData& operator= (const ThreadSearchFindData& findData);
35 
~ThreadSearchFindData()36     ~ThreadSearchFindData() {}
37 
38     void UpdateSearchScope(eSearchScope scope, bool bValue);
MustSearchInOpenFiles()39     bool MustSearchInOpenFiles() {return (m_Scope & ScopeOpenFiles)      != 0;}
MustSearchInProject()40     bool MustSearchInProject  () {return (m_Scope & ScopeProjectFiles)   != 0;}
MustSearchInWorkspace()41     bool MustSearchInWorkspace() {return (m_Scope & ScopeWorkspaceFiles) != 0;}
MustSearchInDirectory()42     bool MustSearchInDirectory() {return (m_Scope & ScopeDirectoryFiles) != 0;}
MustSearchInTarget()43     bool MustSearchInTarget   () {return (m_Scope & ScopeTargetFiles)    != 0;}
44 
45     // Setters
SetFindText(const wxString & findText)46     void SetFindText       (const wxString& findText)   {m_FindText        = findText;}
SetMatchWord(bool matchWord)47     void SetMatchWord      (bool matchWord)             {m_MatchWord       = matchWord;}
SetStartWord(bool startWord)48     void SetStartWord      (bool startWord)             {m_StartWord       = startWord;}
SetMatchCase(bool matchCase)49     void SetMatchCase      (bool matchCase)             {m_MatchCase       = matchCase;}
SetRegEx(bool regEx)50     void SetRegEx          (bool regEx)                 {m_RegEx           = regEx;}
SetScope(int scope)51     void SetScope          (int scope)                  {m_Scope           = scope;}
SetSearchPath(const wxString & searchPath)52     void SetSearchPath     (const wxString& searchPath) {m_SearchPath      = searchPath;}
SetSearchMask(const wxString & searchMask)53     void SetSearchMask     (const wxString& searchMask) {m_SearchMask      = searchMask;}
SetRecursiveSearch(bool recursiveSearch)54     void SetRecursiveSearch(bool recursiveSearch)       {m_RecursiveSearch = recursiveSearch;}
SetHiddenSearch(bool hiddenSearch)55     void SetHiddenSearch   (bool hiddenSearch)          {m_HiddenSearch    = hiddenSearch;}
56 
GetFindText()57     wxString GetFindText()        const {return m_FindText;}
GetMatchWord()58     bool     GetMatchWord()       const {return m_MatchWord;}
GetStartWord()59     bool     GetStartWord()       const {return m_StartWord;}
GetMatchCase()60     bool     GetMatchCase()       const {return m_MatchCase;}
GetRegEx()61     bool     GetRegEx()           const {return m_RegEx;}
GetScope()62     int      GetScope()           const {return m_Scope;}
GetSearchMask()63     wxString GetSearchMask()      const {return m_SearchMask;}
GetRecursiveSearch()64     bool     GetRecursiveSearch() const {return m_RecursiveSearch;}
GetHiddenSearch()65     bool     GetHiddenSearch()    const {return m_HiddenSearch;}
66 
67     wxString GetSearchPath(bool bExpanded = false) const;
68 
69     bool IsOptionEnabled() const;
70 
71 private:
72     wxString m_FindText;
73     bool     m_MatchWord;
74     bool     m_StartWord;
75     bool     m_MatchCase;
76     bool     m_RegEx;
77     int      m_Scope;
78     wxString m_SearchPath;
79     wxString m_SearchMask;
80     bool     m_RecursiveSearch;
81     bool     m_HiddenSearch;
82 };
83 
84 #endif // THREAD_SEARCH_FIND_DATA_H
85