home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / IAEQUAL.C < prev    next >
Text File  |  1993-09-22  |  2KB  |  39 lines

  1. /*******************************************************************************
  2. *                                                                              *
  3. * COPYRIGHT:                                                                   *
  4. *   IBM C/C++ Tools Version 2.01 - Collection Class Library                    *
  5. *   Licensed Materials - Property of IBM                                       *
  6. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  7. *   All Rights Reserved                                                        *
  8. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  9. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  10. *                                                                              *
  11. *******************************************************************************/
  12. template < class Element >
  13. IBoolean IAEqualityCollection < Element >::
  14. isContained (Element const& element, void* env) {
  15.   return (*(IAEqualityCollection < Element >**) env)->contains (element);
  16. }
  17.  
  18. template < class Element >
  19. IBoolean IAEqualityCollection < Element >::
  20. isNotContained (Element const& element, void* env) {
  21.   return ! (*(IAEqualityCollection < Element >**) env)->contains (element);
  22. }
  23.  
  24. template <class Element>
  25. IBoolean IAEqualityCollection < Element >::
  26. containsAllFrom (IACollection < Element > const& collection) const {
  27.   IBoolean result = True;
  28.   ICursor *cursor = collection.newCursor ();
  29.   forCursor (*cursor) {
  30.     if (! contains (collection.elementAt (*cursor))) {
  31.       result = False;
  32.       break;
  33.     }
  34.   }
  35.   delete cursor;
  36.   return result;
  37. };
  38.  
  39.