home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / WOLEIFAM.HPP < prev    next >
C/C++ Source or Header  |  1997-01-14  |  6KB  |  179 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 * );
  51.         virtual WBool Unregister( WApplication * );
  52.  
  53.         WCLSID                                  _classID;
  54.         WOleInterfaceFamilyRegistryData        *next;
  55.  
  56.     private:
  57.         void                                   *_registryDataBlock;
  58. };
  59.  
  60. // the following is definitions of WOleInterfaceFamily
  61.  
  62. class WCMCLASS WOleInterfaceFamily : public WEventGenerator {
  63.     WDeclareSubclass( WOleInterfaceFamily, WEventGenerator );
  64.  
  65.     public:
  66.  
  67.         /**********************************************************
  68.          * Constructors and Destructors
  69.          *********************************************************/
  70.  
  71.         // Aggregating IUnknown ( unkOuter )
  72.         //    This class will NOT call AddRef through the IUnknown
  73.         //    pointer nor will it call Release in its destructor.
  74.         //    This is to avoid circular reference counts as
  75.         //    The implementor on the aggregating IUnknown is expected
  76.         //    to control the lifetime of the instance of this class.
  77.         WOleInterfaceFamily( WOleServerObject *serverObject );
  78.  
  79.         virtual ~WOleInterfaceFamily();
  80.  
  81.     public:
  82.  
  83.         /**************************************************************
  84.          * Properties
  85.          **************************************************************/
  86.  
  87.         /**************************************************************
  88.          * Static Methods
  89.          **************************************************************/
  90.  
  91.         // Self Registration
  92.         static WBool Register( WApplication *application );
  93.         static WBool Unregister( WApplication *application );
  94.  
  95.         /**************************************************************
  96.          * Methods
  97.          **************************************************************/
  98.  
  99.         // Query Interface
  100.         //    The object that owns the aggregating IUnknown pointer
  101.         //    ( usually a WOleServerObject ) will call this method
  102.         //    to retrieve pointers to interface implementations.
  103.         //    NOTE: DO NOT AddRef the returned "iface" this is done by the
  104.         //          server object
  105.         virtual WBool QueryInterface( const WCLSID & clsid, void **iface );
  106.  
  107.     /**********************************************************
  108.      * Data Members
  109.      *********************************************************/
  110.     
  111.     protected:
  112.         WOleServerObject                *_serverObject;
  113.         WPIUnknown                      _unkOuter;
  114.  
  115. };
  116.  
  117. /*************************************************************************
  118.  *
  119.  * WOleGenericInterfaceFamily -- Generic Ole Interface Family class
  120.  *
  121.  *
  122.  *   Events:
  123.  *
  124.  *
  125.  *************************************************************************/
  126.  
  127. class WCMCLASS WOleGenericInterfaceFamily : public WOleInterfaceFamily {
  128.     WDeclareSubclass( WOleGenericInterfaceFamily, WOleInterfaceFamily );
  129.  
  130.     public:
  131.  
  132.         /**********************************************************
  133.          * Constructors and Destructors
  134.          *********************************************************/
  135.  
  136.         // Aggregating IUnknown ( unkOuter )
  137.         //    This class will NOT call AddRef through the IUnknown
  138.         //    pointer nor will it call Release in its destructor.
  139.         //    This is to avoid circular reference counts as
  140.         //    The implementor on the aggregating IUnknown is expected
  141.         //    to control the lifetime of the instance of this class.
  142.         WOleGenericInterfaceFamily( WOleServerObject *serverObject );
  143.  
  144.         virtual ~WOleGenericInterfaceFamily();
  145.  
  146.     public:
  147.  
  148.         /**************************************************************
  149.          * Properties
  150.          **************************************************************/
  151.  
  152.         /**************************************************************
  153.          * Methods
  154.          **************************************************************/
  155.  
  156.         virtual WBool QueryInterface( const WCLSID & clsid, void **iface );
  157.  
  158.         // Add
  159.         WBool AddInterface( const WCLSID & wclsid, WPIUnknown pIUnknown );
  160.  
  161.     /**********************************************************
  162.      * Data Members
  163.      *********************************************************/
  164.     
  165.     protected:
  166.         wllist_header           *_interfaceList;
  167. };
  168.  
  169. #define WOleDefineInterfaceFamily( c, c_id, rdb ) \
  170.     static WOleInterfaceFamilyRegistryData _WOleIntFamRegistryData( c_id, (void*)&rdb );
  171.  
  172. #ifndef _WNO_PRAGMA_PUSH
  173. #pragma enum pop;
  174. #pragma pack(pop);
  175. #endif
  176.  
  177. #endif // _WOLEIFAM_HPP_INCLUDED
  178.  
  179.