### Class DesignatedWrapPolicy - A policy which uses a mapping to link functions and dispid

## SYNOPSIS

    import win32com.server.policy

    class DesignatedWrapPolicy(MappedWrapPolicy)
      def _invoke_(self, dispid, lcid, wFlags, args)
      def _wrap_(self, ob)

      # Methods inherited by DesignatedWrapPolicy from MappedWrapPolicy
      def _getidsofnames_(self, names, lcid)

      # Methods inherited by DesignatedWrapPolicy from BasicWrapPolicy
      def _CreateInstance_(self, clsid, reqIID)
      def _GetIDsOfNames_(self, names, lcid)
      def _Invoke_(self, dispid, lcid, wFlags, args)
      def _QueryInterface_(self, iid)
      def __init__(self, object)
      def _query_interface_(self, iid)

    alias DefaultPolicy = DesignatedWrapPolicy

## DESCRIPTION

A MappedWrappedPolicy which allows the wrapped object to specify, via certain special named attributes, exactly which methods and properties are exposed.

All a wrapped object need do is provide the special attributes, and the policy will handle everything else.

Attributes:

_public_methods_ -- Required
  A list of strings, which must be the names of methods the object provides. These methods will be exposed and callable from other COM hosts. _public_attrs_ A list of strings, which must be the names of attributes on the object. These attributes will be exposed and readable and possibly writeable from other COM hosts.
_readonly_attrs_
  A list of strings, which must also appear in _public_attrs. These attributes will be readable, but not writable, by other COM hosts.
_value_
  A method that will be called if the COM host requests the "default" method (ie, calls Invoke with dispid==DISPID_VALUE)
_NewEnum
  A method that will be called if the COM host requests an enumerator on the object (ie, calls Invoke with dispid==DISPID_NEWENUM.) It is the responsibility of the method to ensure the returned object conforms to the required Enum interface.
_Evaluate
  Dunno what this means, except the host has called Invoke with dispid==DISPID_EVALUATE! See the COM documentation for details.

### def _CreateInstance_(self, clsid, reqIID)

Creates a new instance of a wrapped object

This method looks up a "win32com.server.policy.regSpec" % clsid entry in the registry (using DefaultPolicy)

### def _GetIDsOfNames_(self, names, lcid)

The main COM entry-point for GetIDsOfNames.

This checks the validity of the arguments, and calls the _getidsofnames_ helper.

### def _Invoke_(self, dispid, lcid, wFlags, args)

The main COM entry-point for Invoke.

This calls the _invoke_ helper.

### def _QueryInterface_(self, iid)

The main COM entry-point for QueryInterface.

This checks the _com_interfaces_ attribute and if the interface is not specified there, it calls the derived helper _query_interface_

### def __init__(self, object)

Initialise the policy object

Params:

object
  The object to wrap. May be None iff BasicWrapPolicy._CreateInstance_ will be called immediately after this to setup a brand new object

### def _query_interface_(self, iid)

Called if the object does not provide the requested interface in _com_interfaces, and does not provide a _query_interface_ handler.

Returns a result to the COM framework indicating the interface is not supported.

## SEE ALSO

win32com.server.policy

win32com.server.policy

Copyright © Greg Stein and Mark Hammond
All Rights Reserved
Comments to author: dev@null
Generated: Sun Apr 20 1997