summaryrefslogtreecommitdiff
path: root/Source/3rdParty/Luax/luax_class.hpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-19 23:06:27 +0800
committerchai <chaifix@163.com>2019-03-19 23:06:27 +0800
commit1497dccd63a84b7ee2b229b1ad9c5c02718f2a78 (patch)
treef8d1bff50da13e126d08c7345653e002e293202d /Source/3rdParty/Luax/luax_class.hpp
parent5e2a973516e0729b225da9de0b03015dc5854ac4 (diff)
*rename
Diffstat (limited to 'Source/3rdParty/Luax/luax_class.hpp')
-rw-r--r--Source/3rdParty/Luax/luax_class.hpp165
1 files changed, 0 insertions, 165 deletions
diff --git a/Source/3rdParty/Luax/luax_class.hpp b/Source/3rdParty/Luax/luax_class.hpp
deleted file mode 100644
index da78d0b..0000000
--- a/Source/3rdParty/Luax/luax_class.hpp
+++ /dev/null
@@ -1,165 +0,0 @@
-#ifndef __LUAX_CLASS_H__
-#define __LUAX_CLASS_H__
-
-#include <vector>
-
-#include "luax_config.h"
-#include "luax_ref.h"
-#include "luax_memberref.h"
-#include "luax_cfunctions.h"
-
-namespace Luax
-{
-
-#define LUAX_DECL_METHOD(mtd) static int mtd(lua_State* L)
-
- ///
- /// RegisterLuaxClass עķͳԱö١ȵclass table
- /// LuaxGetFactoryName ùͬʱעʱעΪsingletonͨʱ
- ///
-#define LUAX_DECL_FACTORY(type) \
- static void RegisterLuaxClass(Luax::LuaxState&);\
- static void RegisterLuaxPostprocess(Luax::LuaxState&); \
- static const char* GetLuaxFactoryName() { return #type; };\
- static const char* GetLuaxClassName() { return #type; };\
- static bool IsLuaxClassSingleton() { return false; };
-
- ///
- /// RegisterLuaxClass עķͳԱö١ȵclass table
- /// LuaxGetSingletonName õ
- ///
-#define LUAX_DECL_SINGLETON(type) \
- static void RegisterLuaxClass(Luax::LuaxState&); \
- static void RegisterLuaxPostprocess(Luax::LuaxState&); \
- static const char* GetLuaxSingletonName() { return #type; }; \
- static const char* GetLuaxClassName() { return #type; }; \
- static bool IsLuaxClassSingleton() { return true; };
-
- ///
- /// Ҫ¶luanative classҪ̳дࡣͨluaʵҪȷüȷԣڶ߳Ҫȷͷš
- ///
- template<class T>
- class LuaxNativeClass
- {
- public:
-
- ///
- /// userdataΪkeyref tableuserdataһãάuserdataڡ
- ///
- template<class U> void LuaRetain(LuaxState& state, U* userdata);
-
- ///
- /// userdataһref tableԳԻuserdata
- ///
- template<class U> void LuaRelease(LuaxState& state, U* userdata);
-
- protected:
-
- LuaxNativeClass();
- virtual ~LuaxNativeClass();
-
- ///
- /// userdata pushջûгʼmUserdataʼúԪѳʼõuserdataջһá
- ///
- bool PushLuaxUserdata(LuaxState& state);
- bool PushLuaxMemberTable(LuaxState& state);
- bool PushLuaxRefTable(LuaxState& state);
-
- ///
- /// Աùʵref tableáȡ
- ///
- void SetMemberRef(LuaxState& state, LuaxMemberRef& memRef, int idx);
- bool PushMemberRef(LuaxState& state, LuaxMemberRef& memRef);
- void ClearMemberRef(LuaxState& state, LuaxMemberRef& memRef);
-
- private:
-
- friend class LuaxState;
-
- static void RegisterLuaxClass(LuaxState& state);
- static void RegisterLuaxFactoryClass(LuaxState& state);
- static void RegisterLuaxSingletonClass(LuaxState& state);
-
- static void SetLuaxClassTableRef(LuaxState& state, int idx);
-
- static void PushLuaxClassTable(LuaxState& state);
-
- ///
- /// ȡַҪַֻͨڶϴʵõջϺ;̬ıȡַ֤ü׼ȷ
- /// ҪãʹôݶǴݵַ
- ///
- void* operator &();
-
- ///
- /// userdataʵstate
- ///
- void BindToLua(LuaxState& state);
-
- //------------------------------------------------------------------------------------------------------------
-
- ///
- /// LuaxNativeClass<T>͵ʵ
- ///
- static LuaxStrongRef mClassTable; // class table͵
- static LuaxStrongRef mSingletonRefTable; // ǵsingletonijԱԱ֤ᱻͨ
- // ref tableijԱȫڵģֱ_LUAX_STRONGREF_TABLE
-
- ///
- /// ͨuserdataõ:
- /// 1: ref table
- /// 2: member table
- /// 3: class table
- ///
- LuaxWeakRef mUserdata;
-
- public:
-
- //------------------------------------------------------------------------------------------------------------
- //
-
- LUAX_DECL_METHOD( l___tostring );
- LUAX_DECL_METHOD( l_GetClass );
- LUAX_DECL_METHOD( l_GetClassName );
-
- //------------------------------------------------------------------------------------------------------------
- //
-
- LUAX_DECL_METHOD( l___gc );
-#ifdef LUAX_ENABLE_NATIVE_EXTEND
- LUAX_DECL_METHOD( l_ExtendFactory );
-#endif
- LUAX_DECL_METHOD( l_GetRefTable );
- LUAX_DECL_METHOD( l_New );
-
- //------------------------------------------------------------------------------------------------------------
- //
-#ifdef LUAX_ENABLE_NATIVE_EXTEND
- LUAX_DECL_METHOD( l_ExtendSingleton );
-#endif
- };
-
- //--------------------------------------------------------------------------------------------------------------
-
-#ifdef LUAX_ENABLE_PLAIN_CLASS
- ///
- /// lua
- ///
- class LuaxPlainClass
- {
- public:
-
- ///
- /// עںͨregistry()עࡣ
- ///
- static int registry(lua_State* L);
-
- LUAX_DECL_METHOD( l___tostring );
- LUAX_DECL_METHOD( l_Extend );
- LUAX_DECL_METHOD( l_New );
-
- };
-#endif
-
-}
-
-#endif \ No newline at end of file