5 #include <boost/type_traits.hpp>
6 #include <boost/mpl/not.hpp>
7 #include <boost/mpl/and.hpp>
8 #include <boost/mpl/has_xxx.hpp>
22 BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type)
23 BOOST_MPL_HAS_XXX_TRAIT_DEF(
iterator)
24 BOOST_MPL_HAS_XXX_TRAIT_DEF(size_type)
25 BOOST_MPL_HAS_XXX_TRAIT_DEF(reference)
26 BOOST_MPL_HAS_XXX_TRAIT_DEF(key_type)
27 BOOST_MPL_HAS_XXX_TRAIT_DEF(mapped_type)
28 BOOST_MPL_HAS_XXX_TRAIT_DEF(first_type)
29 BOOST_MPL_HAS_XXX_TRAIT_DEF(second_type)
32 template <
typename T,
typename Enable =
void>
35 detail::has_value_type<T>::value &&
36 detail::has_iterator<T>::value &&
37 detail::has_size_type<T>::value &&
38 detail::has_reference<T>::value
42 template <
typename T,
typename Enable =
void>
45 detail::has_key_type<T>::value &&
46 detail::has_mapped_type<T>::value
50 template <
typename T,
typename Enable =
void>
53 detail::has_first_type<T>::value &&
54 detail::has_second_type<T>::value
115 std::string str = lua_check_impl::lua_check<std::string>(L,
n);
166 typename boost::enable_if<
168 boost::is_integral<T>,
178 typename boost::enable_if<
180 boost::is_integral<T>,
181 boost::mpl::not_<typename boost::is_same<T, bool>::type>
192 typename boost::enable_if<
193 typename boost::mpl::and_<
195 typename boost::mpl::not_<typename boost::is_const<typename T::first_type> >
::type
204 result.first = lua_check<const typename T::first_type&>(L, -1);
206 result.second = lua_check<const typename T::second_type&>(L, -1);
212 typename boost::enable_if<
213 typename boost::mpl::and_<
214 typename is_pair<T>::type,
215 typename boost::mpl::not_<typename boost::is_const<typename T::first_type> >::type
222 lua_push<const typename T::first_type&>(L, val.first);
224 lua_push<const typename T::second_type&>(L, val.second);
230 typename boost::enable_if<
231 typename boost::mpl::and_<
233 typename boost::mpl::not_<typename boost::is_same<T, std::string> >::type
253 throw "luaL_argerror returned";
257 #if defined(__GNUC__) && !defined(__clang__)
258 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8 )
260 #pragma GCC diagnostic ignored "-Wtype-limits"
266 typename boost::enable_if<
267 typename boost::mpl::and_<
268 typename is_container<T>::type,
269 typename boost::mpl::not_<typename boost::is_same<T, std::string> >
::type,
277 assert(list.size() >= 0);
280 for(
typename T::const_iterator iter = list.begin(); iter != list.end(); ++iter) {
289 typename boost::enable_if<
296 for(
const typename T::value_type& pair : map)
LUA_API void lua_rawgeti(lua_State *L, int idx, int n)
LUA_API void lua_createtable(lua_State *L, int narray, int nrec)
LUALIB_API lua_Integer luaL_checkinteger(lua_State *L, int narg)
LUA_API void lua_pushboolean(lua_State *L, int b)
GLuint GLuint GLsizei GLenum type
lua_check_impl::remove_constref< T >::type lua_check(lua_State *L, int n)
LUA_API void lua_settable(lua_State *L, int idx)
boost::enable_if< typename boost::is_same< T, std::string >::type, std::string >::type lua_check(lua_State *L, int n)
GLuint const GLfloat * val
boost::remove_const< typename boost::remove_reference< typename boost::remove_const< T >::type >::type >::type type
void lua_push(lua_State *L, const T &val)
map_location luaW_checklocation(lua_State *L, int index)
Converts an optional table or pair of integers to a map location object.
bool luaW_toboolean(lua_State *L, int n)
void luaW_pushtstring(lua_State *L, t_string const &v)
Pushes a t_string on the top of the stack.
t_string luaW_checktstring(lua_State *L, int index)
Converts a scalar to a translatable string.
LUA_API const char * lua_pushlstring(lua_State *L, const char *s, size_t len)
LUALIB_API lua_Number luaL_checknumber(lua_State *L, int narg)
LUA_API void lua_pushnumber(lua_State *L, lua_Number n)
Encapsulates the map of the game.
config luaW_checkconfig(lua_State *L, int index)
Converts an optional table or vconfig to a config object.
LUALIB_API int luaL_argerror(lua_State *L, int narg, const char *extramsg)
LUA_API void lua_rawseti(lua_State *L, int idx, int n)
boost::enable_if< typename boost::is_same< T, std::string >::type, void >::type lua_push(lua_State *L, const T &val)
GLuint const GLchar * name
LUA_API size_t lua_rawlen(lua_State *L, int idx)
#define lua_istable(L, n)
void luaW_pushconfig(lua_State *L, config const &cfg)
Converts a config object to a Lua table pushed at the top of the stack.
void luaW_pushlocation(lua_State *L, const map_location &ml)
Converts a map location object to a Lua table pushed at the top of the stack.
A config object defines a single node in a WML file, with access to child nodes.
GLsizei const GLcharARB ** string
#define luaL_checkstring(L, n)