diff options
Diffstat (limited to 'Source/3rdParty/Luax/luax_class.h')
-rw-r--r-- | Source/3rdParty/Luax/luax_class.h | 145 |
1 files changed, 0 insertions, 145 deletions
diff --git a/Source/3rdParty/Luax/luax_class.h b/Source/3rdParty/Luax/luax_class.h deleted file mode 100644 index bde9990..0000000 --- a/Source/3rdParty/Luax/luax_class.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef __LUAX_CLASS_H__ -#define __LUAX_CLASS_H__ - -#include <vector> - -#include "lua.hpp" -#include "luax_config.h" -#include "luax_state.h" -#include "luax_runtime.h" - -namespace Luax -{ - -#define LUAX_DECL_METHOD(mtd) static int mtd(lua_State*) - - /// - /// RegisterLuaxClass עķͳԱö١ȵclass table - /// LuaxRegisterInterface עӿڷinterface table - /// LuaxGetFactoryName ùͬʱעʱעΪsingletonͨʱ - /// -#define LUAX_DECL_FACTORY(type) \ - static void RegisterLuaxClass(LuaxState&);\ - static void RegisterLuaxInterface(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(LuaxState&); \ - static const char* GetLuaxSingletonName() { return #type; }; \ - static const char* GetLuaxClassName() { return #type; }; \ - static bool IsLuaxClassSingleton() { return true; }; - - - /// - /// Ҫ¶luaclassҪ̳дࡣͨluaʵҪȷüȷԣڶ߳Ҫȷͷš - /// - class LuaxClass - { - public: - - void Retain(); - void Release(); - - protected: - - LuaxClass(); - virtual ~LuaxClass(); - - /// - /// userdata pushջûгʼmUserdataʼúԪѳʼõuserdataջ - /// - bool PushLuaUserdata(LuaxState& state); - - //------------------------------------------------------------------------------------------------------------ - - /// - /// reftableĹ - /// - void Ref(); - - private: - - friend class LuaxState; - - template<class T> static void RegisterLuaxClass(LuaxState& state); - template<class T> static void RegisterLuaxFactoryClass(LuaxState& state); - template<class T> static void RegisterLuaxInterface(LuaxState& state); - template<class T> static void RegisterLuaxSingletonClass(LuaxState& state); - - /// - /// ȡַҪַֻͨڶϴʵõջϺ;̬ıȡַ֤üȷ - /// ҪãʹôݶǴݵַ - /// - void* operator &(); - - /// - /// stateǹ - /// - void BindFactoryToLua(LuaxState& state); - - /// - /// stateǵ - /// - void BindSingletonToLua(LuaxState& state); - - //------------------------------------------------------------------------------------------------------------ - - LuaxStrongRef mInterfaceTable; // interface table - LuaxStrongRef mClassTable; // class table - - /// - /// ü̼߳乲 - /// - int mRC; - - /// - /// ȷֻͨReleaseõsaferֻҪ̳LuaxClass࣬ʹdeleteֱͻᱨ - /// - bool mSafer; - - public: - - //------------------------------------------------------------------------------------------------------------ - // - - template<class T> LUAX_DECL_METHOD(l_GetClassName); - template<class T> LUAX_DECL_METHOD(l_GetClassName2); - - LUAX_DECL_METHOD(l_ToString); // __tostring - - //------------------------------------------------------------------------------------------------------------ - // - - LUAX_DECL_METHOD(l_GC); // __gc - - //------------------------------------------------------------------------------------------------------------ - // - - }; - - /// - /// ڳԱﴴLuaxStateԲм顣 - /// -#define LUAX_SETUP(L, params) \ - LuaxRuntime& runtime = LuaxRuntime::Get(); \ - LuaxState& state = runtime[L].state; \ - if(!state.CheckParams(1, params)) return 0 - -#define LUAX_STATE(L) \ - LuaxState& state = LuaxRuntime::Get().GetLuaxState(L) - -#define LUAX_RUNTIME() \ - LuaxRuntime& runtime = LuaxRuntime::Get() - -#include "luax_class.inl" - -} - -#endif
\ No newline at end of file |