void ui_assoc_CObject::Dump( CDumpContext &dc ) const { // skip over ui_assoc, as we print the assoc in a much better format! ui_base_class::Dump(dc); #if !defined(_MAC) && !defined(_AFX_PORTABLE) // use SEH (structured exception handling) to catch even GPFs // that result from partially valid objects. try #endif { CObject *pOb = (CObject *)GetGoodCppObject(NULL); dc << ", CObject is "; if (pOb) { if (AfxIsValidAddress(pOb, sizeof(CObject))) pOb->Dump(dc); else afxDump << "<at invalid address!>"; } else dc << "<NULL>"; } #if !defined(_MAC) && !defined(_AFX_PORTABLE) catch(int code) { // short form for trashed objects afxDump << "<Bad! (" << code << ")>"; } catch(...) { // short form for trashed objects afxDump << "<Bad!>"; } #endif }
void *ui_assoc_object::GetGoodCppObject(ui_type *ui_type_check) const { // Get a checked association. PyObject *temp = (PyObject *)this; void *ret = GetGoodCppObject(temp, ui_type_check); ASSERT(this==(ui_assoc_object *)temp); // Called with this->, and this needs to be changed! return ret; }
ui_assoc_CObject::~ui_assoc_CObject() { if (bManualDelete) { bManualDelete = FALSE; CObject *pO = (CObject *)GetGoodCppObject(&type); // get pointer before killing it. ASSERT(!PyErr_Occurred()); // PyErr_Clear() is bogus????? if (!pO) PyErr_Clear(); else delete pO; } }
CDialogBar *PyCDialogBar::GetDialogBar (PyObject *self) { return (CDialogBar *)GetGoodCppObject( self, &type); }
// this returns a pointer that should not be stored. // Helper function that returns a CRgn object given a Python object // Return Values: a CRgn object CRgn *PyCRgn::GetRgn(PyObject *self) { return (CRgn *)GetGoodCppObject( self, &type); }
CImageList *PyCImageList::GetImageList(PyObject *self) { return (CImageList *)GetGoodCppObject(self, &type); }
/*static*/CDocument *PyCDocument::GetDoc(PyObject *self) { return (CDocument *)GetGoodCppObject( self, &type); }
// this returns a pointer that should not be stored. HMENU PyCMenu::GetMenu(PyObject *self) { return (HMENU)GetGoodCppObject( self, &type); }