diff options
author | chai <chaifix@163.com> | 2018-11-10 20:13:55 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-11-10 20:13:55 +0800 |
commit | e92caa97329016d012b46b9d37e1b2c3b613a8f2 (patch) | |
tree | 5bef0b7547e12f61dede5e09843e1718b808f9c4 /src/lua/common/je_lua_reference.hpp | |
parent | 63153bc8e742c522cfd3f5ab10609966e33310e6 (diff) |
*修改代码结构
Diffstat (limited to 'src/lua/common/je_lua_reference.hpp')
-rw-r--r-- | src/lua/common/je_lua_reference.hpp | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/src/lua/common/je_lua_reference.hpp b/src/lua/common/je_lua_reference.hpp deleted file mode 100644 index ba918bb..0000000 --- a/src/lua/common/je_lua_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 T> - class Ref : public RefBase - { - public: - Ref(T* obj, const char* type) - : RefBase(obj, type) - { - } - - ~Ref() - { - T* obj = static_cast<T*>(object); - delete obj; - } - - T* operator->() - { - return (T*)object; - } - - T* getObject() - { - return (T*)object; - } - - private: - Ref(const Ref<T>& ref); - - }; - - } -} - -#endif
\ No newline at end of file |