Code::Blocks  SVN r11506
coderefactoring.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  */
5 
6 #ifndef CODEREFACTORING_H
7 #define CODEREFACTORING_H
8 
9 #include "nativeparser.h"
10 
12 {
13  int pos;
14  int line;
16  crSearchData(int pos_in, int line_in, const wxString& text_in) :
17  pos(pos_in),
18  line(line_in),
19  text(text_in)
20  {}
21 };
22 
24 {
25  typedef std::list<crSearchData> SearchDataList;
26  typedef std::map<wxString, SearchDataList> SearchDataMap;
27 
28 public:
30  virtual ~CodeRefactoring();
31 
32  void FindReferences();
33  void RenameSymbols();
34 
35 private:
36  size_t SearchInFiles(const wxArrayString& files, const wxString& targetText);
37  size_t VerifyResult(const TokenIdxSet& targetResult, const wxString& targetText, bool isLocalVariable);
38  void Find(cbStyledTextCtrl* control, const wxString& file, const wxString& target);
39  wxString GetSymbolUnderCursor();
40 
41  void DoFindReferences();
42  void DoRenameSymbols(const wxString& targetText, const wxString& replaceText);
43 
44 private:
45  void GetAllProjectFiles(wxArrayString& files, cbProject* project);
46  void GetOpenedFiles(wxArrayString& files);
47  bool Parse();
48 
49 private:
51  SearchDataMap m_SearchDataMap;
52 };
53 
54 #endif // CODEREFACTORING_H
NativeParser & m_NativeParser
std::map< wxString, SearchDataList > SearchDataMap
crSearchData(int pos_in, int line_in, const wxString &text_in)
Represents a Code::Blocks project.
Definition: cbproject.h:96
std::set< int, std::less< int > > TokenIdxSet
Definition: token.h:16
std::list< crSearchData > SearchDataList
NativeParser class is just like a manager class to control Parser objects.
Definition: nativeparser.h:55
SearchDataMap m_SearchDataMap