Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /****************************   error.h   ************************************
  2. * Author:        Agner Fog
  3. * Date created:  2006-07-15
  4. * Last modified: 2006-07-15
  5. * Project:       objconv
  6. * Module:        error.h
  7. * Description:
  8. * Header file for error handler error.cpp
  9. *
  10. * Copyright 2006-2008 GNU General Public License http://www.gnu.org/licenses
  11. *****************************************************************************/
  12. #ifndef OBJCONV_ERROR_H
  13. #define OBJCONV_ERROR_H
  14.  
  15. // Structure for defining error message texts
  16. struct SErrorText {
  17.    int  ErrorNumber;    // Error number
  18.    int  Status;         // bit 0-3 = severity: 0 = ignore, 1 = warning, 2 = error, 9 = abort
  19.                         // bit 8   = error number not found
  20.    char const * Text;   // Error text
  21. };
  22.  
  23. // General error routine for reporting warning and error messages to STDERR output
  24. class CErrorReporter {
  25. public:
  26.    CErrorReporter();    // Default constructor
  27.    static SErrorText * FindError(int ErrorNumber); // Search for error in ErrorTexts
  28.    void submit(int ErrorNumber); // Print error message
  29.    void submit(int ErrorNumber, int extra); // Print error message with extra info
  30.    void submit(int ErrorNumber, int, int);  // Print error message with two extra numbers inserted
  31.    void submit(int ErrorNumber, char const * extra); // Print error message with extra info
  32.    void submit(int ErrorNumber, char const *, char const *); // Print error message with two extra text fields inserted
  33.    void submit(int ErrorNumber, int, char const *); // Print error message with two extra text fields inserted
  34.    int Number();        // Get number of errors
  35.    int GetWorstError(); // Get highest warning or error number encountered
  36.    void ClearError(int ErrorNumber); // Ignore further occurrences of this error
  37. protected:
  38.    int NumErrors;       // Number of errors detected
  39.    int NumWarnings;     // Number of warnings detected
  40.    int WorstError;      // Highest error number encountered
  41.    int MaxWarnings;     // Max number of warning messages to pring
  42.    int MaxErrors;       // Max number of error messages to print
  43.    void HandleError(SErrorText * err, char const * text); // Used by submit function
  44. };
  45.  
  46. #ifndef OBJCONV_ERROR_CPP
  47. extern CErrorReporter err;  // Error handling object is in error.cpp
  48. extern SErrorText ErrorTexts[]; // List of error texts
  49. #endif
  50.  
  51. #endif // #ifndef OBJCONV_ERROR_H
  52.