wxobjectthis is the root class of all wxwidgets classes. it declares a virtual destructor which ensures that destructors get called for all derived class objects where necessary. wxobject is the hub of a dynamic object creation scheme, enabling a program to create instances of a class only knowing its string class name, and to query the class hierarchy. the class contains optional debugging versions of new and delete, which can help trace memory allocation and deallocation problems. wxobject can be used to implement reference counted objects, such as wxpen, wxbitmap and others (see this list). see also wxclassinfo, debugging overview, wxobjectrefdata members
wxobject::wxobject
wxobject::wxobjectwxobject() wxobject(const wxobject& other) default and copy constructors.
wxobject::~wxobjectwxobject() destructor. performs dereferencing, for those objects that use reference counting.
wxobject::m_refdatawxobjectrefdata* m_refdata pointer to an object which is the object's reference-counted data. see also wxobject::ref, wxobject::unref, wxobject::setrefdata, wxobject::getrefdata, wxobjectrefdata
wxobject::dumpvoid dump(ostream& stream) a virtual function that may be redefined by derived classes to allow dumping of memory states. this function is only defined in debug build and doesn't exist at all if __wxdebug__ is not defined. parameters stream
remarks currently wxwidgets does not define dump for derived classes, but programmers may wish to use it for their own applications. be sure to call the dump member of the class's base class to allow all information to be dumped. the implementation of this function in wxobject just writes the class name of the object.
wxobject::getclassinfowxclassinfo * getclassinfo() this virtual function is redefined for every class that requires run-time type information, when using declare_class macros.
wxobject::getrefdatawxobjectrefdata* getrefdata() const returns the m_refdata pointer. see also wxobject::ref, wxobject::unref, wxobject::m_refdata, wxobject::setrefdata, wxobjectrefdata
wxobject::iskindofbool iskindof(wxclassinfo *info) determines whether this class is a subclass of (or the same class as) the given class. parameters info
return value true if the class represented by info is the same class as this one or is derived from it. example
bool tmp = obj->iskindof(classinfo(wxframe)); wxobject::issameasbool issameas(const wxobject& obj) returns true if this object has the same data pointer as obj. notice that true is returned if the data pointers are null in both objects. this function only does a shallow comparison, i.e. it doesn't compare the objects pointed to by the data pointers of these objects.
wxobject::refvoid ref(const wxobject& clone) makes this object refer to the data in clone. parameters clone
remarks first this function calls wxobject::unref on itself to decrement (and perhaps free) the data it is currently referring to. it then sets its own m_refdata to point to that of clone, and increments the reference count inside the data. see also wxobject::unref, wxobject::m_refdata, wxobject::setrefdata, wxobject::getrefdata, wxobjectrefdata
wxobject::setrefdatavoid setrefdata(wxobjectrefdata* data) sets the m_refdata pointer. see also wxobject::ref, wxobject::unref, wxobject::m_refdata, wxobject::getrefdata, wxobjectrefdata
wxobject::unrefvoid unref() decrements the reference count in the associated data, and if it is zero, deletes the data. the m_refdata member is set to null. see also wxobject::ref, wxobject::m_refdata, wxobject::setrefdata, wxobject::getrefdata, wxobjectrefdata
wxobject::unsharevoid unshare() ensure that this object's data is not shared with any other object. if we have no data, it is created using createrefdata() below, if we have shared data it is copied using clonerefdata(), otherwise nothing is done.
wxobject::operator newvoid * new(size_t size, const wxstring& filename = null, int linenum = 0) the new operator is defined for debugging versions of the library only, when the identifier __wxdebug__ is defined. it takes over memory allocation, allowing wxdebugcontext operations.
wxobject::operator deletevoid delete(void buf) the delete operator is defined for debugging versions of the library only, when the identifier __wxdebug__ is defined. it takes over memory deallocation, allowing wxdebugcontext operations.
|