/* * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include #include #include #include struct lua_State; namespace Swift { class LuaElementConvertor; class Element; class LuaElementConvertors { public: LuaElementConvertors(); virtual ~LuaElementConvertors(); std::shared_ptr convertFromLua(lua_State*, int index); int convertToLua(lua_State*, std::shared_ptr); /** * Adds a toplevel type+data table with the given type. */ std::shared_ptr convertFromLuaUntyped(lua_State*, int index, const std::string& type); /** * Strips the toplevel type+data table, and only return the * data. */ int convertToLuaUntyped(lua_State*, std::shared_ptr); const std::vector< std::shared_ptr >& getConvertors() const { return convertors; } private: boost::optional doConvertToLuaUntyped(lua_State*, std::shared_ptr); void registerConvertors(); private: std::vector< std::shared_ptr > convertors; }; }