home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warphead.zip / H / TEMPITER.H < prev    next >
C/C++ Source or Header  |  1997-02-28  |  6KB  |  230 lines

  1. //====START_GENERATED_PROLOG======================================
  2. //
  3. //
  4. //   COMPONENT_NAME: odutils
  5. //
  6. //   CLASSES:   TempODDragItemIterator
  7. //        TempODEmbeddedFramesIterator
  8. //        TempODFacetIterator
  9. //        TempODFocusSetIterator
  10. //        TempODFrameFacetIterator
  11. //        TempODTypeListIterator
  12. //        TempODWindowIterator
  13. //
  14. //   ORIGINS: 82,27
  15. //
  16. //
  17. //   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  18. //   All Rights Reserved
  19. //   Licensed Materials - Property of IBM
  20. //   US Government Users Restricted Rights - Use, duplication or
  21. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  22. //       
  23. //   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  24. //   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  25. //   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  26. //   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  27. //   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  28. //   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  29. //   OR PERFORMANCE OF THIS SOFTWARE.
  30. //
  31. //====END_GENERATED_PROLOG========================================
  32. //
  33. // @(#) 1.4 com/src/utils/include/TempIter.h, odutils, od96os2, odos29646d 8/19/96 11:57:04 [ 11/15/96 15:29:02 ]
  34. /*
  35.     File:        TempIter.h
  36.  
  37.     Contains:    Template utilities for OpenDoc iterators
  38.  
  39.     Owned by:    Jens Alfke
  40.  
  41.     Copyright:    ⌐ 1995 by Apple Computer, Inc., all rights reserved.
  42.     
  43.     Theory of Operation:
  44.     
  45.         These are specific TempObj utilities (see the "Temporary Objects"
  46.         tech note) for OpenDoc iterators. They are intended to be used in
  47.         this fashion:
  48.         
  49.             extern void DoSomethingWith( ODFoo* );
  50.             extern void OrSomethingWith( ODFoo* );
  51.             ...
  52.             ODBazz *bazz;
  53.             ...
  54.             for( TempODFooIterator iter(ev,bazz); iter.Current(); iter.Next() ) {
  55.                 DoSomethingWith(iter);
  56.                 OrSomethingWith(iter.Current());
  57.                 // within the loop you can use iter.Current() or just iter
  58.                 // to refer to the current object it's pointing to.
  59.             }
  60.         
  61.         True C++meisters can even do the for loop like this:
  62.         
  63.             for( TempODFooIterator iter(ev,bazz); iter; iter++ )
  64.  
  65.         If you wish you can also call First() to reset the iterator to
  66.         the beginning and return the first element.
  67.             
  68. */
  69.  
  70.  
  71. #ifndef _TEMPITER_
  72. #define _TEMPITER_
  73.  
  74.  
  75. #ifndef _TEMPOBJ_
  76. #include "TempObj.h"
  77. #endif
  78.  
  79. #ifndef SOM_ODWindow_xh
  80. #include <Window.xh>
  81. #endif
  82.  
  83. #ifndef SOM_ODDragAndDrop_xh
  84. #include <DragDrp.xh>
  85. #endif
  86.  
  87. #ifndef _ODMVCLNK_
  88. #include <ODMvcLnk.h>
  89. #endif
  90.  
  91.  
  92. struct Environment;
  93. class ODFrame;
  94. class ODFacet;
  95. class ODFocusSet;
  96. class ODTypeList;
  97.  
  98.  
  99. class TempODFacetIterator :public BaseTempObj
  100. {
  101.     public:
  102.     _DLLIMPORTEXPORT_ TempODFacetIterator( Environment*, ODFacet*, ODTraversalType, ODSiblingOrder );
  103.     _DLLIMPORTEXPORT_ ODFacet*    First( );
  104.     ODFacet*    Current( )        {return fCurrent;}
  105.     _DLLIMPORTEXPORT_ ODFacet*    Next( );
  106.     _DLLIMPORTEXPORT_ ODBoolean    IsNotComplete( );
  107.             operator ODFacet*()    {return fCurrent;}
  108.     ODFacet*    operator ->()        {return fCurrent;}
  109.     ODFacet*    operator ++()        {return this->Next();}
  110.     
  111.     private:
  112.     Environment* fEv;
  113.     ODFacet*     fCurrent;
  114. };
  115.  
  116.  
  117. class TempODFrameFacetIterator :public BaseTempObj
  118. {
  119.     public:
  120.     _DLLIMPORTEXPORT_ TempODFrameFacetIterator( Environment*, ODFrame* );
  121.     _DLLIMPORTEXPORT_ ODFacet*    First( );
  122.     ODFacet*    Current( )                {return fCurrent;}
  123.     _DLLIMPORTEXPORT_ ODFacet*    Next( );
  124.     _DLLIMPORTEXPORT_ ODBoolean    IsNotComplete( );
  125.                 operator ODFacet*()        {return fCurrent;}
  126.     ODFacet*    operator ->()            {return fCurrent;}
  127.     ODFacet*    operator ++()            {return this->Next();}
  128.     
  129.     private:
  130.     Environment* fEv;
  131.     ODFacet*     fCurrent;
  132. };
  133.  
  134.  
  135. class TempODEmbeddedFramesIterator :public BaseTempObj
  136. {
  137.     public:
  138.     _DLLIMPORTEXPORT_ TempODEmbeddedFramesIterator( Environment*, ODPart*, ODFrame* );
  139.     _DLLIMPORTEXPORT_ ODFrame*    First( );
  140.     ODFrame*    Current( )            {return fCurrent;}
  141.     _DLLIMPORTEXPORT_ ODFrame*    Next( );
  142.     _DLLIMPORTEXPORT_ ODBoolean    IsNotComplete( );
  143.             operator ODFrame*()        {return fCurrent;}
  144.     ODFrame*    operator ->()            {return fCurrent;}
  145.     ODFrame*    operator ++()            {return this->Next();}
  146.     
  147.     private:
  148.     Environment* fEv;
  149.     ODFrame*     fCurrent;
  150. };
  151.  
  152.  
  153. class TempODWindowIterator :public BaseTempObj
  154. {
  155.     public:
  156.     _DLLIMPORTEXPORT_ TempODWindowIterator( Environment*, ODWindowState* );
  157.     _DLLIMPORTEXPORT_ ODWindow*    First( );
  158.     ODWindow*    Current( )            {return fCurrent;}
  159.     _DLLIMPORTEXPORT_ ODWindow*    Next( );
  160.     _DLLIMPORTEXPORT_ ODBoolean    IsNotComplete( );
  161.                 operator ODWindow*()    {return fCurrent;}
  162.     ODWindow*    operator ->()            {return fCurrent;}
  163.     ODWindow*    operator ++()            {return this->Next();}
  164.     
  165.     private:
  166.     Environment* fEv;
  167.     ODWindow*     fCurrent;
  168. };
  169.  
  170.  
  171. class TempODFocusSetIterator :public BaseTempObj
  172. {
  173.     public:
  174.     _DLLIMPORTEXPORT_ TempODFocusSetIterator( Environment*, ODFocusSet* );
  175.     _DLLIMPORTEXPORT_ ODTypeToken    First( );
  176.     ODTypeToken    Current( )            {return fCurrent;}
  177.     _DLLIMPORTEXPORT_ ODTypeToken    Next( );
  178.     _DLLIMPORTEXPORT_ ODBoolean    IsNotComplete( );
  179.  
  180.             operator ODTypeToken()    {return fCurrent;}
  181.     ODTypeToken    operator ++()            {return this->Next();}
  182.     
  183.     private:
  184.     Environment* fEv;
  185.     ODTypeToken     fCurrent;
  186. };
  187.  
  188.  
  189. class TempODTypeListIterator :public BaseTempObj
  190. {
  191.     public:
  192.     _DLLIMPORTEXPORT_ TempODTypeListIterator( Environment*, ODTypeList* );
  193.     _DLLIMPORTEXPORT_ ~TempODTypeListIterator( );
  194.     _DLLIMPORTEXPORT_ ODType        First( );
  195.     ODType        Current( )            {return fCurrent;}
  196.     _DLLIMPORTEXPORT_ ODType        Next( );
  197.     _DLLIMPORTEXPORT_ ODBoolean    IsNotComplete( );
  198.             operator ODType()        {return fCurrent;}
  199.     ODType        operator++()            {return this->Next();}
  200.     
  201.     private:
  202.     Environment* fEv;
  203.     ODType         fCurrent;
  204. };
  205.  
  206.  
  207. #ifdef _OD_IMPL_
  208.  
  209. class TempODDragItemIterator :public BaseTempObj
  210. {
  211.     public:
  212.     TempODDragItemIterator( Environment*, ODDragAndDrop* );
  213.     ODStorageUnit* First( );
  214.     ODStorageUnit* Current( )                {return fCurrent;}
  215.     ODStorageUnit* Next( );
  216.     ODBoolean    IsNotComplete( );
  217.                 operator ODStorageUnit*()    {return fCurrent;}
  218.     ODStorageUnit* operator ->()            {return fCurrent;}
  219.     ODStorageUnit* operator ++()            {return this->Next();}
  220.     
  221.     private:
  222.     Environment* fEv;
  223.     ODStorageUnit* fCurrent;
  224. };
  225.  
  226. #endif /*_OD_IMPL_*/
  227.  
  228.  
  229. #endif /*_TEMPITER_*/
  230.