[pywin32-checkins] pywin32/com/win32com/src/include PythonCOM.h,1.16,1.17
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-11-02 09:55:30
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv3446/include Modified Files: PythonCOM.h Log Message: Fix iterators yet again. Drop the PyIEnum classes, and keep all the functionality in the new types. This means we can still be an enumerator even if we dont derive directly from PyIUnknown (eg, IMoniker) Index: PythonCOM.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PythonCOM.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PythonCOM.h 2 Nov 2003 05:26:13 -0000 1.16 --- PythonCOM.h 2 Nov 2003 09:55:27 -0000 1.17 *************** *** 165,168 **** --- 165,169 ---- PyIUnknown* (* thector)(IUnknown *), const char *enum_method_name); + static PyObject *iter(PyObject *self); const char *enum_method_name; }; *************** *** 171,174 **** --- 172,177 ---- class PYCOM_EXPORT PyComEnumTypeObject : public PyComTypeObject { public: + static PyObject *iter(PyObject *self); + static PyObject *iternext(PyObject *self); PyComEnumTypeObject( const char *name, PyComTypeObject *pBaseType, int typeSize, struct PyMethodDef* methodList, PyIUnknown* (* thector)(IUnknown *) ); }; *************** *** 185,188 **** --- 188,195 ---- virtual PyObject *repr(); virtual int compare(PyObject *other) {return (int)this-int(other);} + // These iter are a little special, in that returning NULL means + // use the implementation in the type + virtual PyObject *iter() {return NULL;} + virtual PyObject *iternext() {return NULL;} static struct PyMethodDef PyIBase::empty_methods[]; protected: *************** *** 413,442 **** PyIUnknown(IUnknown *punk); ~PyIUnknown(); - }; - - ///////////////////////////////////////////////////////////////////////////// - // 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();} }; --- 420,423 ---- |