[pywin32-checkins] pywin32/com/win32com/src MiscTypes.cpp,1.4,1.5 PyIBase.cpp,1.4,1.5
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-10-31 06:55:15
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1:/tmp/cvs-serv17359 Modified Files: MiscTypes.cpp PyIBase.cpp Log Message: Add PyComEnumProviderTypeObject, for objects that can return (but not actually be) an iterator. Index: MiscTypes.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/MiscTypes.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MiscTypes.cpp 23 Oct 2003 23:42:02 -0000 1.4 --- MiscTypes.cpp 31 Oct 2003 06:55:12 -0000 1.5 *************** *** 118,121 **** --- 118,130 ---- } + // Our type for IEnum provider interfaces + PyComEnumProviderTypeObject::PyComEnumProviderTypeObject( const char *name, PyComTypeObject *pBase, int typeSize, struct PyMethodDef* methodList, PyIUnknown * (* thector)(IUnknown *)) : + PyComTypeObject( name, pBase, typeSize, methodList, thector) + { + tp_iter = PyIBase::iter; + // tp_iternext remains NULL + tp_flags |= Py_TPFLAGS_HAVE_ITER; + } + ///////////////////////////////////////////////////////////////////////////// // class PyOleEmpty Index: PyIBase.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyIBase.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyIBase.cpp 23 Oct 2003 23:42:02 -0000 1.4 --- PyIBase.cpp 31 Oct 2003 06:55:12 -0000 1.5 *************** *** 54,57 **** --- 54,65 ---- return Py_FindMethodInChain(&((PyComTypeObject *)ob_type)->chain, this, name); } + + PyObject * + PyIBase::iter() + { + return PyErr_Format(PyExc_RuntimeError, + "iter must be overridden by objects supporting enumeration (type '%s').", ob_type->tp_name); + } + PyObject * PyIBase::iternext() |