Minor stylistic changes to be consistent

This commit is contained in:
Rapptz 2013-12-12 05:07:58 -05:00
parent 61e49d9829
commit fdf145ecd8
2 changed files with 32 additions and 38 deletions

View File

@ -28,15 +28,15 @@
namespace sol { namespace sol {
namespace detail { namespace detail {
template<typename T, std::size_t n> template<typename T, std::size_t N>
void get_upvalue_ptr(lua_State* L, T*& data, std::size_t datasize, std::array<void*, n> voiddata, int& upvalue) { void get_upvalue_ptr(lua_State* L, T*& data, std::size_t datasize, std::array<void*, N> voiddata, int& upvalue) {
for (std::size_t i = 0, d = 0; d < datasize; ++i, d += sizeof(void*)) { for (std::size_t i = 0, d = 0; d < datasize; ++i, d += sizeof(void*)) {
voiddata[i] = lua_touserdata(L, lua_upvalueindex(upvalue++)); voiddata[i] = lua_touserdata(L, lua_upvalueindex(upvalue++));
} }
data = reinterpret_cast<T*>(static_cast<void*>(voiddata.data())); data = reinterpret_cast<T*>(static_cast<void*>(voiddata.data()));
} }
template<typename T, std::size_t n> template<typename T, std::size_t N>
void get_upvalue_ptr(lua_State* L, T*& data, std::array<void*, n> voiddata, int& upvalue) { void get_upvalue_ptr(lua_State* L, T*& data, std::array<void*, N> voiddata, int& upvalue) {
get_upvalue_ptr(L, data, sizeof(T), voiddata, upvalue); get_upvalue_ptr(L, data, sizeof(T), voiddata, upvalue);
} }
template<typename T> template<typename T>
@ -147,7 +147,7 @@ struct lua_func {
void** pinheritancedata = static_cast<void**>(lua_touserdata(L, lua_upvalueindex(1))); void** pinheritancedata = static_cast<void**>(lua_touserdata(L, lua_upvalueindex(1)));
void* inheritancedata = *pinheritancedata; void* inheritancedata = *pinheritancedata;
if (inheritancedata == nullptr) if (inheritancedata == nullptr)
throw sol_error("call from lua to c++ function has null data"); throw sol_error("call from Lua to C++ function has null data");
lua_func* pfx = static_cast<lua_func*>(inheritancedata); lua_func* pfx = static_cast<lua_func*>(inheritancedata);
lua_func& fx = *pfx; lua_func& fx = *pfx;
int r = fx(L); int r = fx(L);
@ -164,10 +164,10 @@ struct lua_func {
} }
virtual int operator()(lua_State*) { virtual int operator()(lua_State*) {
throw sol_error("Failure to call specialized wrapped C++ function from lua"); throw sol_error("failure to call specialized wrapped C++ function from Lua");
} }
virtual ~lua_func() {}; virtual ~lua_func() {}
}; };
template<typename TFx> template<typename TFx>
@ -196,9 +196,7 @@ struct lambda_lua_func : public lua_func {
return sizeof...(TRn); return sizeof...(TRn);
} }
~lambda_lua_func() { ~lambda_lua_func() {}
}
}; };
template<typename TFx, typename T = TFx, bool is_member_pointer = std::is_member_function_pointer<TFx>::value> template<typename TFx, typename T = TFx, bool is_member_pointer = std::is_member_function_pointer<TFx>::value>
@ -227,9 +225,7 @@ struct explicit_lua_func : public lua_func {
return sizeof...(TRn); return sizeof...(TRn);
} }
~explicit_lua_func() { ~explicit_lua_func() {}
}
}; };
template<typename TFx, typename T> template<typename TFx, typename T>
@ -269,9 +265,7 @@ struct explicit_lua_func<TFx, T, true> : public lua_func {
return sizeof...(TRn); return sizeof...(TRn);
} }
~explicit_lua_func() { ~explicit_lua_func() {}
}
}; };
} // sol } // sol