Rename wxObjectDataRef wxRefCounter, use it in wxVariant
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61034 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -69,7 +69,6 @@ class WXDLLIMPEXP_FWD_BASE wxClassInfo;
|
|||||||
class WXDLLIMPEXP_FWD_BASE wxHashTable;
|
class WXDLLIMPEXP_FWD_BASE wxHashTable;
|
||||||
class WXDLLIMPEXP_FWD_BASE wxObject;
|
class WXDLLIMPEXP_FWD_BASE wxObject;
|
||||||
class WXDLLIMPEXP_FWD_BASE wxPluginLibrary;
|
class WXDLLIMPEXP_FWD_BASE wxPluginLibrary;
|
||||||
class WXDLLIMPEXP_FWD_BASE wxObjectRefData;
|
|
||||||
class WXDLLIMPEXP_FWD_BASE wxHashTable_Node;
|
class WXDLLIMPEXP_FWD_BASE wxHashTable_Node;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -399,13 +398,13 @@ inline T *wxCheckCast(const void *ptr, T * = NULL)
|
|||||||
#endif // wxUSE_MEMORY_TRACING
|
#endif // wxUSE_MEMORY_TRACING
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxObjectRefData: ref counted data meant to be stored in wxObject
|
// wxRefCounter: ref counted data "manager"
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_BASE wxObjectRefData
|
class WXDLLIMPEXP_BASE wxRefCounter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxObjectRefData() { m_count = 1; }
|
wxRefCounter() { m_count = 1; }
|
||||||
|
|
||||||
int GetRefCount() const { return m_count; }
|
int GetRefCount() const { return m_count; }
|
||||||
|
|
||||||
@@ -415,15 +414,20 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
// this object should never be destroyed directly but only as a
|
// this object should never be destroyed directly but only as a
|
||||||
// result of a DecRef() call:
|
// result of a DecRef() call:
|
||||||
virtual ~wxObjectRefData() { }
|
virtual ~wxRefCounter() { }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// our refcount:
|
// our refcount:
|
||||||
int m_count;
|
int m_count;
|
||||||
|
|
||||||
friend class WXDLLIMPEXP_FWD_BASE wxObject;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxObjectRefData: ref counted data meant to be stored in wxObject
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
typedef wxRefCounter wxObjectRefData;
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxObjectDataPtr: helper class to avoid memleaks because of missing calls
|
// wxObjectDataPtr: helper class to avoid memleaks because of missing calls
|
||||||
// to wxObjectRefData::DecRef
|
// to wxObjectRefData::DecRef
|
||||||
@@ -518,7 +522,7 @@ public:
|
|||||||
{
|
{
|
||||||
m_refData = other.m_refData;
|
m_refData = other.m_refData;
|
||||||
if (m_refData)
|
if (m_refData)
|
||||||
m_refData->m_count++;
|
m_refData->IncRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxObject& operator=(const wxObject& other)
|
wxObject& operator=(const wxObject& other)
|
||||||
|
@@ -55,7 +55,7 @@
|
|||||||
* overloading wxVariant with unnecessary functionality.
|
* overloading wxVariant with unnecessary functionality.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class WXDLLIMPEXP_BASE wxVariantData : public wxObjectRefData
|
class WXDLLIMPEXP_BASE wxVariantData : public wxRefCounter
|
||||||
{
|
{
|
||||||
friend class wxVariant;
|
friend class wxVariant;
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user