home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / iatree.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  5.7 KB  |  188 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 _IATREE_H
  19. #define _IATREE_H
  20.  
  21. #include <ibtree.h>
  22.  
  23. #pragma info (nocls, nocnd, nocns, nocnv, noext, nognr, novft)
  24. #pragma pack (4)
  25.  
  26. #pragma SOMAsDefault (off)
  27.  
  28. template <class Element>
  29. class IElementTreeCursor : public ITreeCursor {
  30.  
  31.   typedef  ITreeCursorImpl Implementation;
  32.  
  33. public:
  34.  
  35.   Element const&
  36.            element          () const;
  37.  
  38. protected:
  39.  
  40.            IElementTreeCursor
  41.                             (Implementation*);
  42.  
  43.  
  44. };
  45.  
  46. template <class Element>
  47. class IATree : protected IATreeBase {
  48.  
  49.   typedef  IATreeImpl Implementation;
  50.  
  51. public:
  52.  
  53.           ~IATree           ();
  54.  
  55.   void     addAsChild       (ITreeCursor const&,
  56.                              IPosition, Element const&);
  57.  
  58.   void     addAsRoot        (Element const&);
  59.  
  60.   IBoolean allElementsDo    (IBoolean (*applicatorFunction)
  61.                               (Element&, void*),
  62.                              ITreeIterationOrder,
  63.                              void* additionalArgument = 0);
  64.  
  65.   IBoolean allElementsDo    (IBoolean (*applicatorFunction)
  66.                               (Element const&, void*),
  67.                              ITreeIterationOrder,
  68.                              void* additionalArgument = 0) const;
  69.  
  70.   IBoolean allElementsDo    (IApplicator <Element>&,
  71.                              ITreeIterationOrder);
  72.  
  73.   IBoolean allElementsDo    (IConstantApplicator <Element>&,
  74.                              ITreeIterationOrder) const;
  75.  
  76.   IBoolean allSubtreeElementsDo
  77.                             (ITreeCursor const&,
  78.                              IBoolean (*applicatorFunction)
  79.                               (Element&, void*),
  80.                              ITreeIterationOrder,
  81.                              void* additionalArgument = 0);
  82.  
  83.   IBoolean allSubtreeElementsDo
  84.                             (ITreeCursor const&,
  85.                              IBoolean (*applicatorFunction)
  86.                               (Element const&, void*),
  87.                              ITreeIterationOrder,
  88.                              void* additionalArgument = 0) const;
  89.  
  90.   IBoolean allSubtreeElementsDo
  91.                             (ITreeCursor const&,
  92.                              IApplicator <Element>&,
  93.                              ITreeIterationOrder);
  94.  
  95.   IBoolean allSubtreeElementsDo
  96.                             (ITreeCursor const&,
  97.                              IConstantApplicator <Element>&,
  98.                              ITreeIterationOrder) const;
  99.  
  100.   IPosition
  101.            childPositionAt  (ITreeCursor const&) const;
  102.  
  103.   Element& elementAt        (ITreeCursor const&);
  104.  
  105.   Element const&
  106.            elementAt        (ITreeCursor const&) const;
  107.  
  108.   IBoolean isConsistent     () const;
  109.  
  110.   IBoolean isEmpty          () const;
  111.  
  112.   IBoolean isLeaf           (ITreeCursor const&) const;
  113.  
  114.   IBoolean isRoot           (ITreeCursor const&) const;
  115.  
  116.   ITreeCursor*
  117.            newCursor        () const;
  118.  
  119.   INumber  numberOfElements () const;
  120.  
  121.   INumber  numberOfLeaves   () const;
  122.  
  123.   INumber  numberOfSubtreeElements
  124.                             (ITreeCursor const&) const;
  125.  
  126.   INumber  numberOfSubtreeLeaves
  127.                             (ITreeCursor const&) const;
  128.  
  129.   INumber  removeAll        ();
  130.  
  131.   INumber  removeSubtree    (ITreeCursor&);
  132.  
  133.   void     replaceAt        (ITreeCursor const&, Element const&);
  134.  
  135.   IBoolean setToChild       (IPosition, ITreeCursor&) const;
  136.  
  137.   IBoolean setToFirst       (ITreeCursor&, ITreeIterationOrder) const;
  138.  
  139.   IBoolean setToFirstExistingChild
  140.                             (ITreeCursor&) const;
  141.  
  142.   IBoolean setToLast        (ITreeCursor&, ITreeIterationOrder) const;
  143.  
  144.   IBoolean setToLastExistingChild
  145.                             (ITreeCursor&) const;
  146.  
  147.   IBoolean setToNext        (ITreeCursor&, ITreeIterationOrder) const;
  148.  
  149.   IBoolean setToNextExistingChild
  150.                             (ITreeCursor&) const;
  151.  
  152.   IBoolean setToParent      (ITreeCursor&) const;
  153.  
  154.   IBoolean setToPrevious    (ITreeCursor&, ITreeIterationOrder) const;
  155.  
  156.   IBoolean setToPreviousExistingChild
  157.                             (ITreeCursor&) const;
  158.  
  159.   IBoolean setToRoot        (ITreeCursor&) const;
  160.  
  161.   // for backward compatibility
  162.   IPosition
  163.            position         (ITreeCursor const&) const;
  164.  
  165. protected:
  166.  
  167.            IATree           ();
  168.  
  169.            IATree           (IATree <Element> const&);
  170.  
  171.   static
  172.   Implementation&
  173.            ImplOf           (IATree <Element> const&);
  174.  
  175. private:
  176.  
  177.  
  178. };
  179.  
  180. #pragma SOMAsDefault (pop)
  181.  
  182. #include <iatree.inl>
  183.  
  184. #pragma info (restore)
  185. #pragma pack ()
  186.  
  187. #endif
  188.