Debian Codegraph @

cppchecker/cppchecktestresults.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : cppchecktestresults.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 CPPCHECKTESTRESULTS_H
27 #define CPPCHECKTESTRESULTS_H
28
29 #include <wx/clntdata.h>
30 #include <map>
31 #include <vector>
32 #include <wx/arrstr.h>
33
34 //------------------------------------------------------------
35
36 class CppCheckResult : public wxClientData
37 {
38 public:
39 wxString id;
40 wxString filename;
41 long lineno;
42 wxString severity;
43 wxString msg;
44
45 public:
46 CppCheckResult() {}
47
48 CppCheckResult(const CppCheckResult& rhs) {
49 *this = rhs;
50 }
51
52 virtual ~CppCheckResult();
53
54 CppCheckResult& operator=(const CppCheckResult& rhs) {
55 id = rhs.id;
56 filename = rhs.filename.c_str();
57 lineno = rhs.lineno;
58 severity = rhs.severity.c_str();
59 msg = rhs.msg.c_str();
60 return *this;
61 }
62 };
63
64 //------------------------------------------------------------
65
66 class CppCheckTestResults
67 {
68 std::map<wxString, std::vector<CppCheckResult>* > m_results;
69 size_t m_errorCount;
70 public:
71 CppCheckTestResults();
72 virtual ~CppCheckTestResults();
73
74 /**
75 * @brief parse XML for a given file
76 * @param xmlOutput
77 */
78 void AddResultsForFile(const wxString &xmlOutput);
79
80 /**
81 * @brief return array with results belong to a given file
82 * @param filename
83 * @return
84 */
85 std::vector<CppCheckResult>* GetResultsForFile(const wxString &filename);
86
87 /**
88 * @brief clear the results
89 */
90 void ClearAll();
91
92 /**
93 * @brief return number of errors found
94 * @return
95 */
96 size_t GetErrorCount() const {
97 return m_errorCount;
98 }
99
100 /**
101 * @brief get array of files which has error found in them
102 * @return
103 */
104 wxArrayString GetFiles();
105 };
106
107 #endif // CPPCHECKTESTRESULTS_H