[465] | 1 |
|
---|
| 2 | class Messenger
|
---|
| 3 | {
|
---|
| 4 | public:
|
---|
| 5 | void Output( const std::string &message );
|
---|
| 6 | int GetNextErrorLine();
|
---|
| 7 | };
|
---|
| 8 |
|
---|
| 9 | class ErrorInfo
|
---|
| 10 | {
|
---|
| 11 | int errorCode;
|
---|
| 12 | std::string keyword;
|
---|
| 13 | std::string sourceFilePath;
|
---|
| 14 | int sourceLineNum;
|
---|
| 15 | int errorLineNum;
|
---|
| 16 |
|
---|
| 17 | public:
|
---|
| 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 | };
|
---|
| 55 | typedef std::vector<ErrorInfo> ErrorInfos;
|
---|
| 56 |
|
---|
| 57 | class ErrorMessenger
|
---|
| 58 | : public Messenger
|
---|
| 59 | {
|
---|
| 60 | ErrorInfos errorInfos;
|
---|
| 61 | Jenga::Common::Strings synonymKeyWords;
|
---|
| 62 |
|
---|
| 63 | public:
|
---|
| 64 | void Output( const ErrorInfo &errorInfo );
|
---|
[472] | 65 | void Output( int errorCode, const std::string &keyword, int sourceIndex = -1 );
|
---|
| 66 | void Output( int errorCode, const char *keyword, int sourceIndex = -1 );
|
---|
[465] | 67 | void OutputFatalError();
|
---|
| 68 |
|
---|
[541] | 69 | void ClearSynonymKeyWords();
|
---|
| 70 |
|
---|
[465] | 71 | int GetErrorCount() const;
|
---|
| 72 | bool HasError() const;
|
---|
| 73 | int GetWarningCount() const;
|
---|
| 74 |
|
---|
| 75 | void ShowErrorLine( int errorLineNum );
|
---|
| 76 | };
|
---|