From bb49f0e021fb1fbefad44d944233fb1cf72c495c Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 1 Feb 2012 09:12:54 +0000 Subject: Introducing StringUtils - the place to be if you are a generic string routine :) No more sprintf()! git-svn-id: http://mc-server.googlecode.com/svn/trunk@209 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/ManualBindings.cpp | 78 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 2 deletions(-) (limited to 'source/ManualBindings.cpp') diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp index 7e2e45855..ba844b702 100644 --- a/source/ManualBindings.cpp +++ b/source/ManualBindings.cpp @@ -15,7 +15,9 @@ #include "cStringMap.h" #include "md5/md5.h" -extern std::vector StringSplit(std::string str, std::string delim); + + + /**************************** * Lua bound functions with special return types @@ -26,7 +28,7 @@ static int tolua_StringSplit(lua_State* tolua_S) std::string str = ((std::string) tolua_tocppstring(tolua_S,1,0)); std::string delim = ((std::string) tolua_tocppstring(tolua_S,2,0)); - std::vector Split = StringSplit( str, delim ); + AStringVector Split = StringSplit( str, delim ); lua_createtable(tolua_S, Split.size(), 0); int newTable = lua_gettop(tolua_S); @@ -41,6 +43,10 @@ static int tolua_StringSplit(lua_State* tolua_S) return 1; } + + + + static int tolua_LOG(lua_State* tolua_S) { const char* str = tolua_tocppstring(tolua_S,1,0); @@ -48,6 +54,10 @@ static int tolua_LOG(lua_State* tolua_S) return 0; } + + + + static int tolua_LOGINFO(lua_State* tolua_S) { const char* str = tolua_tocppstring(tolua_S,1,0); @@ -55,6 +65,10 @@ static int tolua_LOGINFO(lua_State* tolua_S) return 0; } + + + + static int tolua_LOGWARN(lua_State* tolua_S) { const char* str = tolua_tocppstring(tolua_S,1,0); @@ -62,6 +76,10 @@ static int tolua_LOGWARN(lua_State* tolua_S) return 0; } + + + + static int tolua_LOGERROR(lua_State* tolua_S) { const char* str = tolua_tocppstring(tolua_S,1,0); @@ -69,6 +87,10 @@ static int tolua_LOGERROR(lua_State* tolua_S) return 0; } + + + + static int tolua_cWorld_GetAllPlayers(lua_State* tolua_S) { cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); @@ -79,6 +101,10 @@ static int tolua_cWorld_GetAllPlayers(lua_State* tolua_S) return 1; } + + + + static int tolua_cPlugin_GetCommands(lua_State* tolua_S) { cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0); @@ -100,6 +126,10 @@ static int tolua_cPlugin_GetCommands(lua_State* tolua_S) return 1; } + + + + static int tolua_cPluginManager_GetAllPlugins(lua_State* tolua_S) { cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); @@ -121,6 +151,10 @@ static int tolua_cPluginManager_GetAllPlugins(lua_State* tolua_S) return 1; } + + + + static int tolua_cPlayer_GetGroups(lua_State* tolua_S) { cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); @@ -142,6 +176,10 @@ static int tolua_cPlayer_GetGroups(lua_State* tolua_S) return 1; } + + + + static int tolua_cPlayer_GetResolvedPermissions(lua_State* tolua_S) { cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); @@ -163,6 +201,10 @@ static int tolua_cPlayer_GetResolvedPermissions(lua_State* tolua_S) return 1; } + + + + static int tolua_cPlugin_BindCommand(lua_State* tolua_S) { cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0); @@ -217,6 +259,10 @@ static int tolua_cPlugin_BindCommand(lua_State* tolua_S) return 0; } + + + + static int tolua_cWebPlugin_Lua_AddTab(lua_State* tolua_S) { cWebPlugin_Lua* self = (cWebPlugin_Lua*) tolua_tousertype(tolua_S,1,0); @@ -260,6 +306,10 @@ static int tolua_cWebPlugin_Lua_AddTab(lua_State* tolua_S) return 0; } + + + + static int tolua_md5(lua_State* tolua_S) { std::string SourceString = tolua_tostring(tolua_S, 1, 0); @@ -268,6 +318,10 @@ static int tolua_md5(lua_State* tolua_S) return 1; } + + + + static int tolua_push_StringStringMap(lua_State* tolua_S, std::map< std::string, std::string >& a_StringStringMap ) { lua_newtable(tolua_S); @@ -285,18 +339,30 @@ static int tolua_push_StringStringMap(lua_State* tolua_S, std::map< std::string, return 1; } + + + + static int tolua_get_HTTPRequest_Params(lua_State* tolua_S) { HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); return tolua_push_StringStringMap(tolua_S, self->Params); } + + + + static int tolua_get_HTTPRequest_PostParams(lua_State* tolua_S) { HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); return tolua_push_StringStringMap(tolua_S, self->PostParams); } + + + + static int tolua_get_HTTPRequest_FormData(lua_State* tolua_S) { HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); @@ -316,6 +382,10 @@ static int tolua_get_HTTPRequest_FormData(lua_State* tolua_S) return 1; } + + + + void ManualBindings::Bind( lua_State* tolua_S ) { tolua_beginmodule(tolua_S,NULL); @@ -357,3 +427,7 @@ void ManualBindings::Bind( lua_State* tolua_S ) tolua_endmodule(tolua_S); } + + + + -- cgit v1.2.3