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

  1. /* @(#)Z 1.4 com/src/registry/csetwrap.h, odconfig, od96os2, odos29646d 96/11/15 15:49:28 (96/10/29 09:29:37) */
  2. //====START_GENERATED_PROLOG======================================
  3. //
  4. //
  5. //   COMPONENT_NAME: odconfig
  6. //
  7. //   CLASSES:   CWrap
  8. //        FileExtensionSet
  9. //        FileTypeSet
  10. //        KindSet
  11. //        PartSet
  12. //
  13. //   ORIGINS: 27
  14. //
  15. //
  16. //   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  17. //   All Rights Reserved
  18. //   Licensed Materials - Property of IBM
  19. //   US Government Users Restricted Rights - Use, duplication or
  20. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  21. //       
  22. //   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  23. //   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  24. //   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  25. //   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  26. //   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  27. //   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  28. //   OR PERFORMANCE OF THIS SOFTWARE.
  29. //
  30. //====END_GENERATED_PROLOG========================================
  31. //
  32.  
  33. #ifndef CSETWRAP_HPP
  34. #define CSETWRAP_HPP
  35.  
  36. #include <som.xh>
  37. #include <iset.h>
  38. #include <ODTypes.h>
  39. #include <PartInfi.xh>
  40. #include <PartKind.xh>
  41. #include <PartCat.xh>
  42.  
  43. /*********************************************************************/
  44. /* Wrapper for SOM class because ISet expects elements to overload   */
  45. /* operators.                                                        */
  46. /*********************************************************************/
  47. template <class Element>
  48. class CWrap
  49.     const Element* e1;
  50. public:
  51.  
  52.     CWrap( const CWrap<Element>& cw) : e1( cw)
  53.     {
  54.     }
  55.     CWrap( Element* e1) : e1( e1) 
  56.     {
  57.     }
  58.     ~CWrap()
  59.     {
  60.     }
  61.     operator const Element* () const
  62.     {
  63.         return e1;
  64.     }
  65.     operator Element* ()
  66.     {
  67.         return (Element*)e1;
  68.     }
  69.     CWrap<Element>& operator =        (CWrap<Element> const& cw)
  70.     {
  71.         e1 = cw;
  72.         return *this;
  73.     }
  74.     Boolean operator ==        (CWrap<Element> const& cw) const
  75.     {
  76.         return !compare( cw);
  77.     }
  78.     Boolean operator >         (CWrap<Element> const& cw) const
  79.     {
  80.         return compare( cw) > 0;
  81.     }
  82.     Boolean operator <         (CWrap<Element> const& cw) const
  83.     {
  84.         return compare( cw) < 0;
  85.     }
  86.     long          compare      (const Element* e2) const
  87.     {
  88.         return strcmp( ((Element*)e1)->GetKey( somGetGlobalEnvironment()), 
  89.                        ((Element*)e2)->GetKey( somGetGlobalEnvironment()) );
  90.     }
  91. };
  92.  
  93. /*********************************************************************/
  94. /* Wrapper for template, because SOM "no like templates."            */
  95. /*********************************************************************/
  96. class PartSet : public ISet< CWrap<ODPartHandlerInfoInt> >
  97. {
  98. };
  99.  
  100. /*********************************************************************/
  101. /* Wrapper for template, because SOM "no like templates."            */
  102. /*********************************************************************/
  103. class KindSet : public ISet< CWrap<ODPartKind> >
  104. {
  105. };
  106.  
  107. /*********************************************************************/
  108. /* Wrapper for template, because SOM "no like templates."            */
  109. /*********************************************************************/
  110. class FileTypeSet : public ISet< CWrap<ODPartFileType > >
  111. {
  112. };
  113.  
  114. /*********************************************************************/
  115. /* Wrapper for template, because SOM "no like templates."            */
  116. /*********************************************************************/
  117. class FileExtensionSet : public ISet< CWrap<ODPartFileExtension > >
  118. {
  119. };
  120. #endif
  121.