From ab128e03ff555a8fc292352b0b21fc1075a4c008 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Sat, 10 Jun 2017 13:49:15 +0200 Subject: C++11 patchset 6: forbid object copy using assigment/copy function deleters (#5945) C++11 implement function deleting, it's generally used to prevent some object copy In script API use this function removal on ScriptApiBase instead of ScriptApiClient/Server/MainMenu, this affect all ScriptApis Move DISABLE_CLASS_COPY with constructor, the deleted function permit to replace function in its original place --- src/script/cpp_api/s_base.h | 2 ++ src/script/scripting_client.h | 2 -- src/script/scripting_mainmenu.h | 2 -- src/script/scripting_server.h | 2 -- 4 files changed, 2 insertions(+), 6 deletions(-) (limited to 'src/script') diff --git a/src/script/cpp_api/s_base.h b/src/script/cpp_api/s_base.h index e0f6b23ae..eda4e73ac 100644 --- a/src/script/cpp_api/s_base.h +++ b/src/script/cpp_api/s_base.h @@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include +#include "util/basic_macros.h" extern "C" { #include @@ -66,6 +67,7 @@ class ScriptApiBase { public: ScriptApiBase(); virtual ~ScriptApiBase(); + DISABLE_CLASS_COPY(ScriptApiBase); // These throw a ModError on failure void loadMod(const std::string &script_path, const std::string &mod_name); diff --git a/src/script/scripting_client.h b/src/script/scripting_client.h index c13fde607..822bff773 100644 --- a/src/script/scripting_client.h +++ b/src/script/scripting_client.h @@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "cpp_api/s_base.h" #include "cpp_api/s_client.h" #include "cpp_api/s_security.h" -#include "util/basic_macros.h" class Client; class LocalPlayer; @@ -41,6 +40,5 @@ public: private: virtual void InitializeModApi(lua_State *L, int top); - DISABLE_CLASS_COPY(ClientScripting); }; #endif diff --git a/src/script/scripting_mainmenu.h b/src/script/scripting_mainmenu.h index 7b3a6eba8..8e251af03 100644 --- a/src/script/scripting_mainmenu.h +++ b/src/script/scripting_mainmenu.h @@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "cpp_api/s_base.h" #include "cpp_api/s_mainmenu.h" #include "cpp_api/s_async.h" -#include "util/basic_macros.h" /*****************************************************************************/ /* Scripting <-> Main Menu Interface */ @@ -47,7 +46,6 @@ private: static void registerLuaClasses(lua_State *L, int top); AsyncEngine asyncEngine; - DISABLE_CLASS_COPY(MainMenuScripting); }; diff --git a/src/script/scripting_server.h b/src/script/scripting_server.h index 1b335406e..fd97ea40b 100644 --- a/src/script/scripting_server.h +++ b/src/script/scripting_server.h @@ -28,7 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "cpp_api/s_player.h" #include "cpp_api/s_server.h" #include "cpp_api/s_security.h" -#include "util/basic_macros.h" /*****************************************************************************/ /* Scripting <-> Server Game Interface */ @@ -51,7 +50,6 @@ public: private: void InitializeModApi(lua_State *L, int top); - DISABLE_CLASS_COPY(ServerScripting); }; void log_deprecated(const std::string &message); -- cgit v1.2.3