diff options
Diffstat (limited to 'engines/gob/helper.h')
-rw-r--r-- | engines/gob/helper.h | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/engines/gob/helper.h b/engines/gob/helper.h index fbb5ae7ec8..d1f24792a5 100644 --- a/engines/gob/helper.h +++ b/engines/gob/helper.h @@ -35,58 +35,6 @@ inline char *strncpy0(char *dest, const char *src, size_t n) { return dest; } -/** A "smart" reference counting templated class. */ -template<typename T> -class ReferenceCounter { -public: - class Ptr { - public: - bool operator==(const Ptr &p) const { return _p == p._p; } - bool operator==(const ReferenceCounter *p) const { return _p == p; } - - T *operator-> () { return _p; } - T &operator* () { return *_p; } - operator T*() { return _p; } - - Ptr(T *p) : _p(p) { ++_p->_references; } - Ptr() : _p(0) { } - - ~Ptr() { - if (_p && (--_p->_references == 0)) - delete _p; - } - - Ptr(const Ptr &p) : _p(p._p) { ++_p->_references; } - - Ptr &operator= (const Ptr &p) { - ++p._p->_references; - if (_p && (--_p->_references == 0)) - delete _p; - _p = p._p; - return *this; - } - Ptr *operator= (const Ptr *p) { - if (p) - ++p->_p->_references; - if (_p && (--_p->_references == 0)) - delete _p; - - _p = p ? p->_p : 0; - return this; - } - - private: - T *_p; - }; - - ReferenceCounter() : _references(0) { } - virtual ~ReferenceCounter() {} - -private: - unsigned _references; - friend class Ptr; -}; - } // End of namespace Gob #endif // GOB_HELPER_H |