source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/include/Messenger.h@ 724

Last change on this file since 724 was 541, checked in by dai_9181, 17 years ago

SynonymErrorWordsを排除。
ClearSynonymErrorWordsメソッドを追加。

File size: 1.6 KB
Line 
1
2class Messenger
3{
4public:
5 void Output( const std::string &message );
6 int GetNextErrorLine();
7};
8
9class ErrorInfo
10{
11 int errorCode;
12 std::string keyword;
13 std::string sourceFilePath;
14 int sourceLineNum;
15 int errorLineNum;
16
17public:
18 ErrorInfo( int errorCode, const std::string &keyword, const std::string &sourceFilePath, int sourceLineNum )
19 : errorCode( errorCode )
20 , keyword( keyword )
21 , sourceFilePath( sourceFilePath )
22 , sourceLineNum( sourceLineNum )
23 {
24 }
25 ErrorInfo( int errorCode, const std::string &keyword, int sourceIndex );
26
27 int GetErrorCode() const
28 {
29 return errorCode;
30 }
31 bool IsWarning() const
32 {
33 return ( errorCode < -100 );
34 }
35 const std::string &GetKeyword() const
36 {
37 return keyword;
38 }
39 const std::string &GetSourceFilePath() const
40 {
41 return sourceFilePath;
42 }
43 int GetSourceLineNum() const
44 {
45 return sourceLineNum;
46 }
47 int GetErrorLineNum() const
48 {
49 return errorLineNum;
50 }
51
52 std::string GetMessageString() const;
53 std::string GetFullMessageString() const;
54};
55typedef std::vector<ErrorInfo> ErrorInfos;
56
57class ErrorMessenger
58 : public Messenger
59{
60 ErrorInfos errorInfos;
61 Jenga::Common::Strings synonymKeyWords;
62
63public:
64 void Output( const ErrorInfo &errorInfo );
65 void Output( int errorCode, const std::string &keyword, int sourceIndex = -1 );
66 void Output( int errorCode, const char *keyword, int sourceIndex = -1 );
67 void OutputFatalError();
68
69 void ClearSynonymKeyWords();
70
71 int GetErrorCount() const;
72 bool HasError() const;
73 int GetWarningCount() const;
74
75 void ShowErrorLine( int errorLineNum );
76};
Note: See TracBrowser for help on using the repository browser.