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 system path type using the standard method.
This commit is contained in:
parent
e562f06948
commit
7fde39fb6d
@ -33,6 +33,9 @@ namespace SqMod {
|
||||
typedef CharT PChar;
|
||||
#endif // SQMOD_OS_WINDOWS
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMODE_DECL_TYPENAME(Typename, _SC("SqSysPath"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Buffer GetRealFilePath(CSStr path)
|
||||
{
|
||||
@ -76,14 +79,6 @@ Buffer GetRealFilePath(CSStr path)
|
||||
return std::move(b);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQInteger SysPath::Typename(HSQUIRRELVM vm)
|
||||
{
|
||||
static const SQChar name[] = _SC("SqSysPath");
|
||||
sq_pushstring(vm, name, sizeof(name));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SysPath::SysPath()
|
||||
: m_Dirs()
|
||||
@ -1719,14 +1714,14 @@ SysPath SysPath::MakeDynamic(CSStr path)
|
||||
// ================================================================================================
|
||||
void Register_SysPath(HSQUIRRELVM vm)
|
||||
{
|
||||
RootTable(vm).Bind("SqSysPath", Class< SysPath >(vm, "SqSysPath")
|
||||
RootTable(vm).Bind(Typename::Str, Class< SysPath >(vm, Typename::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< CSStr >()
|
||||
.Ctor< CSStr, Int32 >()
|
||||
// Meta-methods
|
||||
.Func(_SC("_cmp"), &SysPath::Cmp)
|
||||
.SquirrelFunc(_SC("_typename"), &SysPath::Typename)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("cmp"), &SysPath::Cmp)
|
||||
.Func(_SC("_tostring"), &SysPath::ToString)
|
||||
// Properties
|
||||
.Prop(_SC("String"), &SysPath::ToString, &SysPath::FromString)
|
||||
|
@ -165,11 +165,6 @@ public:
|
||||
*/
|
||||
Object ToString() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to retrieve the name from instances of this type.
|
||||
*/
|
||||
static SQInteger Typename(HSQUIRRELVM vm);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Swaps the path with another one.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user