Update of /cvsroot/pywin32/pywin32/com/win32com/src/include
In directory sc8-pr-cvs1:/tmp/cvs-serv5588/include
Modified Files:
PyIEnumConnectionPoints.h PyIEnumConnections.h
PyIEnumFORMATETC.h PyIEnumGUID.h PyIEnumSTATPROPSETSTG.h
PyIEnumSTATPROPSTG.h PyIEnumSTATSTG.h PyIEnumVARIANT.h
PyIPropertySetStorage.h PyIPropertyStorage.h PythonCOM.h
Log Message:
Roger inspired me to do tp_iter support in a far more generic way.
Should be possible to make all Enums and Providers support tp_iter()
simply by declaring the correct type - no implementation of the
iter()/iternext() should be necessary.
All enums in the core package should now support Enums correctly
(a few more could possibly be nominated as Enum providers though.
Index: PyIEnumConnectionPoints.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyIEnumConnectionPoints.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIEnumConnectionPoints.h 24 Nov 1999 10:04:11 -0000 1.1
--- PyIEnumConnectionPoints.h 2 Nov 2003 05:26:13 -0000 1.2
***************
*** 5,14 ****
// Interface Declaration
! class PyIEnumConnectionPoints : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIEnumConnectionPoints);
static IEnumConnectionPoints *GetI(PyObject *self);
! static PyComTypeObject type;
// The Python methods
--- 5,14 ----
// Interface Declaration
! class PyIEnumConnectionPoints : public PyIEnum
{
public:
MAKE_PYCOM_CTOR(PyIEnumConnectionPoints);
static IEnumConnectionPoints *GetI(PyObject *self);
! static PyComEnumTypeObject type;
// The Python methods
Index: PyIEnumConnections.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyIEnumConnections.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIEnumConnections.h 1 Sep 1999 23:04:13 -0000 1.1
--- PyIEnumConnections.h 2 Nov 2003 05:26:13 -0000 1.2
***************
*** 5,14 ****
// Interface Declaration
! class PyIEnumConnections : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIEnumConnections);
static IEnumConnections *GetI(PyObject *self);
! static PyComTypeObject type;
// The Python methods
--- 5,14 ----
// Interface Declaration
! class PyIEnumConnections : public PyIEnum
{
public:
MAKE_PYCOM_CTOR(PyIEnumConnections);
static IEnumConnections *GetI(PyObject *self);
! static PyComEnumTypeObject type;
// The Python methods
Index: PyIEnumFORMATETC.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyIEnumFORMATETC.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** PyIEnumFORMATETC.h 31 Oct 2003 06:55:13 -0000 1.4
--- PyIEnumFORMATETC.h 2 Nov 2003 05:26:13 -0000 1.5
***************
*** 5,9 ****
// Interface Declaration
! class PyIEnumFORMATETC : public PyIUnknown
{
public:
--- 5,9 ----
// Interface Declaration
! class PyIEnumFORMATETC : public PyIEnum
{
public:
***************
*** 11,17 ****
static IEnumFORMATETC *GetI(PyObject *self);
static PyComEnumTypeObject type;
-
- virtual PyObject *iter();
- virtual PyObject *iternext();
// The Python methods
--- 11,14 ----
Index: PyIEnumGUID.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyIEnumGUID.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIEnumGUID.h 1 Sep 1999 23:04:13 -0000 1.1
--- PyIEnumGUID.h 2 Nov 2003 05:26:13 -0000 1.2
***************
*** 2,10 ****
// class PyIEnumGUID
#ifndef NO_PYCOM_IENUMGUID
! class PyIEnumGUID : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIEnumGUID);
! static PyComTypeObject type;
static IEnumGUID *GetI(PyObject *self);
--- 2,10 ----
// class PyIEnumGUID
#ifndef NO_PYCOM_IENUMGUID
! class PyIEnumGUID : public PyIEnum
{
public:
MAKE_PYCOM_CTOR(PyIEnumGUID);
! static PyComEnumTypeObject type;
static IEnumGUID *GetI(PyObject *self);
***************
*** 23,31 ****
// class PyIEnumCATEGORYINFO
#ifndef NO_PYCOM_IENUMCATEGORYINFO
! class PyIEnumCATEGORYINFO : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIEnumCATEGORYINFO);
! static PyComTypeObject type;
static IEnumCATEGORYINFO *GetI(PyObject *self);
--- 23,31 ----
// class PyIEnumCATEGORYINFO
#ifndef NO_PYCOM_IENUMCATEGORYINFO
! class PyIEnumCATEGORYINFO : public PyIEnum
{
public:
MAKE_PYCOM_CTOR(PyIEnumCATEGORYINFO);
! static PyComEnumTypeObject type;
static IEnumCATEGORYINFO *GetI(PyObject *self);
Index: PyIEnumSTATPROPSETSTG.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyIEnumSTATPROPSETSTG.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIEnumSTATPROPSETSTG.h 30 Oct 2003 06:30:38 -0000 1.1
--- PyIEnumSTATPROPSETSTG.h 2 Nov 2003 05:26:13 -0000 1.2
***************
*** 2,12 ****
! class PyIEnumSTATPROPSETSTG : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIEnumSTATPROPSETSTG);
static IEnumSTATPROPSETSTG *GetI(PyObject *self);
! static PyComTypeObject type;
!
// The Python methods
static PyObject *Next(PyObject *self, PyObject *args);
--- 2,11 ----
! class PyIEnumSTATPROPSETSTG : public PyIEnum
{
public:
MAKE_PYCOM_CTOR(PyIEnumSTATPROPSETSTG);
static IEnumSTATPROPSETSTG *GetI(PyObject *self);
! static PyComEnumTypeObject type;
// The Python methods
static PyObject *Next(PyObject *self, PyObject *args);
Index: PyIEnumSTATPROPSTG.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyIEnumSTATPROPSTG.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIEnumSTATPROPSTG.h 1 Sep 1999 23:04:13 -0000 1.1
--- PyIEnumSTATPROPSTG.h 2 Nov 2003 05:26:13 -0000 1.2
***************
*** 5,14 ****
// Interface Declaration
! class PyIEnumSTATPROPSTG : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIEnumSTATPROPSTG);
static IEnumSTATPROPSTG *GetI(PyObject *self);
! static PyComTypeObject type;
// The Python methods
--- 5,14 ----
// Interface Declaration
! class PyIEnumSTATPROPSTG : public PyIEnum
{
public:
MAKE_PYCOM_CTOR(PyIEnumSTATPROPSTG);
static IEnumSTATPROPSTG *GetI(PyObject *self);
! static PyComEnumTypeObject type;
// The Python methods
Index: PyIEnumSTATSTG.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyIEnumSTATSTG.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIEnumSTATSTG.h 1 Sep 1999 23:04:13 -0000 1.1
--- PyIEnumSTATSTG.h 2 Nov 2003 05:26:13 -0000 1.2
***************
*** 5,14 ****
// Interface Declaration
! class PyIEnumSTATSTG : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIEnumSTATSTG);
static IEnumSTATSTG *GetI(PyObject *self);
! static PyComTypeObject type;
// The Python methods
--- 5,14 ----
// Interface Declaration
! class PyIEnumSTATSTG : public PyIEnum
{
public:
MAKE_PYCOM_CTOR(PyIEnumSTATSTG);
static IEnumSTATSTG *GetI(PyObject *self);
! static PyComEnumTypeObject type;
// The Python methods
Index: PyIEnumVARIANT.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyIEnumVARIANT.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PyIEnumVARIANT.h 31 Oct 2003 06:55:13 -0000 1.5
--- PyIEnumVARIANT.h 2 Nov 2003 05:26:13 -0000 1.6
***************
*** 5,9 ****
#include "PythonCOMServer.h"
! class PYCOM_EXPORT PyIEnumVARIANT : public PyIUnknown
{
public:
--- 5,9 ----
#include "PythonCOMServer.h"
! class PYCOM_EXPORT PyIEnumVARIANT : public PyIEnum
{
public:
***************
*** 11,17 ****
static IEnumVARIANT *GetI(PyObject *self);
static PyComEnumTypeObject type;
-
- virtual PyObject *iter();
- virtual PyObject *iternext();
// The Python methods
--- 11,14 ----
Index: PyIPropertySetStorage.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyIPropertySetStorage.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIPropertySetStorage.h 1 Sep 1999 23:04:14 -0000 1.1
--- PyIPropertySetStorage.h 2 Nov 2003 05:26:13 -0000 1.2
***************
*** 5,14 ****
// Interface Declaration
! class PyIPropertySetStorage : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIPropertySetStorage);
static IPropertySetStorage *GetI(PyObject *self);
! static PyComTypeObject type;
// The Python methods
--- 5,14 ----
// Interface Declaration
! class PyIPropertySetStorage : public PyIEnumProvider
{
public:
MAKE_PYCOM_CTOR(PyIPropertySetStorage);
static IPropertySetStorage *GetI(PyObject *self);
! static PyComEnumProviderTypeObject type;
// The Python methods
***************
*** 17,21 ****
static PyObject *Delete(PyObject *self, PyObject *args);
static PyObject *Enum(PyObject *self, PyObject *args);
-
protected:
PyIPropertySetStorage(IUnknown *pdisp);
--- 17,20 ----
Index: PyIPropertyStorage.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyIPropertyStorage.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIPropertyStorage.h 1 Sep 1999 23:04:14 -0000 1.1
--- PyIPropertyStorage.h 2 Nov 2003 05:26:13 -0000 1.2
***************
*** 5,14 ****
// Interface Declaration
! class PyIPropertyStorage : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIPropertyStorage);
static IPropertyStorage *GetI(PyObject *self);
! static PyComTypeObject type;
// The Python methods
--- 5,14 ----
// Interface Declaration
! class PyIPropertyStorage : public PyIEnumProvider
{
public:
MAKE_PYCOM_CTOR(PyIPropertyStorage);
static IPropertyStorage *GetI(PyObject *self);
! static PyComEnumProviderTypeObject type;
// The Python methods
Index: PythonCOM.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PythonCOM.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** PythonCOM.h 31 Oct 2003 11:42:03 -0000 1.15
--- PythonCOM.h 2 Nov 2003 05:26:13 -0000 1.16
***************
*** 159,163 ****
class PYCOM_EXPORT PyComEnumProviderTypeObject : public PyComTypeObject {
public:
! PyComEnumProviderTypeObject( const char *name, PyComTypeObject *pBaseType, int typeSize, struct PyMethodDef* methodList, PyIUnknown* (* thector)(IUnknown *) );
};
--- 159,169 ----
class PYCOM_EXPORT PyComEnumProviderTypeObject : public PyComTypeObject {
public:
! PyComEnumProviderTypeObject( const char *name,
! PyComTypeObject *pBaseType,
! int typeSize,
! struct PyMethodDef* methodList,
! PyIUnknown* (* thector)(IUnknown *),
! const char *enum_method_name);
! const char *enum_method_name;
};
***************
*** 179,185 ****
virtual PyObject *repr();
virtual int compare(PyObject *other) {return (int)this-int(other);}
- virtual PyObject *iter();
- virtual PyObject *iternext();
-
static struct PyMethodDef PyIBase::empty_methods[];
protected:
--- 185,188 ----
***************
*** 195,200 ****
static int setattr(PyObject *op, char *name, PyObject *v);
static int cmp(PyObject *ob1, PyObject *ob2);
- static PyObject *iter(PyObject *self);
- static PyObject *iternext(PyObject *self);
};
--- 198,201 ----
***************
*** 414,417 ****
--- 415,443 ----
};
+ /////////////////////////////////////////////////////////////////////////////
+ // class PyIEnum - base for all Python interfaces implement IEnum*
+ class PYCOM_EXPORT PyIEnum : public PyIUnknown
+ {
+ protected:
+ PyIEnum(IUnknown *punk) : PyIUnknown(punk) {;}
+ public:
+ virtual PyObject *iter();
+ virtual PyObject *iternext();
+ static PyObject *iter(PyObject *self) {return ((PyIEnum *)self)->iter();}
+ static PyObject *iternext(PyObject *self) {return ((PyIEnum *)self)->iternext();}
+
+ };
+
+ /////////////////////////////////////////////////////////////////////////////
+ // class PyIEnum - base for all Python interfaces that can provide an
+ // IEnum* via a method
+ class PYCOM_EXPORT PyIEnumProvider : public PyIUnknown
+ {
+ protected:
+ PyIEnumProvider(IUnknown *punk) : PyIUnknown(punk) {;}
+ public:
+ virtual PyObject *iter();
+ static PyObject *iter(PyObject *self) {return ((PyIEnumProvider *)self)->iter();}
+ };
/////////////////////////////////////////////////////////////////////////////
|