cc_exceptions.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $TOG: cc_exceptions.h /main/5 1998/04/17 11:44:44 mgreess $ */
  24. #ifndef _cc_exception_h
  25. #define _cc_exception_h 1
  26. #include <fstream>
  27. #include <iostream>
  28. using namespace std;
  29. #include "dti_excs/Exceptions.hh"
  30. #define END_TRY end_try
  31. #include <X11/Xosdefs.h>
  32. #include <errno.h>
  33. #ifdef X_NOT_STDC_ENV
  34. extern int errno;
  35. #endif
  36. #define CASTCCEXCEPT
  37. #define CASTCCSEXCEPT
  38. #define CASTCCBEXCEPT
  39. class ccException : public Exception
  40. {
  41. public:
  42. DECLARE_EXCEPTION(ccException, Exception)
  43. virtual ~ccException() {};
  44. virtual ostream& asciiOut(ostream&);
  45. friend ostream& operator <<(ostream& out, ccException& e) {
  46. return e.asciiOut(out);
  47. }
  48. };
  49. class ccStringException : public ccException
  50. {
  51. protected:
  52. char* msg;
  53. public:
  54. DECLARE_EXCEPTION(ccStringException, ccException)
  55. ccStringException(char const* m) : msg((char*)m) {};
  56. ~ccStringException() {};
  57. virtual ostream& asciiOut(ostream&);
  58. };
  59. class ccBoundaryException : public ccException
  60. {
  61. protected:
  62. int low;
  63. int high;
  64. int mindex;
  65. public:
  66. DECLARE_EXCEPTION(ccBoundaryException, ccException)
  67. ccBoundaryException(int l, int h, int i) :
  68. low(l), high(h), mindex(i) {};
  69. ~ccBoundaryException() {};
  70. virtual ostream& asciiOut(ostream&);
  71. };
  72. #endif