ArtMOO
|
00001 #ifndef LUA_OBJECT_H 00002 #define LUA_OBJECT_H 00003 00004 #include <QMap> 00005 #include "lua_utilities.h" 00006 #include "object.h" 00007 00008 class lua_object 00009 { 00010 public: 00011 static ObjectId argId( lua_State *L, int pIndex = 1 ); 00012 static Object *argObj( lua_State *L, int pIndex = 1 ); 00013 static void lua_pushobject( lua_State *L, Object *O ); 00014 static void lua_pushobjectid( lua_State *L, ObjectId I ); 00015 00016 typedef struct luaHandle 00017 { 00018 luaHandle( void ) 00019 { 00020 O = OBJECT_NONE; 00021 } 00022 00023 luaHandle( const luaHandle &H ) 00024 { 00025 O = H.O; 00026 } 00027 00028 ~luaHandle( void ) 00029 { 00030 00031 } 00032 00033 ObjectId O; 00034 } luaHandle; 00035 00036 private: 00037 static void initialise( void ); 00038 00039 static void luaRegisterState( lua_State *L ); 00040 00041 // LUA Commands 00042 00043 static int luaGC( lua_State *L ); 00044 static int luaGet( lua_State *L ); 00045 static int luaSet( lua_State *L ); 00046 static int luaToString( lua_State *L ); 00047 00048 static int luaCreate( lua_State *L ); 00049 static int luaObject( lua_State *L ); 00050 00051 static int luaRecycle( lua_State *L ); 00052 00053 static int luaChildren( lua_State *L ); 00054 static int luaChild( lua_State *L ); 00055 00056 static int luaVerb( lua_State *L ); 00057 static int luaProperty( lua_State *L ); 00058 00059 static int luaVerbAdd( lua_State *L ); 00060 static int luaVerbDel( lua_State *L ); 00061 static int luaVerbCall( lua_State *L ); 00062 00063 static int luaPropAdd( lua_State *L ); 00064 static int luaPropDel( lua_State *L ); 00065 static int luaPropClear( lua_State *L ); 00066 00067 static int luaNotify( lua_State *L ); 00068 00069 static int luaProps( lua_State *L ); 00070 static int luaVerbs( lua_State *L ); 00071 00072 static int luaPushVariant( lua_State *L, const QVariant &pV ); 00073 00074 static LuaMap mLuaMap; 00075 00076 static const luaL_Reg mLuaStatic[]; 00077 static const luaL_Reg mLuaInstance[]; 00078 static const luaL_Reg mLuaInstanceFunctions[]; 00079 00080 friend class lua_moo; 00081 friend class ServerTest; 00082 }; 00083 00084 Q_DECLARE_METATYPE( lua_object::luaHandle ); 00085 00086 #endif // LUA_OBJECT_H