pythoncom.gif
Previous Next blank.gif Home Page

Class MappedWrapPolicy - Wraps an object using maps to do its magic


SYNOPSIS

import win32com.server.policy
class MappedWrapPolicy(BasicWrapPolicy)
  def _getidsofnames_(self, names, lcid)
  def _wrap_(self, object)

  # Methods inherited by MappedWrapPolicy 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 _invoke_(self, dispid, lcid, wFlags, args)
  def _query_interface_(self, iid)

DESCRIPTION

This policy wraps up a Python object, using a number of maps which translate from a Dispatch ID and flags, into an object to call/getattr, etc.

It is the responsibility of derived classes to determine exactly how the maps are filled (ie, the derived classes determine the map filling policy.

This policy supports the following special attributes on the wrapped object

_dispid_to_func_/_dispid_to_get_/_dispid_to_put_
These are dictionaries (keyed by integer dispid, values are string attribute names) which the COM implementation uses when it is processing COM requests. Note that the implementation uses this dictionary for its own purposes - not a copy - which means the contents of these dictionaries will change as the object is used.

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 _invoke_(self, dispid, lcid, wFlags, args)

A stub for _invoke_ - should never be called.

Simply raises an exception.

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


Previous Next blank.gif Home Page
www_icon.gif

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