home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / iives.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  7.4 KB  |  278 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. #pragma info (nocls, nocnd, nocns, nocnv, noext, nognr, novft)
  19. #pragma pack (4)
  20.  
  21. // ---
  22. // IVEqualitySequenceImpl
  23. // ---
  24.  
  25. // public members
  26.  
  27. template <class VInherited>
  28. IVEqualitySequenceImpl <VInherited>::
  29. IVEqualitySequenceImpl (Ops& ops, INumber numberOfElements)
  30. : VInherited (ops, numberOfElements)
  31. {
  32. }
  33.  
  34. template <class VInherited>
  35. IVEqualitySequenceImpl <VInherited>::
  36. IVEqualitySequenceImpl
  37.   (Ops& ops, IVEqualitySequenceImpl <VInherited> const& collection)
  38. : VInherited (ops, collection)
  39. {
  40. }
  41.  
  42. template <class VInherited>
  43. IBoolean
  44. IVEqualitySequenceImpl <VInherited>::
  45. Add (void const* element, ICursorImpl& cursor)
  46. { IBoolean isEnabled = IsEnabledForNotification ();
  47.   DisableNotification ();
  48.   IBoolean hasBeenAdded = VInherited::Add (element, cursor);
  49.   EnableNotification (isEnabled);
  50.   if (hasBeenAdded && HasObservers ()) {
  51.     NotifyOfAddAt (cursor);
  52.   }
  53.   return hasBeenAdded;
  54. }
  55.  
  56. template <class VInherited>
  57. void
  58. IVEqualitySequenceImpl <VInherited>::
  59. AddAllFrom (IACollectionImpl const& collection)
  60. { IBoolean isEnabled = IsEnabledForNotification ();
  61.   DisableNotification ();
  62.   VInherited::AddAllFrom (collection);
  63.   EnableNotification (isEnabled);
  64.   if (HasObservers ()) {
  65.     NotifyOfModification ();
  66.   }
  67. }
  68.  
  69. template <class VInherited>
  70. void
  71. IVEqualitySequenceImpl <VInherited>::
  72. AddAsFirst (void const* element, ICursorImpl& cursor)
  73. { VInherited::AddAsFirst (element, cursor);
  74.   if (HasObservers ()) {
  75.     NotifyOfAddAt (cursor);
  76.   }
  77. }
  78.  
  79. template <class VInherited>
  80. void
  81. IVEqualitySequenceImpl <VInherited>::
  82. AddAsLast (void const* element, ICursorImpl& cursor)
  83. { VInherited::AddAsLast (element, cursor);
  84.   if (HasObservers ()) {
  85.     NotifyOfAddAt (cursor);
  86.   }
  87. }
  88.  
  89. template <class VInherited>
  90. void
  91. IVEqualitySequenceImpl <VInherited>::
  92. AddAsNext (void const* element, ICursorImpl& cursor)
  93. { VInherited::AddAsNext (element, cursor);
  94.   if (HasObservers ()) {
  95.     NotifyOfAddAt (cursor);
  96.   }
  97. }
  98.  
  99. template <class VInherited>
  100. void
  101. IVEqualitySequenceImpl <VInherited>::
  102. AddAsPrevious (void const* element, ICursorImpl& cursor)
  103. { VInherited::AddAsPrevious (element, cursor);
  104.   if (HasObservers ()) {
  105.     NotifyOfAddAt (cursor);
  106.   }
  107. }
  108.  
  109. template <class VInherited>
  110. void
  111. IVEqualitySequenceImpl <VInherited>::
  112. AddAtPosition (IPosition position,
  113.                void const* element,
  114.                ICursorImpl& cursor)
  115. { VInherited::AddAtPosition (position, element, cursor);
  116.   if (HasObservers ()) {
  117.     NotifyOfAddAt (cursor);
  118.   }
  119. }
  120.  
  121. template <class VInherited>
  122. void
  123. IVEqualitySequenceImpl <VInherited>::
  124. Copy (IACollectionImpl const& collection)
  125. { IBoolean isEnabled = IsEnabledForNotification ();
  126.   DisableNotification ();
  127.   VInherited::Copy (collection);
  128.   EnableNotification (isEnabled);
  129.   if (HasObservers ()) {
  130.     NotifyOfModification ();
  131.   }
  132. }
  133.  
  134. template <class VInherited>
  135. IBoolean
  136. IVEqualitySequenceImpl <VInherited>::
  137. LocateOrAdd (void const* element, ICursorImpl& cursor)
  138. { IBoolean isEnabled = IsEnabledForNotification ();
  139.   DisableNotification ();
  140.   IBoolean hasBeenLocated = VInherited::LocateOrAdd (element, cursor);
  141.   EnableNotification (isEnabled);
  142.   if (! hasBeenLocated && HasObservers ()) {
  143.     NotifyOfAddAt (cursor);
  144.   }
  145.   return hasBeenLocated;
  146. }
  147.  
  148. template <class VInherited>
  149. IBoolean
  150. IVEqualitySequenceImpl <VInherited>::
  151. Remove (void const* element)
  152. { if (HasObservers () &&  Locate (element, CursorOf (*this))) {
  153.     NotifyOfRemoveAt (CursorOf (*this));
  154.   }
  155.   return VInherited::Remove (element);
  156. }
  157.  
  158. template <class VInherited>
  159. INumber
  160. IVEqualitySequenceImpl <VInherited>::
  161. RemoveAll ()
  162. { INumber result = VInherited::RemoveAll ();
  163.   if (result > 0 && HasObservers ()) {
  164.     NotifyOfModification ();
  165.   }
  166.   return result;
  167. }
  168.  
  169. template <class VInherited>
  170. INumber
  171. IVEqualitySequenceImpl <VInherited>::
  172. RemoveAll (IPredFunc predFunc, void* addArg)
  173. { INumber result = VInherited::RemoveAll (predFunc, addArg);
  174.   if (result > 0 && HasObservers ()) {
  175.     NotifyOfModification ();
  176.   }
  177.   return result;
  178. }
  179.  
  180. template <class VInherited>
  181. INumber
  182. IVEqualitySequenceImpl <VInherited>::
  183. RemoveAllOccurrences (void const* element)
  184. { IBoolean isEnabled = IsEnabledForNotification ();
  185.   DisableNotification ();
  186.   INumber result = VInherited::RemoveAllOccurrences (element);
  187.   EnableNotification (isEnabled);
  188.   if (result > 0 && HasObservers ()) {
  189.     NotifyOfModification ();
  190.   }
  191.   return result;
  192. }
  193.  
  194. template <class VInherited>
  195. void
  196. IVEqualitySequenceImpl <VInherited>::
  197. RemoveAt (ICursorImpl& cursor)
  198. { if (HasObservers ()) {
  199.     NotifyOfRemoveAt (cursor);
  200.   }
  201.   VInherited::RemoveAt (cursor);
  202. }
  203.  
  204. template <class VInherited>
  205. void
  206. IVEqualitySequenceImpl <VInherited>::
  207. RemoveAtPosition (IPosition position)
  208. { if (HasObservers ()) {
  209.     SetToPosition (position, CursorOf (*this));
  210.     NotifyOfRemoveAt (CursorOf (*this));
  211.   }
  212.   VInherited::RemoveAtPosition (position);
  213. }
  214.  
  215. template <class VInherited>
  216. void
  217. IVEqualitySequenceImpl <VInherited>::
  218. RemoveFirst ()
  219. { if (HasObservers ()) {
  220.     SetToFirst (CursorOf (*this));
  221.     NotifyOfRemoveAt (CursorOf (*this));
  222.   }
  223.   VInherited::RemoveFirst ();
  224. }
  225.  
  226. template <class VInherited>
  227. void
  228. IVEqualitySequenceImpl <VInherited>::
  229. RemoveLast ()
  230. { if (HasObservers ()) {
  231.     SetToLast (CursorOf (*this));
  232.     NotifyOfRemoveAt (CursorOf (*this));
  233.   }
  234.   VInherited::RemoveLast ();
  235. }
  236.  
  237. template <class VInherited>
  238. void
  239. IVEqualitySequenceImpl <VInherited>::
  240. ReplaceAt (ICursorImpl const& cursor, void const* element)
  241. { if (HasObservers ()) {
  242. #if defined (ICLCC_COMPAT_IVB)
  243.     NotifyOfRemoveAt (cursor); // to be removed in a future release
  244. #else
  245.     NotifyOfReplaceAt (cursor, element);
  246. #endif
  247.   }
  248.   VInherited::ReplaceAt (cursor, element);
  249. #if defined (ICLCC_COMPAT_IVB)
  250.   if (HasObservers ()) {
  251.     NotifyOfAddAt (cursor); // to be removed in a future release
  252.   }
  253. #endif
  254. }
  255.  
  256. template <class VInherited>
  257. void
  258. IVEqualitySequenceImpl <VInherited>::
  259. Reverse ()
  260. { VInherited::Reverse ();
  261.   if (HasObservers ()) {
  262.     NotifyOfModification ();
  263.   }
  264. }
  265.  
  266. template <class VInherited>
  267. void
  268. IVEqualitySequenceImpl <VInherited>::
  269. Sort (ICompFunc compFunc, void* addArg)
  270. { VInherited::Sort (compFunc, addArg);
  271.   if (HasObservers ()) {
  272.     NotifyOfModification ();
  273.   }
  274. }
  275.  
  276. #pragma info (restore)
  277. #pragma pack ()
  278.