home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / iatree.inl < prev    next >
Encoding:
Text File  |  1996-02-22  |  9.4 KB  |  362 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. // ------------------
  19. // IElementTreeCursor
  20. // ------------------
  21.  
  22. // public members
  23.  
  24. template <class Element>
  25. inline Element const&
  26. IElementTreeCursor <Element>::
  27. element () const
  28. { return *(Element const*) ImplOf (*this).Element ();
  29. }
  30.  
  31. // protected members
  32.  
  33. template <class Element>
  34. inline
  35. IElementTreeCursor <Element>::
  36. IElementTreeCursor (Implementation* impl)
  37. : ITreeCursor (impl)
  38. {
  39. }
  40.  
  41. // ------
  42. // IATree
  43. // ------
  44.  
  45. // public members
  46.  
  47. template <class Element>
  48. inline
  49. IATree <Element>::
  50. ~IATree ()
  51. {
  52. }
  53.  
  54. template <class Element>
  55. inline void
  56. IATree <Element>::
  57. addAsChild (ITreeCursor const& cursor,
  58.             IPosition position, Element const& element)
  59. { ImplOf (*this).AddAsChild (CrsrImplOf (cursor), position, &element);
  60. }
  61.  
  62. template <class Element>
  63. inline void
  64. IATree <Element>::
  65. addAsRoot (Element const& element)
  66. { ImplOf (*this).AddAsRoot (&element);
  67. }
  68.  
  69. template <class Element>
  70. inline IBoolean
  71. IATree <Element>::
  72. allElementsDo (IBoolean (*applFunc) (Element&, void*),
  73.                ITreeIterationOrder order, void* addArg)
  74. { return ImplOf (*this).
  75.     AllElementsDo ((IApplFunc)applFunc, order, addArg);
  76. }
  77.  
  78. template <class Element>
  79. inline IBoolean
  80. IATree <Element>::
  81. allElementsDo (IBoolean (*applFunc) (Element const&, void*),
  82.                ITreeIterationOrder order, void* addArg) const
  83. { return ImplOf (*this).
  84.     AllElementsDo ((IApplFunc)applFunc, order, addArg);
  85. }
  86.  
  87. template <class Element>
  88. inline IBoolean
  89. IATree <Element>::
  90. allElementsDo (IApplicator <Element>& applicator,
  91.                ITreeIterationOrder order)
  92. { return ImplOf (*this).
  93.     AllElementsDo ((IApplFunc)__applFunc, order, &applicator);
  94. }
  95.  
  96. template <class Element>
  97. inline IBoolean
  98. IATree <Element>::
  99. allElementsDo (IConstantApplicator <Element>& applicator,
  100.                ITreeIterationOrder order) const
  101. { return ImplOf (*this).
  102.     AllElementsDo ((IApplFunc)__applFunc, order, &applicator);
  103. }
  104.  
  105. template <class Element>
  106. inline IBoolean
  107. IATree <Element>::
  108. allSubtreeElementsDo
  109.   (ITreeCursor const& cursor,
  110.    IBoolean (*applFunc) (Element&, void*),
  111.    ITreeIterationOrder order, void* addArg)
  112. { return ImplOf (*this).AllSubtreeElementsDo
  113.     (CrsrImplOf (cursor), (IApplFunc)applFunc, order, addArg);
  114. }
  115.  
  116. template <class Element>
  117. inline IBoolean
  118. IATree <Element>::
  119. allSubtreeElementsDo
  120.   (ITreeCursor const& cursor,
  121.    IBoolean (*applFunc) (Element const&, void*),
  122.    ITreeIterationOrder order, void* addArg) const
  123. { return ImplOf (*this).AllSubtreeElementsDo
  124.     (CrsrImplOf (cursor), (IApplFunc)applFunc, order, addArg);
  125. }
  126.  
  127. template <class Element>
  128. inline IBoolean
  129. IATree <Element>::
  130. allSubtreeElementsDo (ITreeCursor const& cursor,
  131.                       IApplicator <Element>& applicator,
  132.                       ITreeIterationOrder order)
  133. { return ImplOf (*this).AllSubtreeElementsDo
  134.     (CrsrImplOf (cursor), (IApplFunc)__applFunc, order, &applicator);
  135. }
  136.  
  137. template <class Element>
  138. inline IBoolean
  139. IATree <Element>::
  140. allSubtreeElementsDo (ITreeCursor const& cursor,
  141.                       IConstantApplicator <Element>& applicator,
  142.                       ITreeIterationOrder order) const
  143. { return ImplOf (*this).AllSubtreeElementsDo
  144.     (CrsrImplOf (cursor), (IApplFunc)__applFunc, order, &applicator);
  145. }
  146.  
  147. template <class Element>
  148. inline IPosition
  149. IATree <Element>::
  150. childPositionAt (ITreeCursor const& cursor) const
  151. { return ImplOf (*this).ChildPositionAt (CrsrImplOf (cursor));
  152. }
  153.  
  154. template <class Element>
  155. inline Element&
  156. IATree <Element>::
  157. elementAt (ITreeCursor const& cursor)
  158. { return *(Element*) ImplOf (*this).ElementAt (CrsrImplOf (cursor));
  159. }
  160.  
  161. template <class Element>
  162. inline Element const&
  163. IATree <Element>::
  164. elementAt (ITreeCursor const& cursor) const
  165. { return *(Element const*) ImplOf (*this).
  166.     ElementAt (CrsrImplOf (cursor));
  167. }
  168.  
  169. template <class Element>
  170. inline IBoolean
  171. IATree <Element>::
  172. isConsistent () const
  173. { return ImplOf (*this).IsConsistent ();
  174. }
  175.  
  176. template <class Element>
  177. inline IBoolean
  178. IATree <Element>::
  179. isEmpty () const
  180. { return ImplOf (*this).IsEmpty ();
  181. }
  182.  
  183. template <class Element>
  184. inline IBoolean
  185. IATree <Element>::
  186. isLeaf (ITreeCursor const& cursor) const
  187. { return ImplOf (*this).IsLeaf (CrsrImplOf (cursor));
  188. }
  189.  
  190. template <class Element>
  191. inline IBoolean
  192. IATree <Element>::
  193. isRoot (ITreeCursor const& cursor) const
  194. { return ImplOf (*this).IsRoot (CrsrImplOf (cursor));
  195. }
  196.  
  197. template <class Element>
  198. inline ITreeCursor*
  199. IATree <Element>::
  200. newCursor () const
  201. { return InterfaceFor (ImplOf (*this).CreateCursor ());
  202. }
  203.  
  204. template <class Element>
  205. inline INumber
  206. IATree <Element>::
  207. numberOfElements () const
  208. { return ImplOf (*this).NumberOfElements ();
  209. }
  210.  
  211. template <class Element>
  212. inline INumber
  213. IATree <Element>::
  214. numberOfLeaves () const
  215. { return ImplOf (*this).NumberOfLeaves ();
  216. }
  217.  
  218. template <class Element>
  219. inline INumber
  220. IATree <Element>::
  221. numberOfSubtreeElements (ITreeCursor const& cursor) const
  222. { return ImplOf (*this).NumberOfSubtreeElements (CrsrImplOf (cursor));
  223. }
  224.  
  225. template <class Element>
  226. inline INumber
  227. IATree <Element>::
  228. numberOfSubtreeLeaves (ITreeCursor const& cursor) const
  229. { return ImplOf (*this).NumberOfSubtreeLeaves (CrsrImplOf (cursor));
  230. }
  231.  
  232. template <class Element>
  233. inline IPosition
  234. IATree <Element>::
  235. position (ITreeCursor const& cursor) const
  236. { return ImplOf (*this).ChildPositionAt (CrsrImplOf (cursor));
  237. }
  238.  
  239. template <class Element>
  240. inline INumber
  241. IATree <Element>::
  242. removeAll ()
  243. { return ImplOf (*this).RemoveAll ();
  244. }
  245.  
  246. template <class Element>
  247. inline INumber
  248. IATree <Element>::
  249. removeSubtree (ITreeCursor& cursor)
  250. { return ImplOf (*this).RemoveSubtree (CrsrImplOf (cursor));
  251. }
  252.  
  253. template <class Element>
  254. inline void
  255. IATree <Element>::
  256. replaceAt (ITreeCursor const& cursor, Element const& element)
  257. { ImplOf (*this).ReplaceAt (CrsrImplOf (cursor), &element);
  258. }
  259.  
  260. template <class Element>
  261. inline IBoolean
  262. IATree <Element>::
  263. setToChild (IPosition position, ITreeCursor& cursor) const
  264. { return ImplOf (*this).SetToChild (position, CrsrImplOf (cursor));
  265. }
  266.  
  267. template <class Element>
  268. inline IBoolean
  269. IATree <Element>::
  270. setToFirst (ITreeCursor& cursor, ITreeIterationOrder order) const
  271. { return ImplOf (*this).SetToFirst (CrsrImplOf (cursor), order);
  272. }
  273.  
  274. template <class Element>
  275. inline IBoolean
  276. IATree <Element>::
  277. setToFirstExistingChild (ITreeCursor& cursor) const
  278. { return ImplOf (*this).SetToFirstExistingChild (CrsrImplOf (cursor));
  279. }
  280.  
  281. template <class Element>
  282. inline IBoolean
  283. IATree <Element>::
  284. setToLast (ITreeCursor& cursor, ITreeIterationOrder order) const
  285. { return ImplOf (*this).SetToLast (CrsrImplOf (cursor), order);
  286. }
  287.  
  288. template <class Element>
  289. inline IBoolean
  290. IATree <Element>::
  291. setToLastExistingChild (ITreeCursor& cursor) const
  292. { return ImplOf (*this).SetToLastExistingChild (CrsrImplOf (cursor));
  293. }
  294.  
  295. template <class Element>
  296. inline IBoolean
  297. IATree <Element>::
  298. setToNext (ITreeCursor& cursor, ITreeIterationOrder order) const
  299. { return ImplOf (*this).SetToNext (CrsrImplOf (cursor), order);
  300. }
  301.  
  302. template <class Element>
  303. inline IBoolean
  304. IATree <Element>::
  305. setToNextExistingChild (ITreeCursor& cursor) const
  306. { return ImplOf (*this).SetToNextExistingChild (CrsrImplOf (cursor));
  307. }
  308.  
  309. template <class Element>
  310. inline IBoolean
  311. IATree <Element>::
  312. setToParent (ITreeCursor& cursor) const
  313. { return ImplOf (*this).SetToParent (CrsrImplOf (cursor));
  314. }
  315.  
  316. template <class Element>
  317. inline IBoolean
  318. IATree <Element>::
  319. setToPrevious (ITreeCursor& cursor, ITreeIterationOrder order) const
  320. { return ImplOf (*this).SetToPrevious (CrsrImplOf (cursor), order);
  321. }
  322.  
  323. template <class Element>
  324. inline IBoolean
  325. IATree <Element>::
  326. setToPreviousExistingChild (ITreeCursor& cursor) const
  327. { return ImplOf (*this).
  328.     SetToPreviousExistingChild (CrsrImplOf (cursor));
  329. }
  330.  
  331. template <class Element>
  332. inline IBoolean
  333. IATree <Element>::
  334. setToRoot (ITreeCursor& cursor) const
  335. { return ImplOf (*this).SetToRoot (CrsrImplOf (cursor));
  336. }
  337.  
  338. // protected members
  339.  
  340. template <class Element>
  341. inline
  342. IATree <Element>::
  343. IATree ()
  344. : IATreeBase ()
  345. {
  346. }
  347.  
  348. template <class Element>
  349. inline
  350. IATree <Element>::
  351. IATree (IATree <Element> const& tree)
  352. : IATreeBase (tree)
  353. {
  354. }
  355.  
  356. template <class Element>
  357. inline IATree <Element>::Implementation&
  358. IATree <Element>::
  359. ImplOf (IATree <Element> const& tree)
  360. { return *(Implementation*)tree.ivImpl;
  361. }
  362.