aboutsummaryrefslogtreecommitdiff
path: root/src/lua/common/Reference.hpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-10-25 08:18:13 +0800
committerchai <chaifix@163.com>2018-10-25 08:18:13 +0800
commit7322a090355af1989d7a1de0de431b6c89844fe2 (patch)
treec164a05b263007e18cc1c83c8183023d6a19ef82 /src/lua/common/Reference.hpp
parentf889c9c20fc09f26eb8a70674c1d60181835c38a (diff)
*增加lua导出宏
Diffstat (limited to 'src/lua/common/Reference.hpp')
-rw-r--r--src/lua/common/Reference.hpp88
1 files changed, 0 insertions, 88 deletions
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 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