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

Implement the pure typename meta-methods in Signal type using the standard method.

This commit is contained in:
Sandu Liviu Catalin 2016-11-15 21:42:54 +02:00
parent d059d0d1ac
commit de4c7da73f
2 changed files with 6 additions and 36 deletions

View File

@ -5,16 +5,11 @@
namespace SqMod { namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Signal::SignalContainer Signal::s_Signals; SQMODE_DECL_TYPENAME(Typename, _SC("SqSignalWrapper"))
Signal::FreeSignals Signal::s_FreeSignals;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
SQInteger Signal::Typename(HSQUIRRELVM vm) Signal::SignalContainer Signal::s_Signals;
{ Signal::FreeSignals Signal::s_FreeSignals;
static const SQChar name[] = _SC("SqSignal");
sq_pushstring(vm, name, sizeof(name));
return 1;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Signal::Terminate() void Signal::Terminate()
@ -1017,11 +1012,10 @@ static SQInteger SqFetchSignal(HSQUIRRELVM vm)
// ================================================================================================ // ================================================================================================
void Register_Signal(HSQUIRRELVM vm) void Register_Signal(HSQUIRRELVM vm)
{ {
RootTable(vm).Bind(_SC("SqSignalWrapper"), RootTable(vm).Bind(Typename::Str,
Class< Signal, NoConstructor< Signal > >(vm, _SC("SqSignalWrapper")) Class< Signal, NoConstructor< Signal > >(vm, Typename::Str)
// Meta-methods // Meta-methods
.Func(_SC("_cmp"), &Signal::Cmp) .SquirrelFunc(_SC("_typename"), &Typename::Fn)
.SquirrelFunc(_SC("_typename"), &Signal::Typename)
.Func(_SC("_tostring"), &Signal::ToString) .Func(_SC("_tostring"), &Signal::ToString)
// Core Properties // Core Properties
.Prop(_SC("Data"), &Signal::GetData, &Signal::SetData) .Prop(_SC("Data"), &Signal::GetData, &Signal::SetData)

View File

@ -391,25 +391,6 @@ public:
*/ */
Signal & operator = (Signal && o) = delete; Signal & operator = (Signal && o) = delete;
/* --------------------------------------------------------------------------------------------
* Used by the script engine to compare two instances of this type.
*/
Int32 Cmp(const Signal & o) const
{
if (m_Name == o.m_Name)
{
return 0;
}
else if (m_Name > o.m_Name)
{
return 1;
}
else
{
return -1;
}
}
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Used by the script engine to convert an instance of this type to a string. * Used by the script engine to convert an instance of this type to a string.
*/ */
@ -418,11 +399,6 @@ public:
return m_Name; return m_Name;
} }
/* --------------------------------------------------------------------------------------------
* Used by the script engine to retrieve the name from instances of this type.
*/
static SQInteger Typename(HSQUIRRELVM vm);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Retrieve the associated user data. * Retrieve the associated user data.
*/ */