[pywin32-checkins] pywin32/com/win32com/src/extensions PyIDataObject.cpp,1.1,1.2 PySTGMEDIUM.cpp,1.1
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-10-09 12:49:43
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory sc8-pr-cvs1:/tmp/cvs-serv1085 Modified Files: PyIDataObject.cpp PySTGMEDIUM.cpp Log Message: autoduck, and PySTGMEDIUM gets a data_handle property to get the integer handle. 'CVS: ---------------------------------------------------------------------- Index: PyIDataObject.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyIDataObject.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyIDataObject.cpp 8 Oct 2003 04:28:42 -0000 1.1 --- PyIDataObject.cpp 9 Oct 2003 12:49:38 -0000 1.2 *************** *** 66,70 **** } ! // @pymethod |PyIDataObject|GetData|Description of GetData. PyObject *PyIDataObject::GetData(PyObject *self, PyObject *args) { --- 66,70 ---- } ! // @pymethod <o PySTGMEDIUM>|PyIDataObject|GetData|Description of GetData. PyObject *PyIDataObject::GetData(PyObject *self, PyObject *args) { *************** *** 93,97 **** } ! // @pymethod |PyIDataObject|GetDataHere|Description of GetDataHere. PyObject *PyIDataObject::GetDataHere(PyObject *self, PyObject *args) { --- 93,97 ---- } ! // @pymethod <o PySTGMEDIUM>|PyIDataObject|GetDataHere|Description of GetDataHere. PyObject *PyIDataObject::GetDataHere(PyObject *self, PyObject *args) { *************** *** 204,208 **** } ! // @pymethod |PyIDataObject|EnumFormatEtc|Description of EnumFormatEtc. PyObject *PyIDataObject::EnumFormatEtc(PyObject *self, PyObject *args) { --- 204,208 ---- } ! // @pymethod <o PyIEnumFORMATETC>|PyIDataObject|EnumFormatEtc|Description of EnumFormatEtc. PyObject *PyIDataObject::EnumFormatEtc(PyObject *self, PyObject *args) { *************** *** 225,229 **** } ! // @pymethod |PyIDataObject|DAdvise|Description of DAdvise. PyObject *PyIDataObject::DAdvise(PyObject *self, PyObject *args) { --- 225,229 ---- } ! // @pymethod int|PyIDataObject|DAdvise|Description of DAdvise. PyObject *PyIDataObject::DAdvise(PyObject *self, PyObject *args) { *************** *** 277,281 **** } ! // @pymethod |PyIDataObject|EnumDAdvise|Description of EnumDAdvise. PyObject *PyIDataObject::EnumDAdvise(PyObject *self, PyObject *args) { --- 277,281 ---- } ! // @pymethod <o PyIEnumSTATDATA>|PyIDataObject|EnumDAdvise|Description of EnumDAdvise. PyObject *PyIDataObject::EnumDAdvise(PyObject *self, PyObject *args) { Index: PySTGMEDIUM.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PySTGMEDIUM.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PySTGMEDIUM.cpp 8 Oct 2003 04:28:42 -0000 1.1 --- PySTGMEDIUM.cpp 9 Oct 2003 12:49:38 -0000 1.2 *************** *** 1,9 **** ! #include "stdafx.h" #include "PythonCOM.h" #include "structmember.h" #include "PyComTypeObjects.h" ! ! // @pymethod <o STGMEDIUM>|pythoncom|STGMEDIUM|Creates a new STGMEDIUM object PyObject *Py_NewSTGMEDIUM(PyObject *self, PyObject *args) { --- 1,9 ---- ! // A Python object representing a windows STGMEDIUM structure. #include "stdafx.h" #include "PythonCOM.h" #include "structmember.h" #include "PyComTypeObjects.h" ! // @doc This file contains autoduck documentation. ! // @pymethod <o PySTGMEDIUM>|pythoncom|STGMEDIUM|Creates a new STGMEDIUM object PyObject *Py_NewSTGMEDIUM(PyObject *self, PyObject *args) { *************** *** 18,25 **** --- 18,28 ---- } + // @pymethod |PySTGMEDIUM|set|Sets the type and data of the object. PyObject *PySet(PyObject *self, PyObject *args) { int tymed; PyObject *ob; + // @pyparm int|tymed||The type of the data + // @pyparm object|data|| if (!PyArg_ParseTuple(args, "iO:set", &tymed, &ob)) return NULL; *************** *** 74,78 **** } ! // @object STGMEDIUM|A STGMEDIUM object represents a COM STGMEDIUM structure. static struct PyMethodDef PySTGMEDIUM_methods[] = { {"set", PySet, 1}, // @pymeth set|Sets the type and data of the object --- 77,81 ---- } ! // @object PySTGMEDIUM|A STGMEDIUM object represents a COM STGMEDIUM structure. static struct PyMethodDef PySTGMEDIUM_methods[] = { {"set", PySet, 1}, // @pymeth set|Sets the type and data of the object *************** *** 140,153 **** --- 143,164 ---- return res; PyErr_Clear(); + // @prop int|tymed|An integer indicating the type of data in the stgmedium if (strcmp(name, "tymed")==0) return PyInt_FromLong(ps->medium.tymed); + // @prop object|data|The data in the stgmedium. + // The result depends on the value of the 'tymed' property of the <o PySTGMEDIUM> object. + // @flagh tymed|Result Type if (strcmp(name, "data")==0) { switch (ps->medium.tymed) { + // @flag TYMED_GDI|An integer GDI handle case TYMED_GDI: return PyLong_FromVoidPtr(ps->medium.hBitmap); + // @flag TYMED_MFPICT|An integer METAFILE handle case TYMED_MFPICT: return PyLong_FromVoidPtr(ps->medium.hMetaFilePict); + // @flag TYMED_ENHMF|An integer ENHMETAFILE handle case TYMED_ENHMF: return PyLong_FromVoidPtr(ps->medium.hEnhMetaFile); + // @flag TYMED_HGLOBAL|A string with the bytes of the global memory object. case TYMED_HGLOBAL: { PyObject *ret; *************** *** 162,171 **** --- 173,214 ---- return ret; } + // @flag TYMED_FILE|A string/unicode filename case TYMED_FILE: return PyWinObject_FromWCHAR(ps->medium.lpszFileName); + // @flag TYMED_ISTREAM|A <o PyIStream> object case TYMED_ISTREAM: + // @flag TYMED_ISTORAGE|A <o PyIStorage> object return PyCom_PyObjectFromIUnknown(ps->medium.pstm, IID_IStream, TRUE); case TYMED_ISTORAGE: return PyCom_PyObjectFromIUnknown(ps->medium.pstg, IID_IStorage, TRUE); + case TYMED_NULL: + PyErr_SetString(PyExc_ValueError, "This STGMEDIUM has no data"); + return NULL; + default: + PyErr_SetString(PyExc_RuntimeError, "Unknown tymed"); + return NULL; + } + } + // @prop int|data_handle|The raw 'integer' representation of the data. + // For TYMED_HGLOBAL, this is the handle rather than the string data. + // For the string and interface types, this is an integer holding the pointer. + if (strcmp(name, "data_handle")==0) { + switch (ps->medium.tymed) { + case TYMED_GDI: + return PyLong_FromVoidPtr(ps->medium.hBitmap); + case TYMED_MFPICT: + return PyLong_FromVoidPtr(ps->medium.hMetaFilePict); + case TYMED_ENHMF: + return PyLong_FromVoidPtr(ps->medium.hEnhMetaFile); + case TYMED_HGLOBAL: + return PyLong_FromVoidPtr(ps->medium.hGlobal); + // and may as well hand out the pointers for these. + // We are all consenting adults :) + case TYMED_FILE: + return PyLong_FromVoidPtr(ps->medium.lpszFileName); + case TYMED_ISTREAM: + return PyLong_FromVoidPtr(ps->medium.pstm); + case TYMED_ISTORAGE: + return PyLong_FromVoidPtr(ps->medium.pstg); case TYMED_NULL: PyErr_SetString(PyExc_ValueError, "This STGMEDIUM has no data"); |