1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-20 19:57:12 +01:00

Get rid of explicit format enabled constructors since they're detected automatically.

This commit is contained in:
Sandu Liviu Catalin 2018-10-31 20:07:46 +02:00
parent bf9b8e9f5d
commit f3f4fce80b
3 changed files with 8 additions and 41 deletions

View File

@ -781,39 +781,6 @@ public:
Class& Ctor(const SQChar *name = 0) {
return BindConstructor(A::template iNew<P...>, sizeof...(P), name);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Binds a constructor with 1 argument (there can only be one constructor of this many arguments for a given name)
///
/// \param name Name of the constructor as it will appear in Squirrel (default value creates a traditional constructor)
///
/// \return The Class itself so the call can be chained
///
/// \remarks
/// The last parameter is implicitly of StackStrF type and is automatically included into the parameter count.
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Class& FmtCtor(const SQChar *name = 0) {
return BindConstructor(A::iFmtNew, 1, name);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Binds a constructor with 2 or more arguments (there can only be one constructor of this many arguments for a given name)
///
/// \param name Name of the constructor as it will appear in Squirrel (default value creates a traditional constructor)
///
/// \tparam P Type of arguments of the constructor (must be defined explicitly)
///
/// \return The Class itself so the call can be chained
///
/// \remarks
/// The last parameter is implicitly of StackStrF type and is automatically included into the parameter count.
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class... P>
Class& FmtCtor(const SQChar *name = 0) {
return BindConstructor(A::template iFmtNew<P...>, sizeof...(P)+1, name);
}
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -421,14 +421,14 @@ void Register_Areas(HSQUIRRELVM vm)
Class< Area >(vm, AreaTypename::Str)
// Constructors
.Ctor()
.FmtCtor()
.FmtCtor< SQInteger >()
.Ctor< const StackStrF & >()
.Ctor< SQInteger, const StackStrF & >()
.Ctor< const Vector2 &, const Vector2 &, const Vector2 & >()
.FmtCtor< const Vector2 &, const Vector2 &, const Vector2 & >()
.FmtCtor< const Vector2 &, const Vector2 &, const Vector2 &, SQInteger >()
.Ctor< const Vector2 &, const Vector2 &, const Vector2 &, const StackStrF & >()
.Ctor< const Vector2 &, const Vector2 &, const Vector2 &, SQInteger, const StackStrF & >()
.Ctor< float, float, float, float, float, float >()
.FmtCtor< float, float, float, float, float, float >()
.FmtCtor< float, float, float, float, float, float, SQInteger >()
.Ctor< float, float, float, float, float, float, const StackStrF & >()
.Ctor< float, float, float, float, float, float, SQInteger, const StackStrF & >()
// Meta-methods
.SquirrelFunc(_SC("_typename"), &AreaTypename::Fn)
.Func(_SC("_tostring"), &Area::ToString)

View File

@ -1072,8 +1072,8 @@ void Register(HSQUIRRELVM vm)
cmdns.Bind(_SC("Listener"),
Class< Listener, NoCopy< Listener > >(vm, ListenerTypename::Str)
// Constructors
.FmtCtor()
.FmtCtor< StackStrF & >()
.Ctor< StackStrF & >()
.Ctor< StackStrF &, StackStrF & >()
.Ctor< StackStrF &, StackStrF &, Array & >()
.Ctor< StackStrF &, StackStrF &, Uint8, Uint8 >()
.Ctor< StackStrF &, StackStrF &, Array &, Uint8, Uint8 >()