From 831e814ce9bdb84e86c06c4a52008f6bdaaa00d6 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 16 Nov 2018 00:24:51 +0800 Subject: =?UTF-8?q?*=E5=90=88=E5=B9=B6master=E5=88=B0minimal=E5=88=86?= =?UTF-8?q?=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lua/common/Reference.hpp | 88 -------------------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 src/lua/common/Reference.hpp (limited to 'src/lua/common/Reference.hpp') diff --git a/src/lua/common/Reference.hpp b/src/lua/common/Reference.hpp deleted file mode 100644 index ba918bb..0000000 --- a/src/lua/common/Reference.hpp +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef __JIN_COMMON_REFERENCE_H -#define __JIN_COMMON_REFERENCE_H - -namespace JinEngine -{ - namespace Lua - { - - /*abstract*/class RefBase - { - public: - void retain() - { - ++count; - } - - void release() - { - if (--count <= 0) - delete this; - } - - // object type string - const char* const type; - - void setUserdata(void* data) - { - userdata = data; - } - - void* getUserdata() - { - return userdata; - } - - protected: - RefBase(void* obj, const char* t) - : count(1) - , object(obj) - , type(t) - { - } - - RefBase(const RefBase&); - - virtual ~RefBase() - { - } - - void* object; - int count; - void* userdata; - }; - - template - class Ref : public RefBase - { - public: - Ref(T* obj, const char* type) - : RefBase(obj, type) - { - } - - ~Ref() - { - T* obj = static_cast(object); - delete obj; - } - - T* operator->() - { - return (T*)object; - } - - T* getObject() - { - return (T*)object; - } - - private: - Ref(const Ref& ref); - - }; - - } -} - -#endif \ No newline at end of file -- cgit v1.1-26-g67d0