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