forked from VioletGiraffe/cppcheck-vs-addin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem.cs
More file actions
103 lines (90 loc) · 2.08 KB
/
Copy pathProblem.cs
File metadata and controls
103 lines (90 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VSPackage.CPPCheckPlugin
{
public class Problem
{
public enum SeverityLevel { info, warning, error };
public Problem(ICodeAnalyzer analyzer, SeverityLevel severity, String messageId, String message, String file, int line, String baseProjectPath, String projectName)
{
_analyzer = analyzer;
_severity = severity;
_messageId = messageId;
_message = message;
_file = file;
_line = line;
_baseProjectPath = baseProjectPath;
_projectName = projectName;
}
public ICodeAnalyzer Analyzer
{
get { return _analyzer; }
}
public SeverityLevel Severity
{
get { return _severity; }
}
public String MessageId
{
get { return _messageId; }
}
public String Message
{
get { return _message; }
set { _message = value; }
}
// This should be file path relative to project root
public String FullFileName
{
get { return _file; }
}
// file name only without path
public String FileName
{
get
{
return System.IO.Path.GetFileName(_file);
}
}
public String FilePath
{
get
{
if (String.IsNullOrWhiteSpace(_file))
return _file;
else if (_file.Contains(":")) // Absolute path
return _file;
else
{
if (String.IsNullOrWhiteSpace(_baseProjectPath))
return _file;
// Relative path - making absolute
return _baseProjectPath.EndsWith("\\") ? _baseProjectPath + _file : _baseProjectPath + "\\" + _file;
}
}
}
public int Line
{
get { return _line; }
}
public String BaseProjectPath
{
get { return _baseProjectPath; }
}
public String ProjectName
{
get { return _projectName; }
}
private ICodeAnalyzer _analyzer;
private SeverityLevel _severity;
private String _messageId;
private String _message;
private String _file;
private String _baseProjectPath;
private String _projectName;
private int _line;
}
}