home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dokpr1.zip / except.h < prev    next >
C/C++ Source or Header  |  1995-11-08  |  2KB  |  89 lines

  1. /**************************************************************************
  2.  *                                                                        *
  3.  *                                                                        *
  4.  *          This code is copyright (c) 1994                               *
  5.  *                     Athena Design, Inc.                                *
  6.  *                                                                        *
  7.  *                                                                        *
  8.  *                ALL RIGHTS RESERVED                                     *
  9.  *                                                                        *
  10.  *                                                                        *
  11.  *                                                                        *
  12.  *                                                                        *
  13.  *                                                                        *
  14.  **************************************************************************/
  15.  
  16. /*
  17.     Errors, warnings, and notes are tricky little beasts.
  18.  
  19.     At the user interface level of an
  20.  
  21.     */
  22.  
  23. #ifndef _MH_exception
  24.  
  25. #define _MH_exception
  26.  
  27. #include "exc_num.h"
  28.  
  29. #ifdef BORLAND
  30. #ifndef NULL
  31. #define NULL ((void *) 0)
  32. //ifndef NULL
  33. #endif
  34.  
  35. // ifdef BORLAND
  36. #else
  37. #ifndef NULL
  38. #define NULL ( 0)
  39. //ifndef NULL
  40. #endif
  41. // ifdef BORLAND
  42. #endif
  43.  
  44.  
  45. class MGController;
  46.  
  47. class MException {
  48.     public:
  49.     void setErrorPlaces(int n,int i) {if (this) errorPlaces[n] = i;};
  50.     int getErrorPlaces(int n) const {return errorPlaces[n];};
  51.     int isError() const {if (this) return err; else return noError;};
  52.     int getError() const {if (this) return err; else return noError;};
  53.     MException() {_init();};
  54.     ~MException() {_destroy();};
  55.  
  56.     void setError(int,const char * = (const char *) NULL);
  57.     void addWarning(int,const char * = (const char *) NULL);
  58.     int getWarningCnt() const;
  59.     int getWarning(int) const;
  60.  
  61.     char *getErrorText() const;
  62.     char *getWarningText(int) const;
  63.  
  64.     void setOSError(int);
  65.     void setErrnoError(int);
  66.     
  67.  
  68. #ifdef M2Z
  69.     void setRexxError(int);
  70. #endif
  71.  
  72.     void _init();
  73.     void _destroy();
  74.  
  75.     private:
  76.     
  77.  
  78.     int warnCnt,maxWarn;
  79.     int *warnings;
  80.     char **warnStrs;
  81.     int err;
  82.     char *errStr;
  83.     int errorPlaces[10];
  84.     };
  85.  
  86.  
  87. #endif
  88.  
  89.