home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / iiexc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  15.5 KB  |  571 lines

  1. /**********************************************************************
  2. *                                                                     *
  3. *  IBM(R) VisualAge(TM) for C++ for Windows(R), Version 3.5           *
  4. *                                                                     *
  5. *  PID: 5622-880                                                      *
  6. *  - Licensed Material - Program-Property of IBM                      *
  7. *  (C) Copyright IBM Corp. 1991, 1995 - All Right Reserved.           *
  8. *                                                                     *
  9. *  US Government Users Restricted Rights - Use, duplication or        *
  10. *  disclosure restricted by GSA ADP Schedule Contract with IBM Corp.  *
  11. *                                                                     *
  12. *  VisualAge, and IBM are trademarks or registered trademarks of      *
  13. *  International Business Machines Corporation.                       *
  14. *  Windows is a registered trademark of Microsoft Corporation.        *
  15. *                                                                     *
  16. **********************************************************************/
  17.  
  18. #ifndef _IIEXC_H
  19. #define _IIEXC_H
  20.  
  21. #include <iiglobal.h>
  22. #include <iexc.h>
  23.  
  24. #pragma info (nocls, nocnd, nocns, nocnv, noext, nognr, novft)
  25. #pragma pack (4)
  26.  
  27.  
  28. #pragma SOMAsDefault (off)
  29.  
  30.   #define ICCEXCLASSSUPERCLASS(ibm,tal)\
  31.     public ibm {\
  32.     public:\
  33.     typedef ibm InheritedIBM;
  34.  
  35. class IFullExceptionImpl :
  36.   ICCEXCLASSSUPERCLASS (IFullException,\
  37.                         TFullException)
  38. public:
  39.  
  40.            IFullExceptionImpl
  41.                             (char const*);
  42.  
  43.            IFullExceptionImpl
  44.                             (char const*, char const*,
  45.                              char const*, unsigned long,
  46.                              unsigned long);
  47.  
  48.            IFullExceptionImpl
  49.                             (IFullExceptionImpl const&);
  50.  
  51.           ~IFullExceptionImpl
  52.                             ();
  53.  
  54. protected:
  55.  
  56. private:
  57.  
  58.   void     operator=        (IFullExceptionImpl const&);
  59.  
  60.  
  61. };
  62.  
  63. class IEmptyExceptionImpl :
  64.   ICCEXCLASSSUPERCLASS (IEmptyException,\
  65.                         TEmptyException)
  66. public:
  67.  
  68.            IEmptyExceptionImpl
  69.                             (char const*);
  70.  
  71.            IEmptyExceptionImpl
  72.                             (char const*, char const*,
  73.                              char const*, unsigned long,
  74.                              unsigned long);
  75.  
  76.            IEmptyExceptionImpl
  77.                             (IEmptyExceptionImpl const&);
  78.  
  79.           ~IEmptyExceptionImpl
  80.                             ();
  81.  
  82. protected:
  83.  
  84. private:
  85.  
  86.   void     operator=        (IEmptyExceptionImpl const&);
  87.  
  88.  
  89. };
  90.  
  91. class INotEmptyExceptionImpl :
  92.   ICCEXCLASSSUPERCLASS (INotEmptyException,\
  93.                         TNotEmptyException)
  94. public:
  95.  
  96.            INotEmptyExceptionImpl
  97.                             (char const*);
  98.  
  99.            INotEmptyExceptionImpl
  100.                             (char const*, char const*,
  101.                              char const*, unsigned long,
  102.                              unsigned long);
  103.  
  104.            INotEmptyExceptionImpl
  105.                             (INotEmptyExceptionImpl const&);
  106.  
  107.           ~INotEmptyExceptionImpl
  108.                             ();
  109.  
  110. protected:
  111.  
  112. private:
  113.  
  114.   void     operator=        (INotEmptyExceptionImpl const&);
  115.  
  116.  
  117. };
  118.  
  119. class INotBoundedExceptionImpl :
  120.   ICCEXCLASSSUPERCLASS (INotBoundedException,\
  121.                         TNotBoundedException)
  122. public:
  123.  
  124.            INotBoundedExceptionImpl
  125.                             (char const*);
  126.  
  127.            INotBoundedExceptionImpl
  128.                             (char const*, char const*,
  129.                              char const*, unsigned long,
  130.                              unsigned long);
  131.  
  132.            INotBoundedExceptionImpl
  133.                             (INotBoundedExceptionImpl const&);
  134.  
  135.           ~INotBoundedExceptionImpl
  136.                             ();
  137.  
  138. protected:
  139.  
  140. private:
  141.  
  142.   void     operator=        (INotBoundedExceptionImpl const&);
  143.  
  144.  
  145. };
  146.  
  147. class ICursorInvalidExceptionImpl :
  148.   ICCEXCLASSSUPERCLASS (ICursorInvalidException,\
  149.                         TCursorInvalidException)
  150. public:
  151.  
  152.            ICursorInvalidExceptionImpl
  153.                             (char const*);
  154.  
  155.            ICursorInvalidExceptionImpl
  156.                             (char const*, char const*,
  157.                              char const*, unsigned long,
  158.                              unsigned long);
  159.  
  160.            ICursorInvalidExceptionImpl
  161.                             (ICursorInvalidExceptionImpl const&);
  162.  
  163.           ~ICursorInvalidExceptionImpl
  164.                             ();
  165.  
  166. protected:
  167.  
  168. private:
  169.  
  170.   void     operator=        (ICursorInvalidExceptionImpl const&);
  171.  
  172.  
  173. };
  174.  
  175. class IPositionInvalidExceptionImpl :
  176.   ICCEXCLASSSUPERCLASS (IPositionInvalidException,\
  177.                         TPositionInvalidException)
  178. public:
  179.  
  180.            IPositionInvalidExceptionImpl
  181.                             (char const*);
  182.  
  183.            IPositionInvalidExceptionImpl
  184.                             (char const*, char const*,
  185.                              char const*, unsigned long,
  186.                              unsigned long);
  187.  
  188.            IPositionInvalidExceptionImpl
  189.                             (IPositionInvalidExceptionImpl const&);
  190.  
  191.           ~IPositionInvalidExceptionImpl
  192.                             ();
  193.  
  194. protected:
  195.  
  196. private:
  197.  
  198.   void     operator=        (IPositionInvalidExceptionImpl const&);
  199.  
  200.  
  201. };
  202.  
  203. class INotContainsKeyExceptionImpl :
  204.   ICCEXCLASSSUPERCLASS (INotContainsKeyException,\
  205.                         TNotContainsKeyException)
  206. public:
  207.  
  208.            INotContainsKeyExceptionImpl
  209.                             (char const*);
  210.  
  211.            INotContainsKeyExceptionImpl
  212.                             (char const*, char const*,
  213.                              char const*, unsigned long,
  214.                              unsigned long);
  215.  
  216.            INotContainsKeyExceptionImpl
  217.                             (INotContainsKeyExceptionImpl const&);
  218.  
  219.           ~INotContainsKeyExceptionImpl
  220.                             ();
  221.  
  222. protected:
  223.  
  224. private:
  225.  
  226.   void     operator=        (INotContainsKeyExceptionImpl const&);
  227.  
  228.  
  229. };
  230.  
  231. class IKeyAlreadyExistsExceptionImpl :
  232.   ICCEXCLASSSUPERCLASS (IKeyAlreadyExistsException,\
  233.                         TKeyAlreadyExistsException)
  234. public:
  235.  
  236.            IKeyAlreadyExistsExceptionImpl
  237.                             (char const*);
  238.  
  239.            IKeyAlreadyExistsExceptionImpl
  240.                             (char const*, char const*,
  241.                              char const*, unsigned long,
  242.                              unsigned long);
  243.  
  244.            IKeyAlreadyExistsExceptionImpl
  245.                             (IKeyAlreadyExistsExceptionImpl const&);
  246.  
  247.           ~IKeyAlreadyExistsExceptionImpl
  248.                             ();
  249.  
  250. protected:
  251.  
  252. private:
  253.  
  254.   void     operator=        (IKeyAlreadyExistsExceptionImpl const&);
  255.  
  256.  
  257. };
  258.  
  259. class IRootAlreadyExistsExceptionImpl :
  260.   ICCEXCLASSSUPERCLASS (IRootAlreadyExistsException,\
  261.                         TRootAlreadyExistsException)
  262. public:
  263.  
  264.            IRootAlreadyExistsExceptionImpl
  265.                             (char const*);
  266.  
  267.            IRootAlreadyExistsExceptionImpl
  268.                             (char const*, char const*,
  269.                              char const*, unsigned long,
  270.                              unsigned long);
  271.  
  272.            IRootAlreadyExistsExceptionImpl
  273.                             (IRootAlreadyExistsExceptionImpl const&);
  274.  
  275.           ~IRootAlreadyExistsExceptionImpl
  276.                             ();
  277.  
  278. protected:
  279.  
  280. private:
  281.  
  282.   void     operator=        (IRootAlreadyExistsExceptionImpl const&);
  283.  
  284. };
  285.  
  286. class IChildAlreadyExistsExceptionImpl :
  287.   ICCEXCLASSSUPERCLASS (IChildAlreadyExistsException,\
  288.                         TChildAlreadyExistsException)
  289. public:
  290.  
  291.            IChildAlreadyExistsExceptionImpl
  292.                             (char const*);
  293.  
  294.            IChildAlreadyExistsExceptionImpl
  295.                             (char const*, char const*,
  296.                              char const*, unsigned long,
  297.                              unsigned long);
  298.  
  299.            IChildAlreadyExistsExceptionImpl
  300.                             (IChildAlreadyExistsExceptionImpl const&);
  301.  
  302.           ~IChildAlreadyExistsExceptionImpl
  303.                             ();
  304.  
  305. protected:
  306.  
  307. private:
  308.  
  309.   void     operator=        (IChildAlreadyExistsExceptionImpl const&);
  310.  
  311.  
  312. };
  313.  
  314. class IIdenticalCollectionExceptionImpl :
  315.   ICCEXCLASSSUPERCLASS (IIdenticalCollectionException,\
  316.                         TIdenticalCollectionException)
  317. public:
  318.  
  319.            IIdenticalCollectionExceptionImpl
  320.                             (char const*);
  321.  
  322.            IIdenticalCollectionExceptionImpl
  323.                             (char const*, char const*,
  324.                              char const*, unsigned long,
  325.                              unsigned long);
  326.  
  327.            IIdenticalCollectionExceptionImpl
  328.                             (IIdenticalCollectionExceptionImpl const&);
  329.  
  330.           ~IIdenticalCollectionExceptionImpl
  331.                             ();
  332.  
  333. protected:
  334.  
  335. private:
  336.  
  337.   void     operator=        (IIdenticalCollectionExceptionImpl const&);
  338.  
  339.  
  340. };
  341.  
  342. class IInvalidReplacementExceptionImpl :
  343.   ICCEXCLASSSUPERCLASS (IInvalidReplacementException,\
  344.                         TInvalidReplacementException)
  345. public:
  346.  
  347.            IInvalidReplacementExceptionImpl
  348.                             (char const*);
  349.  
  350.            IInvalidReplacementExceptionImpl
  351.                             (char const*, char const*,
  352.                              char const*, unsigned long,
  353.                              unsigned long);
  354.  
  355.            IInvalidReplacementExceptionImpl
  356.                             (IInvalidReplacementExceptionImpl const&);
  357.  
  358.           ~IInvalidReplacementExceptionImpl
  359.                             ();
  360.  
  361. protected:
  362.  
  363. private:
  364.  
  365.   void     operator=        (IInvalidReplacementExceptionImpl const&);
  366.  
  367.  
  368. };
  369.  
  370. class ICyclicAttachExceptionImpl :
  371.   ICCEXCLASSSUPERCLASS (ICyclicAttachException,\
  372.                         TCyclicAttachException)
  373. public:
  374.  
  375.            ICyclicAttachExceptionImpl
  376.                             (char const*);
  377.  
  378.            ICyclicAttachExceptionImpl
  379.                             (char const*, char const*,
  380.                              char const*, unsigned long,
  381.                              unsigned long);
  382.  
  383.            ICyclicAttachExceptionImpl
  384.                             (ICyclicAttachExceptionImpl const&);
  385.  
  386.           ~ICyclicAttachExceptionImpl
  387.                             ();
  388.  
  389. protected:
  390.  
  391. private:
  392.  
  393.   void     operator=        (ICyclicAttachExceptionImpl const&);
  394.  
  395.  
  396. };
  397.  
  398. class IOutOfCollectionMemoryImpl :
  399.   ICCEXCLASSSUPERCLASS (IOutOfCollectionMemory,\
  400.                         TOutOfCollectionMemory)
  401. public:
  402.  
  403.            IOutOfCollectionMemoryImpl
  404.                             (char const*);
  405.  
  406.            IOutOfCollectionMemoryImpl
  407.                             (char const*, char const*,
  408.                              char const*, unsigned long,
  409.                              unsigned long);
  410.  
  411.            IOutOfCollectionMemoryImpl
  412.                             (IOutOfCollectionMemoryImpl const&);
  413.  
  414.           ~IOutOfCollectionMemoryImpl
  415.                             ();
  416.  
  417. protected:
  418.  
  419. private:
  420.  
  421.   void     operator=        (IOutOfCollectionMemoryImpl const&);
  422.  
  423.  
  424. };
  425.  
  426.  
  427. #undef ITHROW
  428. #undef IRETHROW
  429. #undef ITRY
  430. #undef IENDTRY
  431. #undef ICATCH
  432. #undef IENDCATCH
  433.  
  434. #if (INO_EXCEPTIONS_SUPPORT)
  435.  
  436.   #define ITHROW(exc)
  437.   #define IRETHROW(exc)
  438.   #define ITRY if (true)
  439.   #define IENDTRY
  440.   #define ICATCH(exc) if (false)
  441.   #define IENDCATCH
  442.  
  443. #else
  444.  
  445.   #define ITHROW(exc) throw exc
  446.   #define IRETHROW(exc) throw
  447.   #define ITRY try
  448.   #define IENDTRY
  449.   #define ICATCH(exc) catch (exc)
  450.   #define IENDCATCH
  451.  
  452. #endif
  453.  
  454. #if ! defined (IASSERT)
  455. #define IASSERT(exp)
  456. #endif
  457.  
  458. #define ICHECK(pre, exc, cn, mn, txt)\
  459.   { if (! (pre))\
  460.       throw exc (cn, mn, __FILE__, __LINE__, txt);\
  461.   }
  462.  
  463. #define ICHECK_Memory(Class, Method) \
  464.   ICHECK (result != 0,\
  465.           IOutOfCollectionMemoryImpl,\
  466.           Class, Method, IC_OUT_OF_COLLECTION_MEMORY)
  467.  
  468. #define ICHECK_IsEmpty(Class, Method) \
  469.   ICHECK (! IsEmpty (),\
  470.           IEmptyExceptionImpl,\
  471.           Class, Method, IC_COLLECTION_IS_EMPTY)
  472.  
  473. #define ICHECK_IsFor(Class, Method) \
  474.   ICHECK (cursor.IsFor (*this),\
  475.           ICursorInvalidExceptionImpl,\
  476.           Class, Method, IC_CURSOR_NOT_FOR_THIS)
  477.  
  478. #define ICHECK_IsForThat(Class, Method) \
  479.   ICHECK (thatCursor.IsFor (tree),\
  480.           ICursorInvalidExceptionImpl,\
  481.           Class, Method, IC_CURSOR_NOT_FOR_GIVEN)
  482.  
  483. #define ICHECK_Identical(Class, Method) \
  484.   ICHECK (this != &collection,\
  485.           IIdenticalCollectionExceptionImpl,\
  486.           Class, Method, IC_IDENTICAL_COLLECTION)
  487.  
  488. #define ICHECK_IsValid(Class, Method) \
  489.   ICHECK (cursor.IsValid (),\
  490.           ICursorInvalidExceptionImpl,\
  491.           Class, Method, IC_INVALID_CURSOR)
  492.  
  493. #define ICHECK_IsThatValid(Class, Method) \
  494.   ICHECK (thatCursor.IsValid (),\
  495.           ICursorInvalidExceptionImpl,\
  496.           Class, Method, IC_INVALID_CURSOR)
  497.  
  498. #define ICHECK_Cursor(Class, Method) \
  499.   ICHECK (CheckCursor (cursor),\
  500.           ICursorInvalidExceptionImpl,\
  501.           Class, Method, IC_CURSOR_NOT_CONTAINED)
  502.  
  503. #define ICHECK_ThatCursor(Class, Method) \
  504.   ICHECK (tree.CheckCursor (thatCursor),\
  505.           ICursorInvalidExceptionImpl,\
  506.           Class, Method, IC_CURSOR_NOT_CONTAINED)
  507.  
  508. #define ICHECK_Child(Class, Method) \
  509.   ICHECK (CheckChild (cursor, position),\
  510.           IChildAlreadyExistsExceptionImpl,\
  511.           Class, Method, IC_CHILD_ALREADY_EXISTS)
  512.  
  513. #define ICHECK_Root(Class, Method) \
  514.   ICHECK (IsEmpty (),\
  515.           IRootAlreadyExistsExceptionImpl,\
  516.           Class, Method, IC_ROOT_ALREADY_EXISTS)
  517.  
  518. #define ICHECK_Position(Class, Method) \
  519.   ICHECK (1 <= position && position <= NumberOfElements (),\
  520.           IPositionInvalidExceptionImpl,\
  521.           Class, Method, IC_INVALID_POSITION)
  522.  
  523. #define ICHECK_Position2(Class, Method) \
  524.   ICHECK (1 <= position && position <= NumberOfElements () + 1,\
  525.           IPositionInvalidExceptionImpl,\
  526.           Class, Method, IC_INVALID_POSITION)
  527.  
  528. #define ICHECK_Position3(Class, Method) \
  529.   ICHECK (1 <= position && position <= NumberOfChildren (),\
  530.           IPositionInvalidExceptionImpl,\
  531.           Class, Method, IC_INVALID_POSITION)
  532.  
  533. #define ICHECK_ContainsKey(Class, Method) \
  534.   ICHECK (LocateElementWithKey (key, cursor),\
  535.           INotContainsKeyExceptionImpl,\
  536.           Class, Method, IC_KEY_NOT_CONTAINED)
  537.  
  538. #define ICHECK_NotBounded(Class, Method) \
  539.   ICHECK (false,\
  540.           INotBoundedExceptionImpl,\
  541.           Class, Method, IC_NOT_BOUNDED)
  542.  
  543. #define ICHECK_Replacement(Class, Method) \
  544.   ICHECK (CheckReplacement (cursor, element),\
  545.           IInvalidReplacementExceptionImpl,\
  546.           Class, Method, IC_INVALID_REPLACEMENT)
  547.  
  548. #define ICHECK_Equality(Class, Method) \
  549.   ICHECK (Contains (element),\
  550.           IKeyAlreadyExistsExceptionImpl,\
  551.           Class, Method, IC_KEY_ALREADY_EXISTS)
  552.  
  553. #define ICHECK_Cycle(Class, Method) \
  554.   ICHECK (this != &tree,\
  555.           ICyclicAttachExceptionImpl,\
  556.           Class, Method, IC_CYCLIC_CHILD_ATTACHMENT)
  557.  
  558. #define ICHECK_Cycle2(Class, Method) \
  559.   ICHECK (this != &tree || \
  560.           ! CheckCursor (cursor, thatCursor),\
  561.           ICyclicAttachExceptionImpl,\
  562.           Class, Method, IC_CYCLIC_CHILD_ATTACHMENT)
  563.  
  564. #pragma SOMAsDefault (pop)
  565.  
  566.  
  567. #pragma pack ()
  568. #pragma info (restore)
  569.  
  570. #endif
  571.