summaryrefslogtreecommitdiff
path: root/Source/3rdParty/Luax/luax_class.hpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-16 19:29:23 +0800
committerchai <chaifix@163.com>2019-03-16 19:29:23 +0800
commitd29f5f4aebd90b1e256967801b28a5990249b2e7 (patch)
treef4f1390b57a39e0493e0f74b40dd3996d88d04e5 /Source/3rdParty/Luax/luax_class.hpp
parent1ab2501db0f9e14f138292880e37120e7a6184de (diff)
*luax
Diffstat (limited to 'Source/3rdParty/Luax/luax_class.hpp')
-rw-r--r--Source/3rdParty/Luax/luax_class.hpp44
1 files changed, 26 insertions, 18 deletions
diff --git a/Source/3rdParty/Luax/luax_class.hpp b/Source/3rdParty/Luax/luax_class.hpp
index a76d501..539093c 100644
--- a/Source/3rdParty/Luax/luax_class.hpp
+++ b/Source/3rdParty/Luax/luax_class.hpp
@@ -5,6 +5,7 @@
#include "luax_config.h"
#include "luax_ref.h"
+#include "luax_memberref.h"
namespace Luax
{
@@ -30,6 +31,7 @@ namespace Luax
///
#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; };
@@ -42,8 +44,15 @@ namespace Luax
{
public:
- void Retain();
- void Release();
+ ///
+ /// 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:
@@ -57,6 +66,13 @@ namespace Luax
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;
@@ -80,7 +96,7 @@ namespace Luax
void* operator &();
///
- /// userdataʵstateǹ
+ /// userdataʵstate
///
void BindToLua(LuaxState& state);
@@ -102,30 +118,22 @@ namespace Luax
///
LuaxWeakRef mUserdata;
- ///
- /// ü̼߳乲
- ///
- int mRC;
-
- ///
- /// ȷֻͨReleaseõsaferֻҪ̳LuaxClass࣬ʹdeleteֱͻᱨ
- ///
- bool mSafer;
-
public:
//------------------------------------------------------------------------------------------------------------
//
- LUAX_DECL_METHOD( l_GetClassName );
- LUAX_DECL_METHOD( l_GetInterfaceTable );
- LUAX_DECL_METHOD( l___tostring );
+ LUAX_DECL_METHOD( l___tostring );
+ LUAX_DECL_METHOD( l_GetClassName );
//------------------------------------------------------------------------------------------------------------
//
- LUAX_DECL_METHOD( l_ExtendFactory );
- LUAX_DECL_METHOD( l___gc );
+ LUAX_DECL_METHOD( l___gc );
+ LUAX_DECL_METHOD( l_ExtendFactory );
+ LUAX_DECL_METHOD( l_GetClass );
+ LUAX_DECL_METHOD( l_GetInterfaceTable );
+ LUAX_DECL_METHOD( l_GetRefTable );
//------------------------------------------------------------------------------------------------------------
//