mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Implement the pure typename meta-methods in INI library using the standard method.
This commit is contained in:
parent
847222685b
commit
7e72749fa7
@ -8,12 +8,9 @@
|
|||||||
namespace SqMod {
|
namespace SqMod {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
SQInteger IniResult::Typename(HSQUIRRELVM vm)
|
SQMODE_DECL_TYPENAME(ResultTypename, _SC("SqIniResult"))
|
||||||
{
|
SQMODE_DECL_TYPENAME(EntriesTypename, _SC("SqIniEntries"))
|
||||||
static const SQChar name[] = _SC("SqIniResult");
|
SQMODE_DECL_TYPENAME(DocumentTypename, _SC("SqIniDocument"))
|
||||||
sq_pushstring(vm, name, sizeof(name));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void IniResult::Check() const
|
void IniResult::Check() const
|
||||||
@ -49,14 +46,6 @@ void DocumentRef::Validate() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
SQInteger Entries::Typename(HSQUIRRELVM vm)
|
|
||||||
{
|
|
||||||
static const SQChar name[] = _SC("SqIniEntries");
|
|
||||||
sq_pushstring(vm, name, sizeof(name));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Int32 Entries::Cmp(const Entries & o) const
|
Int32 Entries::Cmp(const Entries & o) const
|
||||||
{
|
{
|
||||||
@ -160,14 +149,6 @@ Int32 Entries::GetOrder() const
|
|||||||
return m_Elem->nOrder;
|
return m_Elem->nOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
SQInteger Document::Typename(HSQUIRRELVM vm)
|
|
||||||
{
|
|
||||||
static const SQChar name[] = _SC("SqIniDocument");
|
|
||||||
sq_pushstring(vm, name, sizeof(name));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Int32 Document::Cmp(const Document & o) const
|
Int32 Document::Cmp(const Document & o) const
|
||||||
{
|
{
|
||||||
@ -382,14 +363,15 @@ void Register_INI(HSQUIRRELVM vm)
|
|||||||
{
|
{
|
||||||
Table inins(vm);
|
Table inins(vm);
|
||||||
|
|
||||||
inins.Bind(_SC("Result"), Class< IniResult >(vm, _SC("SqIniResult"))
|
inins.Bind(_SC("Result"),
|
||||||
|
Class< IniResult >(vm, ResultTypename::Str)
|
||||||
// Constructors
|
// Constructors
|
||||||
.Ctor()
|
.Ctor()
|
||||||
.Ctor< CSStr, SQInteger >()
|
.Ctor< CSStr, SQInteger >()
|
||||||
.Ctor< const IniResult & >()
|
.Ctor< const IniResult & >()
|
||||||
// Core Meta-methods
|
// Core Meta-methods
|
||||||
.Func(_SC("_cmp"), &IniResult::Cmp)
|
.SquirrelFunc(_SC("_typename"), &ResultTypename::Fn)
|
||||||
.SquirrelFunc(_SC("_typename"), &IniResult::Typename)
|
.Func(_SC("cmp"), &IniResult::Cmp)
|
||||||
.Func(_SC("_tostring"), &IniResult::ToString)
|
.Func(_SC("_tostring"), &IniResult::ToString)
|
||||||
// Properties
|
// Properties
|
||||||
.Prop(_SC("Valid"), &IniResult::IsValid)
|
.Prop(_SC("Valid"), &IniResult::IsValid)
|
||||||
@ -399,13 +381,14 @@ void Register_INI(HSQUIRRELVM vm)
|
|||||||
.Func(_SC("Check"), &IniResult::Check)
|
.Func(_SC("Check"), &IniResult::Check)
|
||||||
);
|
);
|
||||||
|
|
||||||
inins.Bind(_SC("Entries"), Class< Entries >(vm, _SC("SqIniEntries"))
|
inins.Bind(_SC("Entries"),
|
||||||
|
Class< Entries >(vm, EntriesTypename::Str)
|
||||||
// Constructors
|
// Constructors
|
||||||
.Ctor()
|
.Ctor()
|
||||||
.Ctor< const Entries & >()
|
.Ctor< const Entries & >()
|
||||||
// Core Meta-methods
|
// Core Meta-methods
|
||||||
.Func(_SC("_cmp"), &Entries::Cmp)
|
.SquirrelFunc(_SC("_typename"), &EntriesTypename::Fn)
|
||||||
.SquirrelFunc(_SC("_typename"), &Entries::Typename)
|
.Func(_SC("cmp"), &Entries::Cmp)
|
||||||
.Func(_SC("_tostring"), &Entries::ToString)
|
.Func(_SC("_tostring"), &Entries::ToString)
|
||||||
// Properties
|
// Properties
|
||||||
.Prop(_SC("Valid"), &Entries::IsValid)
|
.Prop(_SC("Valid"), &Entries::IsValid)
|
||||||
@ -426,7 +409,8 @@ void Register_INI(HSQUIRRELVM vm)
|
|||||||
.Func(_SC("SortByLoadOrder"), &Entries::SortByLoadOrder)
|
.Func(_SC("SortByLoadOrder"), &Entries::SortByLoadOrder)
|
||||||
);
|
);
|
||||||
|
|
||||||
inins.Bind(_SC("Document"), Class< Document, NoCopy< Document > >(vm, _SC("SqIniDocument"))
|
inins.Bind(_SC("Document"),
|
||||||
|
Class< Document, NoCopy< Document > >(vm, DocumentTypename::Str)
|
||||||
// Constructors
|
// Constructors
|
||||||
.Ctor()
|
.Ctor()
|
||||||
.Ctor< bool >()
|
.Ctor< bool >()
|
||||||
@ -434,7 +418,7 @@ void Register_INI(HSQUIRRELVM vm)
|
|||||||
.Ctor< bool, bool, bool >()
|
.Ctor< bool, bool, bool >()
|
||||||
// Core Meta-methods
|
// Core Meta-methods
|
||||||
.Func(_SC("_cmp"), &Document::Cmp)
|
.Func(_SC("_cmp"), &Document::Cmp)
|
||||||
.SquirrelFunc(_SC("_typename"), &Document::Typename)
|
.SquirrelFunc(_SC("_typename"), &DocumentTypename::Fn)
|
||||||
.Func(_SC("_tostring"), &Document::ToString)
|
.Func(_SC("_tostring"), &Document::ToString)
|
||||||
// Properties
|
// Properties
|
||||||
.Prop(_SC("Valid"), &Document::IsValid)
|
.Prop(_SC("Valid"), &Document::IsValid)
|
||||||
|
@ -138,11 +138,6 @@ public:
|
|||||||
return m_Action.c_str();
|
return m_Action.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Used by the script engine to retrieve the name from instances of this type.
|
|
||||||
*/
|
|
||||||
static SQInteger Typename(HSQUIRRELVM vm);
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* See whether this instance references a valid INI result.
|
* See whether this instance references a valid INI result.
|
||||||
*/
|
*/
|
||||||
@ -482,11 +477,6 @@ public:
|
|||||||
return GetItem();
|
return GetItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Used by the script engine to retrieve the name from instances of this type.
|
|
||||||
*/
|
|
||||||
static SQInteger Typename(HSQUIRRELVM vm);
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Return whether the current element is valid and can be accessed.
|
* Return whether the current element is valid and can be accessed.
|
||||||
*/
|
*/
|
||||||
@ -687,11 +677,6 @@ public:
|
|||||||
return _SC("");
|
return _SC("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Used by the script engine to retrieve the name from instances of this type.
|
|
||||||
*/
|
|
||||||
static SQInteger Typename(HSQUIRRELVM vm);
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* See whether this instance references a valid INI document.
|
* See whether this instance references a valid INI document.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user