diff options
Diffstat (limited to 'core/fxcrt/include/fx_basic.h')
-rw-r--r-- | core/fxcrt/include/fx_basic.h | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h index 8e39f5577a..bc05a3479d 100644 --- a/core/fxcrt/include/fx_basic.h +++ b/core/fxcrt/include/fx_basic.h @@ -648,27 +648,24 @@ class CFX_BitStream { const uint8_t* m_pData; }; + template <class ObjClass> class CFX_CountRef { public: - typedef CFX_CountRef<ObjClass> Ref; + using Ref = CFX_CountRef<ObjClass>; class CountedObj : public ObjClass { public: CountedObj() {} - CountedObj(const CountedObj& src) : ObjClass(src) {} int m_RefCount; }; - CFX_CountRef() { m_pObject = nullptr; } - - CFX_CountRef(const Ref& ref) { - m_pObject = ref.m_pObject; - if (m_pObject) { + CFX_CountRef() : m_pObject(nullptr) {} + CFX_CountRef(const Ref& ref) : m_pObject(ref.m_pObject) { + if (m_pObject) m_pObject->m_RefCount++; - } } ~CFX_CountRef() { SetNull(); } @@ -687,14 +684,10 @@ class CFX_CountRef { m_pObject = ref.m_pObject; } - const ObjClass* GetObject() const { return m_pObject; } - - operator const ObjClass*() const { return m_pObject; } - - FX_BOOL IsNull() const { return !m_pObject; } - - FX_BOOL NotNull() const { return !IsNull(); } + bool IsNull() const { return !m_pObject; } + bool NotNull() const { return !IsNull(); } + const ObjClass* GetObject() const { return m_pObject; } ObjClass* GetModify() { if (!m_pObject) { m_pObject = new CountedObj; @@ -724,6 +717,7 @@ class CFX_CountRef { protected: CountedObj* m_pObject; }; + class IFX_Pause { public: virtual ~IFX_Pause() {} |