diff options
author | pixel <pixel> | 2007-05-25 07:28:13 +0000 |
---|---|---|
committer | pixel <pixel> | 2007-05-25 07:28:13 +0000 |
commit | b7b03ebbf2214ae434433494968ae05866eee52b (patch) | |
tree | dc55634b2bb2b692845e257d97b873d02aba6c76 | |
parent | f5f42523c696b79935c67a56ae6a86d310e4b95f (diff) |
Having LuaXML into a class. Non-tested modification, but should be harmless.
-rw-r--r-- | lib/LuaXML.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/LuaXML.cc b/lib/LuaXML.cc index 4f9c6ba..849d26a 100644 --- a/lib/LuaXML.cc +++ b/lib/LuaXML.cc @@ -3,7 +3,9 @@ #include <Handle.h> #include <BLua.h> -void LuaXML_ParseNode (lua_State *L,TiXmlNode* pNode) { +class LuaXML : public Base { +public: +static void ParseNode (lua_State *L,TiXmlNode* pNode) { if (!pNode) return; // resize stack if neccessary luaL_checkstack(L, 5, "LuaXML_ParseNode : recursion too deep"); @@ -59,27 +61,27 @@ void LuaXML_ParseNode (lua_State *L,TiXmlNode* pNode) { } } -static int LuaXML_ParseFile (lua_State *L) { +static int ParseFile (lua_State *L) { const char* sFileName = luaL_checkstring(L,1); TiXmlDocument doc(sFileName); doc.LoadFile(); lua_newtable(L); - LuaXML_ParseNode(L,&doc); + ParseNode(L,&doc); return 1; } -static int LuaXML_ParseString(lua_State *L) { +static int ParseString(lua_State *L) { const char * xml_string = luaL_checkstring(L, 1); TiXmlDocument doc; doc.Parse(xml_string); lua_newtable(L); - LuaXML_ParseNode(L, &doc); + ParseNode(L, &doc); return 1; } #define XMLBUFSIZ 81920 -static int LuaXML_ParseHandle(lua_State *__L) { +static int ParseHandle(lua_State *__L) { Lua * L = Lua::find(__L); Handle * h = (Handle *) LuaObject::getme(L, 1); TiXmlDocument doc; @@ -95,13 +97,14 @@ static int LuaXML_ParseHandle(lua_State *__L) { } lua_newtable(__L); - LuaXML_ParseNode(__L, &doc); + ParseNode(__L, &doc); return 1; } +}; static const luaL_reg xmllib[] = { - { "LoadString", LuaXML_ParseString }, - { "LoadHandle", LuaXML_ParseHandle }, + { "LoadString", LuaXML::ParseString }, + { "LoadHandle", LuaXML::ParseHandle }, { NULL, NULL } }; |