1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2026-01-20 22:24:38 +01:00

Move the plugin Squirrel utilities to the Sqrat binding utility.

Implement registration of functions and methods with string formatting support in the Sqrat binding utility.
Few minor other fixes.
This commit is contained in:
Sandu Liviu Catalin
2016-11-16 11:54:07 +02:00
parent ed599c06dd
commit 0137dfc66f
8 changed files with 5119 additions and 203 deletions

View File

@@ -394,6 +394,23 @@ public:
return *this;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Binds a class function with formatting support
///
/// \param name Name of the function as it will appear in Squirrel
/// \param method Function to bind
///
/// \tparam F Type of function (usually doesnt need to be defined explicitly)
///
/// \return The Class itself so the call can be chained
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class F>
Class& FmtFunc(const SQChar* name, F method) {
BindFunc(name, &method, sizeof(method), SqMemberFuncFmt(method));
return *this;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Binds a class function with overloading enabled
///
@@ -432,6 +449,23 @@ public:
return *this;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Binds a global function as a class function with formatting support
///
/// \param name Name of the function as it will appear in Squirrel
/// \param method Function to bind
///
/// \tparam F Type of function (usually doesnt need to be defined explicitly)
///
/// \return The Class itself so the call can be chained
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class F>
Class& GlobalFmtFunc(const SQChar* name, F method) {
BindFunc(name, &method, sizeof(method), SqMemberGlobalFmtFunc(method));
return *this;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Binds a static class function
///
@@ -449,6 +483,23 @@ public:
return *this;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Binds a static class function with formatting support
///
/// \param name Name of the function as it will appear in Squirrel
/// \param method Function to bind
///
/// \tparam F Type of function (usually doesnt need to be defined explicitly)
///
/// \return The Class itself so the call can be chained
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class F>
Class& StaticFmtFunc(const SQChar* name, F method) {
BindFunc(name, &method, sizeof(method), SqGlobalFmtFunc(method));
return *this;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Binds a global function as a class function with overloading enabled
///