home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osp1.exe / src / basecntr / iodbcitr.cpp < prev    next >
C/C++ Source or Header  |  1997-04-02  |  9KB  |  315 lines

  1. //  @(#)Z 1.19 com/src/samples/basecntr/iodbcitr.cpp, odbasepart, od96os2, odos29712d 97/03/21 17:45:38 (96/12/06 16:08:01)
  2. //====START_GENERATED_PROLOG======================================
  3. //
  4. //
  5. //   COMPONENT_NAME: odsamples
  6. //
  7. //   CLASSES: none
  8. //
  9. //   ORIGINS: 82,27
  10. //
  11. //
  12. //   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  13. //   All Rights Reserved
  14. //   Licensed Materials - Property of IBM
  15. //   US Government Users Restricted Rights - Use, duplication or
  16. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17. //
  18. //   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  19. //   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  20. //   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  21. //   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  22. //   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  23. //   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  24. //   OR PERFORMANCE OF THIS SOFTWARE.
  25. //
  26. //====END_GENERATED_PROLOG========================================
  27. //
  28.  
  29. #ifndef SOM_Module_iodbcitr_Source
  30. #define SOM_Module_iodbcitr_Source
  31. #endif
  32. #define BCIterator_Class_Source
  33.  
  34. #define VARIABLE_MACROS
  35. #define SOM_DONT_IMPORT_CLASS_ALink
  36. #define SOM_DONT_IMPORT_CLASS_ALinkedList
  37. #define SOM_DONT_IMPORT_CLASS_BaseContainer
  38. #define SOM_DONT_IMPORT_CLASS_ContentObject
  39. #define SOM_DONT_IMPORT_CLASS_ContentFrame
  40.  
  41. #ifndef _ALinkedList_
  42. #include <iodbcutl.xh>
  43. #endif
  44.  
  45. #include "iodbcitr.xih"
  46.  
  47.  
  48. #include "iodbasec.xh"
  49.  
  50.  
  51.  
  52. // -------------------------------------------------------------------------
  53. // -----                                                               -----
  54. // -----                  BCIterator  Clase                            -----
  55. // -----                                                               -----
  56. // -----              Overriding Inherited Methods                     -----
  57. // -----                                                               -----
  58. // -------------------------------------------------------------------------
  59.  
  60.  
  61.  
  62. // -------------------------------------------------
  63. // List of Methods
  64. // -------------------------------------------------
  65. // SOMObject --> somInit
  66. // SOMObject --> somUninit
  67. //
  68. // ODEmbeddedFramesIteratort --> InitEmbeddedFramesIterator
  69. // ODEmbeddedFramesIteratort --> First
  70. // ODEmbeddedFramesIteratort --> Next
  71. // ODEmbeddedFramesIteratort --> IsNotComplete
  72. //
  73. // ODEmbeddedFramesIteratort --> CheckValid
  74. // ODEmbeddedFramesIteratort --> isValid
  75. // ODEmbeddedFramesIteratort --> PartRemoved
  76.  
  77.  
  78.  
  79. // -------------------------------------------------------------------------
  80. // ODEmbeddedFramesIterator --> InitEmbeddedFramesIterator
  81. //
  82. //      Initializes the embedded frames iterator for OpenDoc. OpenDoc
  83. //      doesn't provide an iterator class for your part, but allows you
  84. //      the freedom to create your frame list startegy. However other
  85. //      parts may need access to your list of embedded frames, and so
  86. //      OpenDoc provides an intertface which you must match up to your
  87. //      internal implementation.
  88. //
  89. //      ->
  90. // -------------------------------------------------------------------------
  91.  
  92. SOM_Scope       void
  93. SOMLINK         BCIteratorInitEmbeddedFramesIterator
  94.                 (
  95.                 BCIterator *somSelf,            // in
  96.                 Environment *ev,                // in
  97.                 ODPart* part                    // in
  98.                 )
  99. {
  100.     BCIteratorData *somThis = BCIteratorGetData(somSelf);
  101.     BCIteratorMethodDebug("BCIterator","BCIteratorInitEmbeddedFramesIterator");
  102.  
  103.  
  104.  
  105.  
  106.     BaseContainer *bcpart = (BaseContainer *)part;
  107.  
  108.     _fLink = bcpart->GetEmbeddedObjects(ev);
  109.     _fNode= _fLink->First(ev); 
  110.  
  111.  
  112.  
  113. }
  114.  
  115.  
  116.  
  117.  
  118. // -------------------------------------------------------------------------
  119. // ODEmbeddedFramesIterator --> First
  120. //
  121. //      Returns the first frame in the parts embedded frames list.
  122. //
  123. //      ->
  124. // -------------------------------------------------------------------------
  125.  
  126. SOM_Scope       ODFrame*
  127. SOMLINK         BCIteratorFirst
  128.                 (
  129.                 BCIterator *somSelf,            // in
  130.                 Environment *ev                 // in
  131.                 )
  132. {
  133.     BCIteratorData *somThis = BCIteratorGetData(somSelf);
  134.     BCIteratorMethodDebug("BCIterator","BCIteratorFirst");
  135.  
  136.  
  137.  
  138.     _fNode = _fLink->First(ev);
  139.     ODFrame *frame = (ODFrame*)_fNode->Content(ev);
  140.     _fNode = _fNode->Next(ev);
  141.     return frame;
  142. }
  143.  
  144.  
  145.  
  146.  
  147. // -------------------------------------------------------------------------
  148. // ODEmbeddedFramesIterator --> Next
  149. //
  150. //      Returns the next frame in the parts embedded frames list.
  151. //
  152. //      ->
  153. // -------------------------------------------------------------------------
  154.  
  155. SOM_Scope       ODFrame*
  156. SOMLINK         BCIteratorNext
  157.                 (
  158.                 BCIterator *somSelf,            // in
  159.                 Environment *ev                 // in
  160.                 )
  161. {
  162.     BCIteratorData *somThis = BCIteratorGetData(somSelf);
  163.     BCIteratorMethodDebug("BCIterator","BCIteratorNext");
  164.  
  165.  
  166.     ODFrame *frame = (ODFrame*)_fNode->Content(ev);
  167.     _fNode = _fNode->Next(ev);
  168.     return frame;
  169. }
  170.  
  171.  
  172.  
  173.  
  174. // -------------------------------------------------------------------------
  175. // ODEmbeddedFramesIterator --> IsNotComplete
  176. //
  177. //      Returns a Boolean value of False if at the end of the embedded
  178. //      frames list, otherwise this method returns true.
  179. //
  180. //      ->
  181. // -------------------------------------------------------------------------
  182.  
  183. SOM_Scope       ODBoolean
  184. SOMLINK         BCIteratorIsNotComplete
  185.                 (
  186.                 BCIterator *somSelf,            // in
  187.                 Environment *ev                 // in
  188.                 )
  189. {
  190.     BCIteratorData *somThis = BCIteratorGetData(somSelf);
  191.     BCIteratorMethodDebug("BCIterator","BCIteratorIsNotComplete");
  192.  
  193.  
  194.  
  195.  
  196.     return ((_fNode->Content(ev)==0) ? kODFalse : kODTrue);
  197. }
  198.  
  199.  
  200.  
  201.  
  202. // -------------------------------------------------------------------------
  203. // ODEmbeddedFramesIterator --> PartRemoved
  204. //
  205. //      Called by this part to invalidate the embedded frames list prior
  206. //      to closing down.
  207. //
  208. //      ->
  209. // -------------------------------------------------------------------------
  210.  
  211. SOM_Scope       void
  212. SOMLINK         BCIteratorPartRemoved
  213.                 (
  214.                 BCIterator *somSelf,            // in
  215.                 Environment *ev                 // in
  216.                 )
  217. {
  218.     BCIteratorData *somThis = BCIteratorGetData(somSelf);
  219.     BCIteratorMethodDebug("BCIterator","BCIteratorPartRemoved");
  220.  
  221.  
  222.  
  223.  
  224.  
  225. }
  226.  
  227.  
  228.  
  229.  
  230. // -------------------------------------------------------------------------
  231. // ODEmbeddedFramesIterator --> CheckValid
  232. //
  233. //      Checks validity of the embedded frames iterator and throws an
  234. //      exception if not. If implemented it should be called by each
  235. //      method of the subclass(i.e. BCIterator)
  236. //
  237. //      ->
  238. // -------------------------------------------------------------------------
  239.  
  240. SOM_Scope       void
  241. SOMLINK         BCIteratorCheckValid
  242.                 (
  243.                 BCIterator *somSelf,            // in
  244.                 Environment *ev                 // in
  245.                 )
  246. {
  247.     BCIteratorData *somThis = BCIteratorGetData(somSelf);
  248.     BCIteratorMethodDebug("BCIterator","BCIteratorCheckValid");
  249.  
  250.  
  251.  
  252.  
  253.  
  254. }
  255.  
  256.  
  257.  
  258.  
  259. // -------------------------------------------------------------------------
  260. // ODEmbeddedFramesIterator --> IsValid
  261. //
  262. //      Checks validity of the embedded frames iterator and returns a
  263. //      Boolean False if not. If implemented it should be called by each
  264. //      method of the subclass(i.e. BCIterator)
  265. //
  266. //
  267. //      ->
  268. // -------------------------------------------------------------------------
  269.  
  270. SOM_Scope       ODBoolean
  271. SOMLINK         BCIteratorIsValid
  272.                 (
  273.                 BCIterator *somSelf,            // in
  274.                 Environment *ev                 // in
  275.                 )
  276. {
  277.     BCIteratorData *somThis = BCIteratorGetData(somSelf);
  278.     BCIteratorMethodDebug("BCIterator","BCIteratorIsValid");
  279.  
  280.  
  281.  
  282.  
  283.     return kODFalse;
  284. }
  285.  
  286.  
  287.  
  288.  
  289. // -------------------------------------------------------------------------
  290. // ODEmbeddedFramesIterator --> somUninit
  291. //
  292. //      Disposes of storage for SOMObject of this part.
  293. //
  294. //      -> does not call parent method (called automatically by SOM)
  295. //      -> optional for all parts
  296. //
  297. //      -> somUninit must NOT fail
  298. //
  299. //      ->
  300. // -------------------------------------------------------------------------
  301.  
  302. SOM_Scope       void
  303. SOMLINK         BCIteratorsomUninit
  304.                 (
  305.                 BCIterator *somSelf             // in
  306.                 )
  307. {
  308.     BCIteratorData *somThis = BCIteratorGetData(somSelf);
  309.     BCIteratorMethodDebug("BCIterator","BCIteratorsomUninit");
  310.  
  311.  
  312.  
  313.  
  314. }
  315.