summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-07-13 06:07:37 (GMT)
committerTobias Markmann <tm@ayena.de>2017-07-13 06:07:37 (GMT)
commit497dfb8ab128b0bbfdb6b3045caa03f8b38bc9fc (patch)
tree4d69e5ce56c755cf3b61aaf78e24729130f77e2e /Sluift/Lua
parent8f4d198c4d3aa55a5215061e84572d5faf4e4117 (diff)
downloadswift-497dfb8ab128b0bbfdb6b3045caa03f8b38bc9fc.zip
swift-497dfb8ab128b0bbfdb6b3045caa03f8b38bc9fc.tar.bz2
Remove Swiften/Base/Override.h
Replaced SWIFTEN_OVERRIDE with C++11 standard override keyword. Test-Information: Tested on macOS 10.12.5 with clang trunk. Change-Id: If89c6cc2a648662522a320834c314496c943a55a
Diffstat (limited to 'Sluift/Lua')
-rw-r--r--Sluift/Lua/FunctionRegistration.h3
-rw-r--r--Sluift/Lua/FunctionRegistry.h4
2 files changed, 2 insertions, 5 deletions
diff --git a/Sluift/Lua/FunctionRegistration.h b/Sluift/Lua/FunctionRegistration.h
index 8e1410d..285c3d0 100644
--- a/Sluift/Lua/FunctionRegistration.h
+++ b/Sluift/Lua/FunctionRegistration.h
@@ -1,44 +1,43 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
#include <string>
#include <lua.hpp>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Sluift/Lua/FunctionRegistry.h>
namespace Swift {
namespace Lua {
class FunctionRegistration {
public:
FunctionRegistration(
const std::string& name, lua_CFunction function, const std::string& type,
const std::string& helpDescription, const std::string& helpParameters, const std::string& helpOptions);
~FunctionRegistration();
};
}
}
#define SLUIFT_LUA_FUNCTION_WITH_HELP(TYPE, NAME, HELP_DESCRIPTION, HELP_PARAMETERS, HELP_OPTIONS) \
static int TYPE##_##NAME(lua_State* L); \
static int TYPE##_##NAME##_wrapper(lua_State* L); \
static ::Swift::Lua::FunctionRegistration TYPE##_##NAME##_registration( #NAME , TYPE##_##NAME##_wrapper, #TYPE, HELP_DESCRIPTION, HELP_PARAMETERS, HELP_OPTIONS); \
static int TYPE##_##NAME##_wrapper(lua_State* L) { \
try { \
return TYPE ## _ ## NAME (L); \
} \
catch (const std::exception& e) { \
return luaL_error(L, e.what()); \
} \
} \
static int TYPE ## _ ## NAME (lua_State* L)
diff --git a/Sluift/Lua/FunctionRegistry.h b/Sluift/Lua/FunctionRegistry.h
index acab3aa..88e15d5 100644
--- a/Sluift/Lua/FunctionRegistry.h
+++ b/Sluift/Lua/FunctionRegistry.h
@@ -1,45 +1,43 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
#include <string>
#include <vector>
#include <lua.hpp>
-#include <Swiften/Base/Override.h>
-
namespace Swift {
namespace Lua {
class FunctionRegistry {
public:
~FunctionRegistry();
static FunctionRegistry& getInstance();
void addFunction(const std::string& name, lua_CFunction function, const std::string& type,
const std::string& helpDescription, const std::string& helpParameters, const std::string& helpOptions);
void createFunctionTable(lua_State* L, const std::string& type);
/**
* Adds the functions to the table on the top of the stack.
*/
void addFunctionsToTable(lua_State* L, const std::string& type);
private:
FunctionRegistry();
private:
struct Registration {
std::string name;
lua_CFunction function;
std::string type;
std::string helpDescription;
std::string helpParameters;
std::string helpOptions;
};