diff options
Diffstat (limited to 'Sluift/ElementConvertors/PubSubEventRetractConvertor.cpp')
-rw-r--r-- | Sluift/ElementConvertors/PubSubEventRetractConvertor.cpp | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/Sluift/ElementConvertors/PubSubEventRetractConvertor.cpp b/Sluift/ElementConvertors/PubSubEventRetractConvertor.cpp index aed29a0..5981922 100644 --- a/Sluift/ElementConvertors/PubSubEventRetractConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubEventRetractConvertor.cpp @@ -1,41 +1,44 @@ /* - * Copyright (c) 2013 Remko Tronçon - * Licensed under the GNU General Public License. + * Copyright (c) 2013-2016 Isode Limited. + * All rights reserved. * See the COPYING file for more information. */ #include <Sluift/ElementConvertors/PubSubEventRetractConvertor.h> -#include <lua.hpp> -#include <boost/smart_ptr/make_shared.hpp> - - - +#include <memory> -#pragma clang diagnostic ignored "-Wunused-private-field" +#include <lua.hpp> using namespace Swift; -PubSubEventRetractConvertor::PubSubEventRetractConvertor(LuaElementConvertors* convertors) : - GenericLuaElementConvertor<PubSubEventRetract>("pubsub_event_retract"), - convertors(convertors) { +PubSubEventRetractConvertor::PubSubEventRetractConvertor() : + GenericLuaElementConvertor<PubSubEventRetract>("pubsub_event_retract") { } PubSubEventRetractConvertor::~PubSubEventRetractConvertor() { } -boost::shared_ptr<PubSubEventRetract> PubSubEventRetractConvertor::doConvertFromLua(lua_State* L) { - boost::shared_ptr<PubSubEventRetract> result = boost::make_shared<PubSubEventRetract>(); - lua_getfield(L, -1, "id"); - if (lua_isstring(L, -1)) { - result->setID(std::string(lua_tostring(L, -1))); - } - lua_pop(L, 1); - return result; +std::shared_ptr<PubSubEventRetract> PubSubEventRetractConvertor::doConvertFromLua(lua_State* L) { + std::shared_ptr<PubSubEventRetract> result = std::make_shared<PubSubEventRetract>(); + lua_getfield(L, -1, "id"); + if (lua_isstring(L, -1)) { + result->setID(std::string(lua_tostring(L, -1))); + } + lua_pop(L, 1); + return result; +} + +void PubSubEventRetractConvertor::doConvertToLua(lua_State* L, std::shared_ptr<PubSubEventRetract> payload) { + lua_createtable(L, 0, 0); + lua_pushstring(L, payload->getID().c_str()); + lua_setfield(L, -2, "id"); } -void PubSubEventRetractConvertor::doConvertToLua(lua_State* L, boost::shared_ptr<PubSubEventRetract> payload) { - lua_createtable(L, 0, 0); - lua_pushstring(L, payload->getID().c_str()); - lua_setfield(L, -2, "id"); +boost::optional<LuaElementConvertor::Documentation> PubSubEventRetractConvertor::getDocumentation() const { + return Documentation( + "PubSubEventRetract", + "This table has the following fields:\n\n" + "- `id`: string\n" + ); } |