home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / business / printcar / printcar.exe / src / Util / Error.h < prev    next >
C/C++ Source or Header  |  2000-06-05  |  1KB  |  53 lines

  1. //
  2. //  $Id: Error.h,v 1.3 2000/06/04 23:23:52 sergey Exp $
  3. //
  4.  
  5. #ifndef _Error_h_
  6. #define _Error_h_
  7.  
  8.  
  9. namespace Util
  10. {
  11.     //
  12.     // Error handler interface.
  13.     //
  14.     class ErrorHandler
  15.     {
  16.     public:
  17.         virtual ~ErrorHandler() {}
  18.  
  19.         virtual void reportError(bool fatal, const char* message) = 0;
  20.     };
  21.  
  22.  
  23.     //
  24.     // Error class used to report fatal system errors.
  25.     //
  26.     class Error
  27.     {
  28.     private:
  29.         Error() {}
  30.         ~Error() {}
  31.  
  32.     // error handler operations
  33.     public:
  34.         static ErrorHandler& errorHandler()                         { return *_errorHandler; }
  35.         static void setErrorHandler(ErrorHandler& errorHandler)     { _errorHandler = &errorHandler; }
  36.  
  37.     // generic error messages
  38.  
  39.         static void errorMessage0(bool fatal, const char* message);
  40.         static void errorMessage(bool fatal, const char* format, ...);
  41.  
  42.     // standard system errors
  43.  
  44.         static void memoryAllocationError(const char* file, int line);
  45.         static void findLibraryError(const char* libName);
  46.  
  47.     private:
  48.         static ErrorHandler* _errorHandler;     // current error handler
  49.     };
  50. };
  51.  
  52. #endif  // _Error_h_
  53.