home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / iiatree.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  6.4 KB  |  285 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 _IIATREE_H
  19. #define _IIATREE_H
  20.  
  21. #include <iiglobal.h>
  22. #include <iexctxt.h>
  23.  
  24.  
  25. #pragma info (nocls, nocnd, nocns, nocnv, noext, nognr, novft)
  26. #pragma pack (4)
  27.  
  28. enum ITreeIterationOrder {
  29.   IPreorder,
  30.   IPostorder
  31. };
  32.  
  33. #pragma SOMAsDefault (off)
  34.  
  35. class IATreeImpl;
  36.  
  37. class ITreeCursorImpl {
  38. public:
  39.  
  40.            ITreeCursorImpl  (IATreeImpl const&);
  41.  
  42.   virtual ~ITreeCursorImpl  ();
  43.  
  44.   virtual
  45.   ITreeCursorImpl*
  46.            Clone            () const = 0;
  47.  
  48.   virtual
  49.   void     Copy             (ITreeCursorImpl const&) = 0;
  50.  
  51.   void const*
  52.            Element          () const;
  53.  
  54.   virtual
  55.   void     Invalidate       () = 0;
  56.  
  57.   IBoolean IsFor            (IATreeImpl const&) const;
  58.  
  59.   virtual
  60.   IBoolean IsValid          () const = 0;
  61.  
  62.   IBoolean SetToChild       (IPosition);
  63.  
  64.   IBoolean SetToFirstExistingChild
  65.                             ();
  66.  
  67.   IBoolean SetToLastExistingChild
  68.                             ();
  69.  
  70.   IBoolean SetToNextExistingChild
  71.                             ();
  72.  
  73.   IBoolean SetToParent      ();
  74.  
  75.   IBoolean SetToPreviousExistingChild
  76.                             ();
  77.  
  78.   IBoolean SetToRoot        ();
  79.  
  80.   void     operator=        (ITreeCursorImpl const&);
  81.  
  82.   virtual
  83.   IBoolean operator==       (ITreeCursorImpl const&) const = 0;
  84.  
  85.   IBoolean operator!=       (ITreeCursorImpl const&) const;
  86.  
  87. protected:
  88.  
  89.   IATreeImpl const*
  90.            ivTree;
  91.  
  92.   static
  93.   void*    CheckPointer     (void*);
  94.  
  95. private:
  96.  
  97.  
  98. };
  99.  
  100. class IATreeOps;
  101.  
  102. class IATreeImpl {
  103. public :
  104.  
  105.   typedef  IATreeOps Ops;
  106.  
  107.           ~IATreeImpl       ();
  108.  
  109.   virtual
  110.   void     AddAsChild       (ITreeCursorImpl const&,
  111.                              IPosition, void const*) = 0;
  112.  
  113.   virtual
  114.   void     AddAsRoot        (void const*) = 0;
  115.  
  116.   virtual
  117.   IBoolean AllElementsDo    (IApplFunc, ITreeIterationOrder, void*) = 0;
  118.  
  119.   virtual
  120.   IBoolean AllSubtreeElementsDo
  121.                             (ITreeCursorImpl const&, IApplFunc,
  122.                              ITreeIterationOrder, void*) = 0;
  123.  
  124.   static
  125.   void*    CheckPointer     (void*);
  126.  
  127.   virtual
  128.   INumber  ChildPositionAt  (ITreeCursorImpl const&) const = 0;
  129.  
  130.   virtual
  131.   char const*
  132.            ClassName        () const = 0;
  133.  
  134.   virtual
  135.   IATreeImpl*
  136.            Clone            () const = 0;
  137.  
  138.   virtual
  139.   ITreeCursorImpl*
  140.            CreateCursor     () const = 0;
  141.  
  142.   void     Delete           ();
  143.  
  144.   virtual
  145.   void*    ElementAt        (ITreeCursorImpl const&) const = 0;
  146.  
  147.   void     Initialize       ();
  148.  
  149.   virtual
  150.   IBoolean IsConsistent     () const = 0;
  151.  
  152.   virtual
  153.   IBoolean IsEmpty          () const;
  154.  
  155.   virtual
  156.   IBoolean IsLeaf           (ITreeCursorImpl const&) const = 0;
  157.  
  158.   virtual
  159.   IBoolean IsRoot           (ITreeCursorImpl const&) const = 0;
  160.  
  161.   void     LockBeforeReading
  162.                             (long = -1);
  163.  
  164.   void     LockBeforeWriting
  165.                             (long = -1);
  166.  
  167.   virtual
  168.   INumber  NumberOfElements () const = 0;
  169.  
  170.   virtual
  171.   INumber  NumberOfLeaves   () const = 0;
  172.  
  173.   virtual
  174.   INumber  NumberOfSubtreeElements
  175.                             (ITreeCursorImpl const&) const = 0;
  176.  
  177.   virtual
  178.   INumber  NumberOfSubtreeLeaves
  179.                             (ITreeCursorImpl const&) const = 0;
  180.  
  181.   virtual
  182.   INumber  RemoveAll        () = 0;
  183.  
  184.   virtual
  185.   INumber  RemoveSubtree    (ITreeCursorImpl&) = 0;
  186.  
  187.   virtual
  188.   void     ReplaceAt        (ITreeCursorImpl const&, void const*) = 0;
  189.  
  190.   virtual
  191.   IBoolean SetToChild       (IPosition, ITreeCursorImpl&) const = 0;
  192.  
  193.   virtual
  194.   IBoolean SetToFirst       (ITreeCursorImpl&,
  195.                              ITreeIterationOrder) const = 0;
  196.  
  197.   virtual
  198.   IBoolean SetToFirstExistingChild
  199.                             (ITreeCursorImpl&) const = 0;
  200.  
  201.   virtual
  202.   IBoolean SetToLast        (ITreeCursorImpl&,
  203.                              ITreeIterationOrder) const = 0;
  204.  
  205.   virtual
  206.   IBoolean SetToLastExistingChild
  207.                             (ITreeCursorImpl&) const = 0;
  208.  
  209.   virtual
  210.   IBoolean SetToNext        (ITreeCursorImpl&,
  211.                              ITreeIterationOrder) const = 0;
  212.  
  213.   virtual
  214.   IBoolean SetToNextExistingChild
  215.                             (ITreeCursorImpl&) const = 0;
  216.  
  217.   virtual
  218.   IBoolean SetToParent      (ITreeCursorImpl&) const = 0;
  219.  
  220.   virtual
  221.   IBoolean SetToPrevious    (ITreeCursorImpl&,
  222.                              ITreeIterationOrder) const = 0;
  223.  
  224.   virtual
  225.   IBoolean SetToPreviousExistingChild
  226.                             (ITreeCursorImpl&) const = 0;
  227.  
  228.   virtual
  229.   IBoolean SetToRoot        (ITreeCursorImpl&) const = 0;
  230.  
  231.   void     UnlockAfterReading
  232.                             ();
  233.  
  234.   void     UnlockAfterWriting
  235.                             ();
  236.  
  237.   virtual
  238.   TStream& operator<<=      (TStream&) = 0;
  239.  
  240.   virtual
  241.   TStream& operator>>=      (TStream&) const = 0;
  242.  
  243. protected:
  244.  
  245.            IATreeImpl       (Ops&);
  246.  
  247.            IATreeImpl       (IATreeImpl const&);
  248.  
  249.   static
  250.   Ops&     OpsOf            (IATreeImpl const&);
  251.  
  252. private:
  253.  
  254.   static
  255.   ICollectionExceptionText
  256.            cvExceptionText;
  257.  
  258.   Ops*     ivOps;
  259.  
  260.   INumber  ivReferenceCount;
  261.  
  262.  
  263. };
  264.  
  265. class IATreeOps {
  266. public:
  267.  
  268.   virtual ~IATreeOps        ();
  269.  
  270. protected:
  271.  
  272. private:
  273.  
  274.  
  275. };
  276.  
  277. #pragma SOMAsDefault (pop)
  278.  
  279. #include <iiatree.inl>
  280.  
  281. #pragma info (restore)
  282. #pragma pack ()
  283.  
  284. #endif
  285.