5 #ifndef LUABIND_FORMAT_SIGNATURE_081014_HPP 6 # define LUABIND_FORMAT_SIGNATURE_081014_HPP 8 # include <luabind/config.hpp> 9 # include <luabind/lua_include.hpp> 10 # include <luabind/typeid.hpp> 12 # include <boost/mpl/begin_end.hpp> 13 # include <boost/mpl/next.hpp> 14 # include <boost/mpl/size.hpp> 16 namespace luabind {
namespace adl
32 namespace luabind {
namespace detail {
41 lua_pushstring(L, get_class_name(L,
typeid(T)).c_str());
51 lua_pushstring(L,
"*");
62 lua_pushstring(L,
"&");
73 lua_pushstring(L,
" const");
78 # define LUABIND_TYPE_TO_STRING(x) \ 80 struct type_to_string<x> \ 82 static void get(lua_State* L) \ 84 lua_pushstring(L, #x); \ 88 # define LUABIND_INTEGRAL_TYPE_TO_STRING(x) \ 89 LUABIND_TYPE_TO_STRING(x) \ 90 LUABIND_TYPE_TO_STRING(unsigned x) 92 LUABIND_INTEGRAL_TYPE_TO_STRING(
char)
93 LUABIND_INTEGRAL_TYPE_TO_STRING(
short)
94 LUABIND_INTEGRAL_TYPE_TO_STRING(
int)
95 LUABIND_INTEGRAL_TYPE_TO_STRING(
long)
97 LUABIND_TYPE_TO_STRING(
void)
98 LUABIND_TYPE_TO_STRING(
bool)
99 LUABIND_TYPE_TO_STRING(std::string)
105 # undef LUABIND_INTEGRAL_TYPE_TO_STRING 106 # undef LUABIND_TYPE_TO_STRING 108 template <
class Base>
113 lua_pushstring(L,
"table");
117 # ifndef LUABIND_CPP0x 120 void format_signature_aux(
lua_State*,
bool, End, End)
123 template <
class Iter,
class End>
124 void format_signature_aux(
lua_State* L,
bool first, Iter, End end)
127 lua_pushstring(L,
",");
129 format_signature_aux(L,
false,
typename mpl::next<Iter>::type(), end);
132 template <
class Signature>
133 void format_signature(
lua_State* L,
char const*
function, Signature)
135 typedef typename mpl::begin<Signature>::type first;
139 lua_pushstring(L,
" ");
140 lua_pushstring(L,
function);
142 lua_pushstring(L,
"(");
143 format_signature_aux(
146 ,
typename mpl::next<first>::type()
147 ,
typename mpl::end<Signature>::type()
149 lua_pushstring(L,
")");
151 lua_concat(L, static_cast<int>(mpl::size<Signature>()) * 2 + 2);
154 # else // LUABIND_CPP0x 156 inline void format_signature_aux(
lua_State*, vector<>,
bool)
159 template <
class T,
class... Args>
160 void format_signature_aux(
lua_State* L, vector<T, Args...>,
bool first =
true)
163 lua_pushstring(L,
",");
165 format_signature_aux(L, vector<Args...>(),
false);
168 template <
class R,
class... Args>
169 void format_signature(
lua_State* L,
char const*
function, vector<R, Args...>)
173 lua_pushstring(L,
" ");
174 lua_pushstring(L,
function);
176 lua_pushstring(L,
"(");
177 format_signature_aux(L, vector<R, Args...>());
178 lua_pushstring(L,
")");
180 lua_concat(L, (
sizeof...(Args) + 1) * 2 + 2);
183 # endif // LUABIND_CPP0x 187 #endif // LUABIND_FORMAT_SIGNATURE_081014_HPP Definition: typeid.hpp:22
Definition: format_signature.hpp:22
Definition: object.hpp:749
Definition: minilua.c:461
Definition: object.hpp:816
Definition: PEtypes.h:507
Definition: format_signature.hpp:37