Debian Codegraph @

cppchecker/cppchecker.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : cppchecker.h
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25
26 #ifndef __CppChecker__
27 #define __CppChecker__
28
29 #include "asyncprocess.h"
30 #include "clTabTogglerHelper.h"
31 #include "cppcheck_settings.h"
32 #include "plugin.h"
33
34 class wxMenuItem;
35 class CppCheckReportPage;
36
37 class CppCheckPlugin : public IPlugin
38 {
39 wxString m_cppcheckPath;
40 IProcess* m_cppcheckProcess;
41 bool m_canRestart;
42 wxArrayString m_filelist;
43 wxMenuItem* m_explorerSepItem;
44 wxMenuItem* m_workspaceSepItem;
45 wxMenuItem* m_projectSepItem;
46 CppCheckReportPage* m_view;
47 bool m_analysisInProgress;
48 size_t m_fileCount;
49 CppCheckSettings m_settings;
50 size_t m_fileProcessed;
51 clTabTogglerHelper::Ptr_t m_tabHelper;
52
53 protected:
54 wxString DoGetCommand(ProjectPtr proj);
55 wxString DoGenerateFileList();
56
57 protected:
58 wxMenu* CreateEditorPopMenu();
59 wxMenu* CreateFileExplorerPopMenu();
60 wxMenu* CreateWorkspacePopMenu();
61 wxMenu* CreateProjectPopMenu();
62
63 protected:
64 void GetFileListFromDir(const wxString& root);
65 void RemoveExcludedFiles();
66 void SetTabVisible(bool clearContent);
67 void DoProcess(ProjectPtr proj);
68 void DoStartTest(ProjectPtr proj = NULL);
69 ProjectPtr FindSelectedProject();
70 void DoSettingsItem(ProjectPtr project = NULL);
71
72 protected:
73 /**
74 * @brief handle the context meun activation from within the editor context menu
75 * @param e
76 */
77 void OnCheckFileEditorItem(wxCommandEvent& e);
78
79 /**
80 * @brief handle the context meun activation from within the file explorer
81 * @param e
82 */
83 void OnCheckFileExplorerItem(wxCommandEvent& e);
84
85 /**
86 * @brief handle the context meun activation from the workspace
87 * @param e
88 */
89 void OnCheckWorkspaceItem(wxCommandEvent& e);
90
91 /**
92 * @brief handle the context meun activation from the project
93 * @param e
94 */
95 void OnCheckProjectItem(wxCommandEvent& e);
96
97 /**
98 * @brief handles the cppcheck process termination
99 * @param e
100 */
101 void OnCppCheckTerminated(clProcessEvent& e);
102
103 /**
104 * @brief there is data to read from the process
105 * @param e
106 */
107 void OnCppCheckReadData(clProcessEvent& e);
108
109 /**
110 * @brief handle the workspace closed event and clear the view
111 * @param e
112 */
113 void OnWorkspaceClosed(clWorkspaceEvent& e);
114 /**
115 * @brief handle the settings item
116 * @param e event
117 */
118 void OnSettingsItem(wxCommandEvent& e);
119 /**
120 * @brief handle the settings item from a project context menu
121 * @param e event
122 */
123 void OnSettingsItemProject(wxCommandEvent& e);
124
125 /**
126 * @brief editor context menu is about to be shown.
127 * Append our content if the active editor is a Cxx file
128 */
129 void OnEditorContextMenu(clContextMenuEvent& event);
130
131 public:
132 CppCheckPlugin(IManager* manager);
133 ~CppCheckPlugin();
134
135 //--------------------------------------------
136 // Abstract methods
137 //--------------------------------------------
138 virtual void CreateToolBar(clToolBarGeneric* toolbar);
139 virtual void CreatePluginMenu(wxMenu* pluginsMenu);
140 virtual void HookPopupMenu(wxMenu* menu, MenuType type);
141 virtual void UnPlug();
142
143 /**
144 * @brief stop the analysis of the current file
145 * and clear the queue
146 */
147 void StopAnalysis();
148 /**
149 * @brief return true if analysis currently running
150 */
151 bool AnalysisInProgress() const { return m_cppcheckProcess != NULL; }
152
153 /**
154 * @brief return the progress
155 * @return value between 0-100
156 */
157 size_t GetProgress();
158 };
159
160 #endif // CppChecker