diff options
-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 } }; |