summaryrefslogtreecommitdiff
path: root/source/3rd-party/Luax/luax_class.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/3rd-party/Luax/luax_class.hpp')
-rw-r--r--source/3rd-party/Luax/luax_class.hpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/source/3rd-party/Luax/luax_class.hpp b/source/3rd-party/Luax/luax_class.hpp
index c41adbd..e6e0696 100644
--- a/source/3rd-party/Luax/luax_class.hpp
+++ b/source/3rd-party/Luax/luax_class.hpp
@@ -12,7 +12,7 @@
#include "luax_ref.h"
#include "luax_memberref.h"
#include "luax_cfunctions.h"
-#include "luax_dog.h"
+#include "luax_watchdog.h"
namespace Luax
{
@@ -24,8 +24,9 @@ namespace Luax
/// LuaxGetFactoryName ùͬʱעʱעΪsingletonͨ
/// ʱ
///
-#define LUAX_DECL_FACTORY(type) \
+#define LUAX_DECL_FACTORY(type, ...) \
friend class Luax::LuaxState; \
+ friend class Luax::LuaxNativeClass<type,##__VA_ARGS__>; \
static void RegisterLuaxClass(Luax::LuaxState&); \
static void RegisterLuaxPostprocess(Luax::LuaxState&); \
static const char* GetLuaxFactoryName() { return #type; };\
@@ -44,8 +45,9 @@ namespace Luax
/// RegisterLuaxClass עķͳԱö١ȵclass table
/// LuaxGetSingletonName õ
///
-#define LUAX_DECL_SINGLETON(type) \
+#define LUAX_DECL_SINGLETON(type, ...) \
friend class Luax::LuaxState; \
+ friend class Luax::LuaxNativeClass<type,##__VA_ARGS__>; \
static void RegisterLuaxClass(Luax::LuaxState&); \
static void RegisterLuaxPostprocess(Luax::LuaxState&); \
static const char* GetLuaxSingletonName() { return #type; }; \
@@ -114,13 +116,14 @@ namespace Luax
virtual bool PushLuaxRefTable(LuaxState& state) = 0;
///
- /// LuaxNativeClassʵ֡
+ /// LuaxNativeClassʵֺ֡ͷnativeԴ
///
virtual void Retain() = 0;
virtual void Release() = 0;
};
+ // TODO: ȡҪظɴ
//class LuaxNativeClassBase
//{
//}
@@ -139,12 +142,12 @@ namespace Luax
/// Ƚmember refʵᱻαͬʵõƵЩʵ壬
/// luaƵĵgc⡣
///
- template<class USERDATA> void LuaxRetain(LuaxState& state, USERDATA* userdata);
+ template<class DATATYPE> void LuaxRetain(LuaxState& state, DATATYPE* userdata);
///
/// userdataһref tableԳԻuserdata
///
- template<class USERDATA> void LuaxRelease(LuaxState& state, USERDATA* userdata);
+ template<class DATATYPE> void LuaxRelease(LuaxState& state, DATATYPE* userdata);
///
/// userdata pushջûгʼmUserdataʼúԪѳʼõ
@@ -162,8 +165,8 @@ namespace Luax
///
/// nativeӿڡ
///
- void Retain() override;
- void Release() override;
+ void Retain() override final;
+ void Release() override final;
#if LUAX_PROFILER
// Զϴʵdeleteռ
@@ -201,21 +204,18 @@ namespace Luax
//------------------------------------------------------------------------------//
//
- LUAX_DECL_METHOD(__tostring);
- LUAX_DECL_METHOD(_GetClass);
- LUAX_DECL_METHOD(_GetClassName);
-
+ static int __tostring (lua_State*);
+ static int _GetClass (lua_State*);
+ static int _GetClassName (lua_State*);
+
//
- LUAX_DECL_METHOD(__gc);
-#if LUAX_ENABLE_NATIVE_EXTEND
- LUAX_DECL_METHOD(_ExtendFactory);
-#endif
- LUAX_DECL_METHOD(_GetRefTable);
- LUAX_DECL_METHOD(_New);
+ static int __gc (lua_State*);
+ static int _GetRefTable (lua_State*);
+ static int _New (lua_State*);
- //
#if LUAX_ENABLE_NATIVE_EXTEND
- LUAX_DECL_METHOD(_ExtendSingleton);
+ static int _ExtendFactory (lua_State*);
+ static int _ExtendSingleton (lua_State*);
#endif
//--------------------------------------------------------------------------------//
@@ -244,7 +244,7 @@ namespace Luax
///
/// ͨɾ
///
- LuaxDog mWatchDog;
+ LuaxWatchDog mWatchDog;
#if LUAX_PROFILER
// йܴ˶