This class is just a typedef to wxRefCounter and is used by wxObject.
Derive classes from this to store your own data in wxObject-derived classes. When retrieving information from a wxObject's reference data, you will need to cast to your own derived class.
Below is an example illustrating how to store reference counted data in a class derived from wxObject including copy-on-write semantics.
Example
{
public:
bool IsOk()
const {
return m_refData !=
NULL; }
protected:
};
{
public:
{
}
{
}
{
}
private:
};
#define M_CARDATA ((MyCarRefData *)m_refData)
MyCar::MyCar(
int price )
{
}
{
}
{
}
bool MyCar::operator == (
const MyCar&
car )
const
{
if (m_refData ==
car.m_refData)
return true;
if (!m_refData || !
car.m_refData)
return false;
}
void MyCar::SetPrice(
int price )
{
UnShare();
}
int MyCar::GetPrice() const
{
}
This is the root class of many of the wxWidgets classes.
Definition object.h:233
This class is just a typedef to wxRefCounter and is used by wxObject.
#define wxCHECK_MSG(condition, retValue, message)
Checks that the condition is true, returns with the given return value if not (stops execution in deb...
Definition debug.h:165
bool wxStringCheck(const wxString &val)
Allows extending a function with the signature:
bool operator!=(const wxString &s1, const wxString &s2)
bool operator==(const wxString &s1, const wxString &s2)
Comparison operator for string types.
#define wxIMPLEMENT_DYNAMIC_CLASS(className, baseClassName)
Used in a C++ implementation file to complete the declaration of a class that has run-time type infor...
Definition object.h:763
#define wxDECLARE_DYNAMIC_CLASS(className)
Used inside a class declaration to make the class known to wxWidgets RTTI system and also declare tha...
Definition object.h:705
<>< =''>:</>&;&;< =''>\ </></>
- See also
- wxObject, wxObjectDataPtr<T>, Reference Counting