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 Routine type using the standard method.
This commit is contained in:
parent
de4c7da73f
commit
bf734928a9
@ -9,20 +9,15 @@
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
namespace SqMod {
|
namespace SqMod {
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
SQMODE_DECL_TYPENAME(Typename, _SC("SqRoutine"))
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Routine::Time Routine::s_Last = 0;
|
Routine::Time Routine::s_Last = 0;
|
||||||
Routine::Time Routine::s_Prev = 0;
|
Routine::Time Routine::s_Prev = 0;
|
||||||
Routine::Routines Routine::s_Routines;
|
Routine::Routines Routine::s_Routines;
|
||||||
Routine::Objects Routine::s_Objects;
|
Routine::Objects Routine::s_Objects;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
SQInteger Routine::Typename(HSQUIRRELVM vm)
|
|
||||||
{
|
|
||||||
static const SQChar name[] = _SC("SqRoutine");
|
|
||||||
sq_pushstring(vm, name, sizeof(name));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void Routine::Process()
|
void Routine::Process()
|
||||||
{
|
{
|
||||||
@ -983,13 +978,12 @@ void TerminateRoutines()
|
|||||||
// ================================================================================================
|
// ================================================================================================
|
||||||
void Register_Routine(HSQUIRRELVM vm)
|
void Register_Routine(HSQUIRRELVM vm)
|
||||||
{
|
{
|
||||||
RootTable(vm).Bind(_SC("SqRoutine"),
|
RootTable(vm).Bind(Typename::Str,
|
||||||
Class< Routine, NoConstructor< Routine > >(vm, _SC("SqRoutine"))
|
Class< Routine, NoConstructor< Routine > >(vm, Typename::Str)
|
||||||
// Meta-methods
|
// Meta-methods
|
||||||
.Func(_SC("_tostring"), &Routine::ToString)
|
|
||||||
.SquirrelFunc(_SC("_typename"), &Routine::Typename)
|
|
||||||
// We cannot set _cmp for c++ classes so we use this instead
|
|
||||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Routine >, SQInteger, SQFloat, bool, std::nullptr_t, Routine >)
|
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Routine >, SQInteger, SQFloat, bool, std::nullptr_t, Routine >)
|
||||||
|
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||||
|
.Func(_SC("_tostring"), &Routine::ToString)
|
||||||
// Properties
|
// Properties
|
||||||
.Prop(_SC("Tag"), &Routine::GetTag, &Routine::SetTag)
|
.Prop(_SC("Tag"), &Routine::GetTag, &Routine::SetTag)
|
||||||
.Prop(_SC("Data"), &Routine::GetData, &Routine::SetData)
|
.Prop(_SC("Data"), &Routine::GetData, &Routine::SetData)
|
||||||
|
@ -285,11 +285,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
CSStr ToString() const;
|
CSStr ToString() const;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Used by the script engine to retrieve the name from instances of this type.
|
|
||||||
*/
|
|
||||||
static SQInteger Typename(HSQUIRRELVM vm);
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Retrieve the associated user tag.
|
* Retrieve the associated user tag.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user