/* * Copyright (c) 2013 Remko Tronçon * Licensed under the GNU General Public License. * See the COPYING file for more information. */ #include #include #include #include #include #include #include using namespace Swift; RawXMLElementConvertor::RawXMLElementConvertor() { } RawXMLElementConvertor::~RawXMLElementConvertor() { } boost::shared_ptr RawXMLElementConvertor::convertFromLua(lua_State* L, int index, const std::string& type) { if (type == "xml") { return boost::make_shared(std::string(Lua::checkString(L, index))); } return boost::shared_ptr(); } boost::optional RawXMLElementConvertor::convertToLua(lua_State* L, boost::shared_ptr payload) { PayloadSerializer* serializer = serializers.getPayloadSerializer(payload); assert(serializer); lua_pushstring(L, serializer->serialize(payload).c_str()); return std::string("xml"); }