Correct typo in wxRefCounter description.

Closes #11047.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-07-30 13:14:25 +00:00
parent f380e251aa
commit 63ff0fefcf

View File

@@ -10,10 +10,10 @@
This class is just a typedef to wxRefCounter and is used by wxObject. 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 Derive classes from this to store your own data in wxObject derived
classes. When retrieving information from a wxObject's reference data, classes. When retrieving information from a wxObject's reference data,
you will need to cast to your own derived class. you will need to cast to your own derived class.
Below is an example illustrating how to store reference counted Below is an example illustrating how to store reference counted
data in a class derived from wxObject including copy-on-write data in a class derived from wxObject including copy-on-write
semantics. semantics.
@@ -91,7 +91,7 @@
m_refData = new MyCarRefData(); m_refData = new MyCarRefData();
M_CARDATA->m_price = price; M_CARDATA->m_price = price;
} }
wxObjectRefData *MyCar::CreateRefData() const wxObjectRefData *MyCar::CreateRefData() const
{ {
return new MyCarRefData; return new MyCarRefData;
@@ -106,7 +106,7 @@
{ {
if (m_refData == car.m_refData) if (m_refData == car.m_refData)
return true; return true;
if (!m_refData || !car.m_refData) if (!m_refData || !car.m_refData)
return false; return false;
// here we use the MyCarRefData::operator==() function. // here we use the MyCarRefData::operator==() function.
@@ -135,7 +135,7 @@
} }
@endcode @endcode
@library{wxbase} @library{wxbase}
@category{rtti} @category{rtti}
@@ -151,9 +151,9 @@ typedef wxRefCounter wxObjectRefData;
interface and a counter. wxRefCounter can be easily used together interface and a counter. wxRefCounter can be easily used together
with wxObjectDataPtr<T> to ensure that no calls to wxRefCounter::DecRef() with wxObjectDataPtr<T> to ensure that no calls to wxRefCounter::DecRef()
are missed - thus avoiding memory leaks. are missed - thus avoiding memory leaks.
wxObjectRefData is a typedef to wxRefCounter and is used as the wxObjectRefData is a typedef to wxRefCounter and is used as the
built-in reference counted storage for wxObject derive classes. built-in reference counted storage for wxObject-derived classes.
@library{wxbase} @library{wxbase}
@category{rtti} @category{rtti}
@@ -227,7 +227,7 @@ public:
@library{wxbase} @library{wxbase}
@category{rtti} @category{rtti}
@see wxClassInfo, @ref overview_debugging, @ref overview_refcount, @see wxClassInfo, @ref overview_debugging, @ref overview_refcount,
wxObjectDataRef, wxObjectDataPtr<T> wxObjectDataRef, wxObjectDataPtr<T>
*/ */
class wxObject class wxObject
@@ -357,10 +357,10 @@ protected:
Ensure that this object's data is not shared with any other object. Ensure that this object's data is not shared with any other object.
If we have no data, it is created using CreateRefData(); If we have no data, it is created using CreateRefData();
if we have shared data (i.e. data with a reference count greater than 1), if we have shared data (i.e. data with a reference count greater than 1),
it is copied using CloneRefData(); otherwise nothing is done (the data it is copied using CloneRefData(); otherwise nothing is done (the data
is already present and is not shared by other object instances). is already present and is not shared by other object instances).
If you use this function you should make sure that you override the If you use this function you should make sure that you override the
CreateRefData() and CloneRefData() functions in your class otherwise CreateRefData() and CloneRefData() functions in your class otherwise
an assertion will fail at runtime. an assertion will fail at runtime.
@@ -370,7 +370,7 @@ protected:
/** /**
Creates a new instance of the wxObjectRefData-derived class specific to Creates a new instance of the wxObjectRefData-derived class specific to
this object and returns it. this object and returns it.
This is usually implemented as a one-line call: This is usually implemented as a one-line call:
@code @code
wxObjectRefData *MyObject::CreateRefData() const wxObjectRefData *MyObject::CreateRefData() const
@@ -384,7 +384,7 @@ protected:
/** /**
Creates a new instance of the wxObjectRefData-derived class specific to Creates a new instance of the wxObjectRefData-derived class specific to
this object and initializes it copying @a data. this object and initializes it copying @a data.
This is usually implemented as a one-line call: This is usually implemented as a one-line call:
@code @code
wxObjectRefData *MyObject::CloneRefData(const wxObjectRefData *data) const wxObjectRefData *MyObject::CloneRefData(const wxObjectRefData *data) const
@@ -505,10 +505,10 @@ public:
public: public:
MyCarRefData( int price = 0 ) : m_price(price) { } MyCarRefData( int price = 0 ) : m_price(price) { }
MyCarRefData( const MyCarRefData& data ) : m_price(data.m_price) { } MyCarRefData( const MyCarRefData& data ) : m_price(data.m_price) { }
void SetPrice( int price ) { m_price = price; } void SetPrice( int price ) { m_price = price; }
int GetPrice() const { return m_price; } int GetPrice() const { return m_price; }
protected: protected:
int m_price; int m_price;
}; };
@@ -536,7 +536,7 @@ public:
if (m_data.get() == other.m_data.get()) if (m_data.get() == other.m_data.get())
return true; // this instance and the 'other' one share the return true; // this instance and the 'other' one share the
// same MyCarRefData data... // same MyCarRefData data...
return (m_data.GetPrice() == other.m_data.GetPrice()); return (m_data.GetPrice() == other.m_data.GetPrice());
} }
@@ -545,7 +545,7 @@ public:
// make sure changes to this class do not affect other instances // make sure changes to this class do not affect other instances
// currently sharing our same refcounted data: // currently sharing our same refcounted data:
UnShare(); UnShare();
m_data->SetPrice( price ); m_data->SetPrice( price );
} }