1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-21 20:27:13 +01:00

Remove traces of noexcept from the binding library. This would've impaired the exception handling required by the binding system and cause a program termination for even the slightest error that occured from the script.

This commit is contained in:
Sandu Liviu Catalin 2018-10-23 21:29:28 +03:00
parent 52611bdb80
commit 464821592c
6 changed files with 82 additions and 82 deletions

View File

@ -50,17 +50,17 @@ struct Function {
HSQOBJECT mEnv, mObj; HSQOBJECT mEnv, mObj;
// Default constructor (null) // Default constructor (null)
Function() noexcept { Function() {
sq_resetobject(&mEnv); sq_resetobject(&mEnv);
sq_resetobject(&mObj); sq_resetobject(&mObj);
} }
// Copy constructor // Copy constructor
Function(const Function& sf) noexcept : mEnv(sf.mEnv), mObj(sf.mObj) { Function(const Function& sf) : mEnv(sf.mEnv), mObj(sf.mObj) {
sq_addref(DefaultVM::Get_(), &mEnv); sq_addref(DefaultVM::Get_(), &mEnv);
sq_addref(DefaultVM::Get_(), &mObj); sq_addref(DefaultVM::Get_(), &mObj);
} }
// Move constructor // Move constructor
Function(Function&& sf) noexcept : mEnv(sf.mEnv), mObj(sf.mObj) { Function(Function&& sf) : mEnv(sf.mEnv), mObj(sf.mObj) {
sq_resetobject(&sf.GetEnv()); sq_resetobject(&sf.GetEnv());
sq_resetobject(&sf.GetFunc()); sq_resetobject(&sf.GetFunc());
} }
@ -93,7 +93,7 @@ struct Function {
#endif #endif
} }
// Constructs a Function from two Squirrel objects (one is the environment object and the other is the function object) // Constructs a Function from two Squirrel objects (one is the environment object and the other is the function object)
Function(HSQUIRRELVM vm, HSQOBJECT e, HSQOBJECT o) noexcept : mEnv(e), mObj(o) { Function(HSQUIRRELVM vm, HSQOBJECT e, HSQOBJECT o) : mEnv(e), mObj(o) {
sq_addref(vm, &mEnv); sq_addref(vm, &mEnv);
sq_addref(vm, &mObj); sq_addref(vm, &mObj);
} }
@ -102,7 +102,7 @@ struct Function {
Release(); Release();
} }
// Copy Assignment operator // Copy Assignment operator
Function& operator=(const Function& sf) noexcept { Function& operator=(const Function& sf) {
Release(); Release();
mEnv = sf.mEnv; mEnv = sf.mEnv;
mObj = sf.mObj; mObj = sf.mObj;
@ -113,7 +113,7 @@ struct Function {
return *this; return *this;
} }
// Move Assignment operator // Move Assignment operator
Function& operator=(Function&& sf) noexcept { Function& operator=(Function&& sf) {
Release(); Release();
mEnv = sf.mEnv; mEnv = sf.mEnv;
mObj = sf.mObj; mObj = sf.mObj;
@ -122,31 +122,31 @@ struct Function {
return *this; return *this;
} }
// Checks whether the Function is null // Checks whether the Function is null
bool IsNull() const noexcept { bool IsNull() const {
return sq_isnull(mObj); return sq_isnull(mObj);
} }
// Gets the Squirrel environment object for this Function (copy) // Gets the Squirrel environment object for this Function (copy)
HSQOBJECT GetEnv() const noexcept { HSQOBJECT GetEnv() const {
return mEnv; return mEnv;
} }
// Gets the Squirrel environment object for this Function (reference) // Gets the Squirrel environment object for this Function (reference)
HSQOBJECT& GetEnv() noexcept { HSQOBJECT& GetEnv() {
return mEnv; return mEnv;
} }
// Gets the Squirrel function object for this Function (copy) // Gets the Squirrel function object for this Function (copy)
HSQOBJECT GetFunc() const noexcept { HSQOBJECT GetFunc() const {
return mObj; return mObj;
} }
// Gets the Squirrel function object for this Function (reference) // Gets the Squirrel function object for this Function (reference)
HSQOBJECT& GetFunc() noexcept { HSQOBJECT& GetFunc() {
return mObj; return mObj;
} }
// Gets the Squirrel VM for this Function // Gets the Squirrel VM for this Function
HSQUIRRELVM GetVM() const noexcept { HSQUIRRELVM GetVM() const {
return DefaultVM::Get_(); return DefaultVM::Get_();
} }
// Sets the Function to null (removing its references to underlying Squirrel objects) // Sets the Function to null (removing its references to underlying Squirrel objects)
void Release() noexcept { void Release() {
if(!IsNull()) { if(!IsNull()) {
sq_release(DefaultVM::Get_(), &mEnv); sq_release(DefaultVM::Get_(), &mEnv);
sq_release(DefaultVM::Get_(), &mObj); sq_release(DefaultVM::Get_(), &mObj);
@ -157,7 +157,7 @@ struct Function {
// Sets the Function to null (removing its references to underlying Squirrel objects) // Sets the Function to null (removing its references to underlying Squirrel objects)
// This doesn't call release if the reference count is 1. // This doesn't call release if the reference count is 1.
// Workaround for some weird squirrel behavior that generates an assert in debug mode. // Workaround for some weird squirrel behavior that generates an assert in debug mode.
void ReleaseGently() noexcept { void ReleaseGently() {
if(!IsNull()) { if(!IsNull()) {
sq_release(DefaultVM::Get_(), &mEnv); sq_release(DefaultVM::Get_(), &mEnv);
if (sq_getrefcount(DefaultVM::Get_(), &mObj) > 1) { if (sq_getrefcount(DefaultVM::Get_(), &mObj) > 1) {
@ -256,7 +256,7 @@ template<> struct Var<Function> {
Var(HSQUIRRELVM vm, SQInteger idx) : value(vm, idx) { Var(HSQUIRRELVM vm, SQInteger idx) : value(vm, idx) {
} }
// Called by Sqrat::PushVar to put a Function on the stack // Called by Sqrat::PushVar to put a Function on the stack
static void push(HSQUIRRELVM vm, const Function& value) noexcept { static void push(HSQUIRRELVM vm, const Function& value) {
sq_pushobject(vm, value.GetFunc()); sq_pushobject(vm, value.GetFunc());
} }
}; };

View File

@ -94,12 +94,12 @@ template <> struct SqGlobalProxy<void> {
}; };
template<bool> struct SqGlobalParamCheck { template<bool> struct SqGlobalParamCheck {
static inline bool Invalid(SQInteger top, SQInteger count) noexcept { static inline bool Invalid(SQInteger top, SQInteger count) {
return top != count; return top != count;
} }
}; };
template<> struct SqGlobalParamCheck<true> { template<> struct SqGlobalParamCheck<true> {
static inline bool Invalid(SQInteger top, SQInteger count) noexcept { static inline bool Invalid(SQInteger top, SQInteger count) {
return top < (count - 1); return top < (count - 1);
} }
}; };
@ -109,8 +109,8 @@ template<> struct SqGlobalParamCheck<true> {
// //
template <class R> struct SqGlobal { template <class R> struct SqGlobal {
// Function proxy // Function proxy
template <SQInteger startIdx, bool overloaded, class... A> static SQFUNCTION GetProxy() noexcept { template <SQInteger startIdx, bool overloaded, class... A> static SQFUNCTION GetProxy() {
return +[](HSQUIRRELVM vm) noexcept -> SQInteger { return +[](HSQUIRRELVM vm) -> SQInteger {
#if !defined (SCRAT_NO_ERROR_CHECKING) #if !defined (SCRAT_NO_ERROR_CHECKING)
if (!SQRAT_CONST_CONDITION(overloaded) && if (!SQRAT_CONST_CONDITION(overloaded) &&
SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), startIdx + sizeof...(A))) { SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), startIdx + sizeof...(A))) {
@ -135,8 +135,8 @@ template <class R> struct SqGlobal {
template <class R> struct SqGlobal<R&> { template <class R> struct SqGlobal<R&> {
// Function proxy // Function proxy
template <SQInteger startIdx, bool overloaded, class... A> static SQFUNCTION GetProxy() noexcept { template <SQInteger startIdx, bool overloaded, class... A> static SQFUNCTION GetProxy() {
return +[](HSQUIRRELVM vm) noexcept -> SQInteger { return +[](HSQUIRRELVM vm) -> SQInteger {
#if !defined (SCRAT_NO_ERROR_CHECKING) #if !defined (SCRAT_NO_ERROR_CHECKING)
if (!SQRAT_CONST_CONDITION(overloaded) && if (!SQRAT_CONST_CONDITION(overloaded) &&
SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), startIdx + sizeof...(A))) { SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), startIdx + sizeof...(A))) {
@ -161,8 +161,8 @@ template <class R> struct SqGlobal<R&> {
template <> struct SqGlobal<void> { template <> struct SqGlobal<void> {
// Function proxy // Function proxy
template <SQInteger startIdx, bool overloaded, class... A> static SQFUNCTION GetProxy() noexcept { template <SQInteger startIdx, bool overloaded, class... A> static SQFUNCTION GetProxy() {
return +[](HSQUIRRELVM vm) noexcept -> SQInteger { return +[](HSQUIRRELVM vm) -> SQInteger {
#if !defined (SCRAT_NO_ERROR_CHECKING) #if !defined (SCRAT_NO_ERROR_CHECKING)
if (!SQRAT_CONST_CONDITION(overloaded) && if (!SQRAT_CONST_CONDITION(overloaded) &&
SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), startIdx + sizeof...(A))) { SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), startIdx + sizeof...(A))) {
@ -182,22 +182,22 @@ template <> struct SqGlobal<void> {
}; };
// Global Function Resolver // Global Function Resolver
template <class R,class... A> SQFUNCTION SqGlobalFunc(R (* /*method*/)(A...)) noexcept { template <class R,class... A> SQFUNCTION SqGlobalFunc(R (* /*method*/)(A...)) {
return SqGlobal<R>::template GetProxy<2, false, A...>(); return SqGlobal<R>::template GetProxy<2, false, A...>();
} }
// Global Function Resolver // Global Function Resolver
template <class R,class... A> SQFUNCTION SqGlobalFunc(R& (* /*method*/)(A...)) noexcept { template <class R,class... A> SQFUNCTION SqGlobalFunc(R& (* /*method*/)(A...)) {
return SqGlobal<R&>::template GetProxy<2, false, A...>(); return SqGlobal<R&>::template GetProxy<2, false, A...>();
} }
// Member Global Function Resolver // Member Global Function Resolver
template <class R,class T,class... A> SQFUNCTION SqMemberGlobalFunc(R (* /*method*/)(T, A...)) noexcept { template <class R,class T,class... A> SQFUNCTION SqMemberGlobalFunc(R (* /*method*/)(T, A...)) {
return SqGlobal<R>::template GetProxy<1, false, T, A...>(); return SqGlobal<R>::template GetProxy<1, false, T, A...>();
} }
// Member Global Function Resolver // Member Global Function Resolver
template <class R,class T,class... A> SQFUNCTION SqMemberGlobalFunc(R& (* /*method*/)(T, A...)) noexcept { template <class R,class T,class... A> SQFUNCTION SqMemberGlobalFunc(R& (* /*method*/)(T, A...)) {
return SqGlobal<R&>::template GetProxy<1, false, T, A...>(); return SqGlobal<R&>::template GetProxy<1, false, T, A...>();
} }

View File

@ -45,7 +45,7 @@ namespace Sqrat {
// Squirrel Member Functions // Squirrel Member Functions
// //
template <class C,class R> struct SqMemberProxy { template <class C,class R> struct SqMemberProxy {
template <class... A> static SQInteger Run(HSQUIRRELVM vm) noexcept { template <class... A> static SQInteger Run(HSQUIRRELVM vm) {
ArgFwd<A...> a{SQ_OK}; ArgFwd<A...> a{SQ_OK};
a.Call(vm, 2, [](HSQUIRRELVM vm, A... a) { a.Call(vm, 2, [](HSQUIRRELVM vm, A... a) {
typedef R(C::*M)(A...); typedef R(C::*M)(A...);
@ -58,7 +58,7 @@ template <class C,class R> struct SqMemberProxy {
}); });
return SQ_FAILED(a.mRes) ? a.mRes : 1; return SQ_FAILED(a.mRes) ? a.mRes : 1;
} }
template <class... A> static SQInteger RunC(HSQUIRRELVM vm) noexcept { template <class... A> static SQInteger RunC(HSQUIRRELVM vm) {
ArgFwd<A...> a{SQ_OK}; ArgFwd<A...> a{SQ_OK};
a.Call(vm, 2, [](HSQUIRRELVM vm, A... a) { a.Call(vm, 2, [](HSQUIRRELVM vm, A... a) {
typedef R(C::*M)(A...) const; typedef R(C::*M)(A...) const;
@ -78,7 +78,7 @@ template <class C,class R> struct SqMemberProxy {
// //
template <class C, class R> struct SqMemberProxy<C,R&> { template <class C, class R> struct SqMemberProxy<C,R&> {
template <class... A> static SQInteger Run(HSQUIRRELVM vm) noexcept { template <class... A> static SQInteger Run(HSQUIRRELVM vm) {
ArgFwd<A...> a{SQ_OK}; ArgFwd<A...> a{SQ_OK};
a.Call(vm, 2, [](HSQUIRRELVM vm, A... a) { a.Call(vm, 2, [](HSQUIRRELVM vm, A... a) {
typedef R&(C::*M)(A...); typedef R&(C::*M)(A...);
@ -91,7 +91,7 @@ template <class C, class R> struct SqMemberProxy<C,R&> {
}); });
return SQ_FAILED(a.mRes) ? a.mRes : 1; return SQ_FAILED(a.mRes) ? a.mRes : 1;
} }
template <class... A> static SQInteger RunC(HSQUIRRELVM vm) noexcept { template <class... A> static SQInteger RunC(HSQUIRRELVM vm) {
ArgFwd<A...> a{SQ_OK}; ArgFwd<A...> a{SQ_OK};
a.Call(vm, 2, [](HSQUIRRELVM vm, A... a) { a.Call(vm, 2, [](HSQUIRRELVM vm, A... a) {
typedef R&(C::*M)(A...) const; typedef R&(C::*M)(A...) const;
@ -111,7 +111,7 @@ template <class C, class R> struct SqMemberProxy<C,R&> {
// //
template <class C> struct SqMemberProxy<C, void> { template <class C> struct SqMemberProxy<C, void> {
template <class... A> static SQInteger Run(HSQUIRRELVM vm) noexcept { template <class... A> static SQInteger Run(HSQUIRRELVM vm) {
ArgFwd<A...> a{SQ_OK}; ArgFwd<A...> a{SQ_OK};
a.Call(vm, 2, [](HSQUIRRELVM vm, A... a) { a.Call(vm, 2, [](HSQUIRRELVM vm, A... a) {
typedef void(C::*M)(A...); typedef void(C::*M)(A...);
@ -123,7 +123,7 @@ template <class C> struct SqMemberProxy<C, void> {
}); });
return SQ_FAILED(a.mRes) ? a.mRes : 0; return SQ_FAILED(a.mRes) ? a.mRes : 0;
} }
template <class... A> static SQInteger RunC(HSQUIRRELVM vm) noexcept { template <class... A> static SQInteger RunC(HSQUIRRELVM vm) {
ArgFwd<A...> a{SQ_OK}; ArgFwd<A...> a{SQ_OK};
a.Call(vm, 2, [](HSQUIRRELVM vm, A... a) { a.Call(vm, 2, [](HSQUIRRELVM vm, A... a) {
typedef void(C::*M)(A...) const; typedef void(C::*M)(A...) const;
@ -138,12 +138,12 @@ template <class C> struct SqMemberProxy<C, void> {
}; };
template<bool> struct SqMemberParamCheck { template<bool> struct SqMemberParamCheck {
static inline bool Invalid(SQInteger top, SQInteger count) noexcept { static inline bool Invalid(SQInteger top, SQInteger count) {
return top != count; return top != count;
} }
}; };
template<> struct SqMemberParamCheck<true> { template<> struct SqMemberParamCheck<true> {
static inline bool Invalid(SQInteger top, SQInteger count) noexcept { static inline bool Invalid(SQInteger top, SQInteger count) {
return top < count; return top < count;
} }
}; };
@ -153,8 +153,8 @@ template<> struct SqMemberParamCheck<true> {
// //
template <class C,class R> struct SqMember { template <class C,class R> struct SqMember {
// Function proxy // Function proxy
template <bool overloaded, class... A> static SQFUNCTION GetProxy() noexcept { template <bool overloaded, class... A> static SQFUNCTION GetProxy() {
return +[](HSQUIRRELVM vm) noexcept -> SQInteger { return +[](HSQUIRRELVM vm) -> SQInteger {
#if !defined (SCRAT_NO_ERROR_CHECKING) #if !defined (SCRAT_NO_ERROR_CHECKING)
if (!SQRAT_CONST_CONDITION(overloaded) && if (!SQRAT_CONST_CONDITION(overloaded) &&
SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) { SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) {
@ -172,8 +172,8 @@ template <class C,class R> struct SqMember {
}; };
} }
// Function proxy // Function proxy
template <bool overloaded, class... A> static SQFUNCTION GetProxyC() noexcept { template <bool overloaded, class... A> static SQFUNCTION GetProxyC() {
return +[](HSQUIRRELVM vm) noexcept -> SQInteger { return +[](HSQUIRRELVM vm) -> SQInteger {
#if !defined (SCRAT_NO_ERROR_CHECKING) #if !defined (SCRAT_NO_ERROR_CHECKING)
if (!SQRAT_CONST_CONDITION(overloaded) && if (!SQRAT_CONST_CONDITION(overloaded) &&
SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) { SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) {
@ -198,8 +198,8 @@ template <class C,class R> struct SqMember {
template <class C, class R> struct SqMember<C,R&> { template <class C, class R> struct SqMember<C,R&> {
// Function proxy // Function proxy
template <bool overloaded, class... A> static SQFUNCTION GetProxy() noexcept { template <bool overloaded, class... A> static SQFUNCTION GetProxy() {
return +[](HSQUIRRELVM vm) noexcept -> SQInteger { return +[](HSQUIRRELVM vm) -> SQInteger {
#if !defined (SCRAT_NO_ERROR_CHECKING) #if !defined (SCRAT_NO_ERROR_CHECKING)
if (!SQRAT_CONST_CONDITION(overloaded) && if (!SQRAT_CONST_CONDITION(overloaded) &&
SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) { SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) {
@ -217,8 +217,8 @@ template <class C, class R> struct SqMember<C,R&> {
}; };
} }
// Function proxy // Function proxy
template <bool overloaded, class... A> static SQFUNCTION GetProxyC() noexcept { template <bool overloaded, class... A> static SQFUNCTION GetProxyC() {
return +[](HSQUIRRELVM vm) noexcept -> SQInteger { return +[](HSQUIRRELVM vm) -> SQInteger {
#if !defined (SCRAT_NO_ERROR_CHECKING) #if !defined (SCRAT_NO_ERROR_CHECKING)
if (!SQRAT_CONST_CONDITION(overloaded) && if (!SQRAT_CONST_CONDITION(overloaded) &&
SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) { SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) {
@ -244,8 +244,8 @@ template <class C, class R> struct SqMember<C,R&> {
template <class C> struct SqMember<C, void> { template <class C> struct SqMember<C, void> {
// Function proxy // Function proxy
template <bool overloaded, class... A> static SQFUNCTION GetProxy() noexcept { template <bool overloaded, class... A> static SQFUNCTION GetProxy() {
return +[](HSQUIRRELVM vm) noexcept -> SQInteger { return +[](HSQUIRRELVM vm) -> SQInteger {
#if !defined (SCRAT_NO_ERROR_CHECKING) #if !defined (SCRAT_NO_ERROR_CHECKING)
if (!SQRAT_CONST_CONDITION(overloaded) && if (!SQRAT_CONST_CONDITION(overloaded) &&
SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) { SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) {
@ -263,8 +263,8 @@ template <class C> struct SqMember<C, void> {
}; };
} }
// Function proxy // Function proxy
template <bool overloaded, class... A> static SQFUNCTION GetProxyC() noexcept { template <bool overloaded, class... A> static SQFUNCTION GetProxyC() {
return +[](HSQUIRRELVM vm) noexcept -> SQInteger { return +[](HSQUIRRELVM vm) -> SQInteger {
#if !defined (SCRAT_NO_ERROR_CHECKING) #if !defined (SCRAT_NO_ERROR_CHECKING)
if (!SQRAT_CONST_CONDITION(overloaded) && if (!SQRAT_CONST_CONDITION(overloaded) &&
SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) { SqGlobalParamCheck< ArgFwd<A...>::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) {
@ -284,22 +284,22 @@ template <class C> struct SqMember<C, void> {
}; };
// Member Function Resolver // Member Function Resolver
template <class C, class R,class... A> SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A...)) noexcept { template <class C, class R,class... A> SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A...)) {
return SqMember<C,R>::template GetProxy<false, A...>(); return SqMember<C,R>::template GetProxy<false, A...>();
} }
// Member Function Resolver // Member Function Resolver
template <class C, class R,class... A> SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A...) const) noexcept { template <class C, class R,class... A> SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A...) const) {
return SqMember<C,R>::template GetProxyC<false, A...>(); return SqMember<C,R>::template GetProxyC<false, A...>();
} }
// Member Function Resolver // Member Function Resolver
template <class C, class R,class... A> SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A...)) noexcept { template <class C, class R,class... A> SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A...)) {
return SqMember<C,R&>::template GetProxy<false, A...>(); return SqMember<C,R&>::template GetProxy<false, A...>();
} }
// Member Function Resolver // Member Function Resolver
template <class C, class R,class... A> SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A...) const) noexcept { template <class C, class R,class... A> SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A...) const) {
return SqMember<C,R&>::template GetProxyC<false, A...>(); return SqMember<C,R&>::template GetProxyC<false, A...>();
} }

View File

@ -152,42 +152,42 @@ public:
}; };
// Global Overloaded Function Resolver // Global Overloaded Function Resolver
template <class R,class... A> SQFUNCTION SqGlobalOverloadedFunc(R (* /*method*/)(A...)) noexcept { template <class R,class... A> SQFUNCTION SqGlobalOverloadedFunc(R (* /*method*/)(A...)) {
return SqGlobal<R>::template GetProxy<2, true, A...>(); return SqGlobal<R>::template GetProxy<2, true, A...>();
} }
// Global Overloaded Function Resolver // Global Overloaded Function Resolver
template <class R,class... A> SQFUNCTION SqGlobalOverloadedFunc(R& (* /*method*/)(A...)) noexcept { template <class R,class... A> SQFUNCTION SqGlobalOverloadedFunc(R& (* /*method*/)(A...)) {
return SqGlobal<R&>::template GetProxy<2, true, A...>(); return SqGlobal<R&>::template GetProxy<2, true, A...>();
} }
// Member Global Overloaded Function Resolver // Member Global Overloaded Function Resolver
template <class R,class T,class... A> SQFUNCTION SqMemberGlobalOverloadedFunc(R (* /*method*/)(T, A...)) noexcept { template <class R,class T,class... A> SQFUNCTION SqMemberGlobalOverloadedFunc(R (* /*method*/)(T, A...)) {
return SqGlobal<R>::template GetProxy<1, true, T, A...>(); return SqGlobal<R>::template GetProxy<1, true, T, A...>();
} }
// Member Global Overloaded Function Resolver // Member Global Overloaded Function Resolver
template <class R,class T,class... A> SQFUNCTION SqMemberGlobalOverloadedFunc(R& (* /*method*/)(T, A...)) noexcept { template <class R,class T,class... A> SQFUNCTION SqMemberGlobalOverloadedFunc(R& (* /*method*/)(T, A...)) {
return SqGlobal<R&>::template GetProxy<1, true, T, A...>(); return SqGlobal<R&>::template GetProxy<1, true, T, A...>();
} }
// Member Overloaded Function Resolver // Member Overloaded Function Resolver
template <class C, class R,class... A> SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A...)) noexcept { template <class C, class R,class... A> SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A...)) {
return SqMember<C,R>::template GetProxy<true, A...>(); return SqMember<C,R>::template GetProxy<true, A...>();
} }
// Member Overloaded Function Resolver // Member Overloaded Function Resolver
template <class C, class R,class... A> SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A...) const) noexcept { template <class C, class R,class... A> SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A...) const) {
return SqMember<C,R>::template GetProxyC<true, A...>(); return SqMember<C,R>::template GetProxyC<true, A...>();
} }
// Member Overloaded Function Resolver // Member Overloaded Function Resolver
template <class C, class R,class... A> SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A...)) noexcept { template <class C, class R,class... A> SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A...)) {
return SqMember<C,R&>::template GetProxy<true, A...>(); return SqMember<C,R&>::template GetProxy<true, A...>();
} }
// Member Overloaded Function Resolver // Member Overloaded Function Resolver
template <class C, class R,class... A> SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A...) const) noexcept { template <class C, class R,class... A> SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A...) const) {
return SqMember<C,R&>::template GetProxyC<true, A...>(); return SqMember<C,R&>::template GetProxyC<true, A...>();
} }

View File

@ -1187,12 +1187,12 @@ template<> struct ArgFwdHasFmt<const StackStrF&> { static constexpr bool value =
/// Helper used to process formatted arguments when necessary. /// Helper used to process formatted arguments when necessary.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<bool> struct ArgFwdFmt { template<bool> struct ArgFwdFmt {
template<class T> static inline SQInteger Proc(T &, bool) noexcept { return SQ_OK; } template<class T> static inline SQInteger Proc(T &, bool) { return SQ_OK; }
template<class T> static inline SQInteger Get(T &) noexcept { return SQ_OK; } template<class T> static inline SQInteger Get(T &) { return SQ_OK; }
}; };
template<> struct ArgFwdFmt<true> { template<> struct ArgFwdFmt<true> {
static inline SQInteger Proc(StackStrF & s, bool dummy = false) noexcept { return s.Proc(true, dummy); } static inline SQInteger Proc(StackStrF & s, bool dummy = false) { return s.Proc(true, dummy); }
static inline SQInteger Get(StackStrF & s) noexcept { return s.mRes; } static inline SQInteger Get(StackStrF & s) { return s.mRes; }
}; };
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -205,17 +205,17 @@ class WeakPtr;
// Helper class that defines a VM that can be used as a fallback VM in case no other one is given to a piece of code // Helper class that defines a VM that can be used as a fallback VM in case no other one is given to a piece of code
class DefaultVM { class DefaultVM {
private: private:
static HSQUIRRELVM& StaticVM() noexcept { static HSQUIRRELVM& StaticVM() {
static HSQUIRRELVM vm; static HSQUIRRELVM vm;
return vm; return vm;
} }
public: public:
// Gets the default VM (copy) // Gets the default VM (copy)
static HSQUIRRELVM Get() noexcept { static HSQUIRRELVM Get() {
return StaticVM(); return StaticVM();
} }
// Gets the default VM (reference) // Gets the default VM (reference)
static HSQUIRRELVM & Get_() noexcept { static HSQUIRRELVM & Get_() {
return StaticVM(); return StaticVM();
} }
// Sets the default VM to a given VM // Sets the default VM to a given VM
@ -400,7 +400,7 @@ public:
/// \param msg A nice error message /// \param msg A nice error message
/// ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Exception(const SQChar * msg) noexcept : message(msg) {} Exception(const SQChar * msg) : message(msg) {}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructs an exception /// Constructs an exception
@ -408,7 +408,7 @@ public:
/// \param msg A nice error message /// \param msg A nice error message
/// ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
explicit Exception(string && msg) noexcept : message(msg) {} explicit Exception(string && msg) : message(msg) {}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructs an exception /// Constructs an exception
@ -416,7 +416,7 @@ public:
/// \param msg A nice error message /// \param msg A nice error message
/// ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
explicit Exception(const string& msg) noexcept : message(msg) {} explicit Exception(const string& msg) : message(msg) {}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Copy constructor /// Copy constructor
@ -424,7 +424,7 @@ public:
/// \param ex Exception to copy /// \param ex Exception to copy
/// ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Exception(const Exception& ex) noexcept : message(ex.message) {} Exception(const Exception& ex) : message(ex.message) {}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Returns a string identifying the exception /// Returns a string identifying the exception
@ -432,7 +432,7 @@ public:
/// \return A nice error message /// \return A nice error message
/// ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const string& Message() const noexcept { const string& Message() const {
return message; return message;
} }
@ -442,7 +442,7 @@ public:
/// \return A nice error message /// \return A nice error message
/// ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const SQChar * what() const noexcept { const SQChar * what() const {
return message.c_str(); return message.c_str();
} }
@ -575,7 +575,7 @@ private:
/// Assigns a new pointer. /// Assigns a new pointer.
/// ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Assign(T * ptr) noexcept void Assign(T * ptr)
{ {
if (m_Ptr != ptr) if (m_Ptr != ptr)
{ {
@ -593,7 +593,7 @@ private:
/// Assigns a new pointer and counter. /// Assigns a new pointer and counter.
/// ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Assign(T * ptr, Counter * ref) noexcept void Assign(T * ptr, Counter * ref)
{ {
if (m_Ptr != ptr) if (m_Ptr != ptr)
{ {
@ -1098,7 +1098,7 @@ private:
/// Initializes the pointer and counter. /// Initializes the pointer and counter.
/// ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Initialize(T * ptr, Counter * ref) noexcept void Initialize(T * ptr, Counter * ref)
{ {
if (ptr != NULL) if (ptr != NULL)
{ {
@ -1118,7 +1118,7 @@ private:
/// Assigns a new pointer and counter. /// Assigns a new pointer and counter.
/// ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Assign(T * ptr, Counter * ref) noexcept void Assign(T * ptr, Counter * ref)
{ {
if (m_Ptr != ptr) if (m_Ptr != ptr)
{ {
@ -1551,7 +1551,7 @@ struct StackStrF
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default constructor. /// Default constructor.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
StackStrF() noexcept StackStrF()
: mPtr(_SC("")) : mPtr(_SC(""))
, mLen(0) , mLen(0)
, mRes(SQ_OK) , mRes(SQ_OK)
@ -1565,7 +1565,7 @@ struct StackStrF
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Compile time string constructor. /// Compile time string constructor.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template < size_t N > StackStrF(const SQChar(&str)[N]) noexcept template < size_t N > StackStrF(const SQChar(&str)[N])
: mPtr(str) : mPtr(str)
, mLen(N) , mLen(N)
, mRes(SQ_OK) , mRes(SQ_OK)
@ -1579,7 +1579,7 @@ struct StackStrF
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Base constructor. /// Base constructor.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
StackStrF(HSQUIRRELVM vm, SQInteger idx) noexcept StackStrF(HSQUIRRELVM vm, SQInteger idx)
: mPtr(nullptr) : mPtr(nullptr)
, mLen(SQ_ERROR) , mLen(SQ_ERROR)
, mRes(SQ_OK) , mRes(SQ_OK)
@ -1597,7 +1597,7 @@ struct StackStrF
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Move constructor. /// Move constructor.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
StackStrF(StackStrF && o) noexcept StackStrF(StackStrF && o)
: mPtr(o.mPtr) : mPtr(o.mPtr)
, mLen(o.mLen) , mLen(o.mLen)
, mRes(o.mRes) , mRes(o.mRes)
@ -1616,7 +1616,7 @@ struct StackStrF
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Destructor. /// Destructor.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
~StackStrF() noexcept ~StackStrF()
{ {
if (mVM && !sq_isnull(mObj)) if (mVM && !sq_isnull(mObj))
{ {
@ -1637,7 +1637,7 @@ struct StackStrF
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Actual implementation. /// Actual implementation.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SQRESULT Proc(bool fmt = false, bool dummy = false) noexcept SQRESULT Proc(bool fmt = false, bool dummy = false)
{ {
// Reset the converted value object // Reset the converted value object
sq_resetobject(&mObj); sq_resetobject(&mObj);