Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src
In directory sc8-pr-cvs1:/tmp/cvs-serv17780
Modified Files:
PyIEnumIDList.cpp PyIEnumIDList.h PyIShellFolder.cpp
PyIShellFolder.h
Log Message:
Allow PyIShellFolder to automatically provide EnumObject() as an
iterator.
Index: PyIEnumIDList.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIEnumIDList.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PyIEnumIDList.cpp 23 Oct 2003 23:44:41 -0000 1.2
--- PyIEnumIDList.cpp 31 Oct 2003 06:58:13 -0000 1.3
***************
*** 26,29 ****
--- 26,36 ----
PyObject *
+ PyIEnumIDList::iter()
+ {
+ Py_INCREF(this);
+ return this;
+ }
+
+ PyObject *
PyIEnumIDList::iternext()
{
Index: PyIEnumIDList.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIEnumIDList.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PyIEnumIDList.h 23 Oct 2003 23:44:41 -0000 1.2
--- PyIEnumIDList.h 31 Oct 2003 06:58:13 -0000 1.3
***************
*** 12,15 ****
--- 12,16 ----
static PyComEnumTypeObject type;
+ virtual PyObject *iter();
virtual PyObject *iternext();
Index: PyIShellFolder.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellFolder.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIShellFolder.cpp 6 Oct 2003 12:47:57 -0000 1.1
--- PyIShellFolder.cpp 31 Oct 2003 06:58:13 -0000 1.2
***************
*** 25,28 ****
--- 25,46 ----
}
+ // @pymethod |PyIShellFolder|__iter__|Enumerates all objects in this folder.
+ // @comm Calls EnumObjects(SHCONTF_FOLDERS\|SHCONTF_NONFOLDERS\|SHCONTF_INCLUDEHIDDEN),
+ // returning PIDL objects.
+ PyObject *
+ PyIShellFolder::iter()
+ {
+ IShellFolder *pISF = GetI(this);
+ DWORD flags = SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN;
+ IEnumIDList * ppeidl;
+ HRESULT hr;
+ PY_INTERFACE_PRECALL;
+ hr = pISF->EnumObjects( 0, flags, &ppeidl );
+ PY_INTERFACE_POSTCALL;
+ if ( FAILED(hr) )
+ return PyCom_BuildPyException(hr, pISF, IID_IShellFolder );
+ return PyCom_PyObjectFromIUnknown(ppeidl, IID_IEnumIDList, FALSE);
+ }
+
// @pymethod |PyIShellFolder|ParseDisplayName|Description of ParseDisplayName.
PyObject *PyIShellFolder::ParseDisplayName(PyObject *self, PyObject *args)
***************
*** 393,397 ****
};
! PyComTypeObject PyIShellFolder::type("PyIShellFolder",
&PyIUnknown::type,
sizeof(PyIShellFolder),
--- 411,416 ----
};
! // @pymeth __iter__|Enumerates all objects in this folder.
! PyComEnumProviderTypeObject PyIShellFolder::type("PyIShellFolder",
&PyIUnknown::type,
sizeof(PyIShellFolder),
Index: PyIShellFolder.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellFolder.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIShellFolder.h 6 Oct 2003 12:47:57 -0000 1.1
--- PyIShellFolder.h 31 Oct 2003 06:58:13 -0000 1.2
***************
*** 10,14 ****
MAKE_PYCOM_CTOR(PyIShellFolder);
static IShellFolder *GetI(PyObject *self);
! static PyComTypeObject type;
// The Python methods
--- 10,16 ----
MAKE_PYCOM_CTOR(PyIShellFolder);
static IShellFolder *GetI(PyObject *self);
! static PyComEnumProviderTypeObject type;
!
! virtual PyObject *iter();
// The Python methods
|