home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WOLEIFAM.HPP < prev    next >
C/C++ Source or Header  |  1996-12-05  |  6KB  |  180 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WOleInterfaceFamily -- Ole Interface Family class
  14.  *
  15.  *
  16.  *   Events:
  17.  *
  18.  *
  19.  *************************************************************************/
  20.  
  21. #ifndef _WOLEIFAM_HPP_INCLUDED
  22. #define _WOLEIFAM_HPP_INCLUDED
  23.  
  24. #ifndef _WNO_PRAGMA_PUSH
  25. #pragma pack(push,8);
  26. #pragma enum int;
  27. #endif
  28.  
  29. #ifndef _WOLETYPE_HPP_INCLUDED
  30. #   include "woletype.hpp"
  31. #endif
  32. #ifndef _WOLESOBJ_HPP_INCLUDED
  33. #   include "wolesobj.hpp"
  34. #endif
  35.  
  36. // forward class declarations
  37. class WCMCLASS wllist_header;
  38. class WCMCLASS WApplication;
  39.  
  40. class WCMCLASS WOleInterfaceFamilyRegistryData {
  41.     public:
  42.         WOleInterfaceFamilyRegistryData( const WCLSID & clsid, void * );
  43.         ~WOleInterfaceFamilyRegistryData( void );
  44.  
  45.         // Properties
  46.         WBool SetRegistryDataBlock( void * );
  47.         void *GetRegistryDataBlock( void ) const;
  48.  
  49.         // Self Registration
  50.         virtual WBool Register( WApplication *application );
  51.         virtual WBool Unregister( void );
  52.  
  53.         WCLSID                                  _classID;
  54.         WOleInterfaceFamilyRegistryData        *next;
  55.         static WOleInterfaceFamilyRegistryData *Head;
  56.  
  57.     private:
  58.         void                                   *_registryDataBlock;
  59. };
  60.  
  61. // the following is definitions of WOleInterfaceFamily
  62.  
  63. class WCMCLASS WOleInterfaceFamily : public WEventGenerator {
  64.     WDeclareSubclass( WOleInterfaceFamily, WEventGenerator );
  65.  
  66.     public:
  67.  
  68.         /**********************************************************
  69.          * Constructors and Destructors
  70.          *********************************************************/
  71.  
  72.         // Aggregating IUnknown ( unkOuter )
  73.         //    This class will NOT call AddRef through the IUnknown
  74.         //    pointer nor will it call Release in its destructor.
  75.         //    This is to avoid circular reference counts as
  76.         //    The implementor on the aggregating IUnknown is expected
  77.         //    to control the lifetime of the instance of this class.
  78.         WOleInterfaceFamily( WOleServerObject *serverObject );
  79.  
  80.         virtual ~WOleInterfaceFamily();
  81.  
  82.     public:
  83.  
  84.         /**************************************************************
  85.          * Properties
  86.          **************************************************************/
  87.  
  88.         /**************************************************************
  89.          * Static Methods
  90.          **************************************************************/
  91.  
  92.         // Self Registration
  93.         static WBool Register( WApplication *application );
  94.         static WBool Unregister( void );
  95.  
  96.         /**************************************************************
  97.          * Methods
  98.          **************************************************************/
  99.  
  100.         // Query Interface
  101.         //    The object that owns the aggregating IUnknown pointer
  102.         //    ( usually a WOleServerObject ) will call this method
  103.         //    to retrieve pointers to interface implementations.
  104.         //    NOTE: DO NOT AddRef the returned "iface" this is done by the
  105.         //          server object
  106.         virtual WBool QueryInterface( const WCLSID & clsid, void **iface );
  107.  
  108.     /**********************************************************
  109.      * Data Members
  110.      *********************************************************/
  111.     
  112.     protected:
  113.         WOleServerObject                *_serverObject;
  114.         WPIUnknown                      _unkOuter;
  115.  
  116. };
  117.  
  118. /*************************************************************************
  119.  *
  120.  * WOleGenericInterfaceFamily -- Generic Ole Interface Family class
  121.  *
  122.  *
  123.  *   Events:
  124.  *
  125.  *
  126.  *************************************************************************/
  127.  
  128. class WCMCLASS WOleGenericInterfaceFamily : public WOleInterfaceFamily {
  129.     WDeclareSubclass( WOleGenericInterfaceFamily, WOleInterfaceFamily );
  130.  
  131.     public:
  132.  
  133.         /**********************************************************
  134.          * Constructors and Destructors
  135.          *********************************************************/
  136.  
  137.         // Aggregating IUnknown ( unkOuter )
  138.         //    This class will NOT call AddRef through the IUnknown
  139.         //    pointer nor will it call Release in its destructor.
  140.         //    This is to avoid circular reference counts as
  141.         //    The implementor on the aggregating IUnknown is expected
  142.         //    to control the lifetime of the instance of this class.
  143.         WOleGenericInterfaceFamily( WOleServerObject *serverObject );
  144.  
  145.         virtual ~WOleGenericInterfaceFamily();
  146.  
  147.     public:
  148.  
  149.         /**************************************************************
  150.          * Properties
  151.          **************************************************************/
  152.  
  153.         /**************************************************************
  154.          * Methods
  155.          **************************************************************/
  156.  
  157.         virtual WBool QueryInterface( const WCLSID & clsid, void **iface );
  158.  
  159.         // Add
  160.         WBool AddInterface( const WCLSID & wclsid, WPIUnknown pIUnknown );
  161.  
  162.     /**********************************************************
  163.      * Data Members
  164.      *********************************************************/
  165.     
  166.     protected:
  167.         wllist_header           *_interfaceList;
  168. };
  169.  
  170. #define WOleDefineInterfaceFamily( c, c_id, rdb ) \
  171.     static WOleInterfaceFamilyRegistryData _WOleIntFamRegistryData( c_id, (void*)&rdb );
  172.  
  173. #ifndef _WNO_PRAGMA_PUSH
  174. #pragma enum pop;
  175. #pragma pack(pop);
  176. #endif
  177.  
  178. #endif // _WOLEIFAM_HPP_INCLUDED
  179.  
  180.