1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Minor aditions to the system path library.

Fixed small const correctness in remaining typename functions.
Added a flag to block certain format warnings on x64 builds.
This commit is contained in:
Sandu Liviu Catalin 2016-05-23 03:34:35 +03:00
parent 49a9983799
commit fdd06e8c2e
8 changed files with 68 additions and 8 deletions

View File

@ -164,6 +164,7 @@
<Add option="-fno-exceptions" />
<Add option="-fno-rtti" />
<Add option="-fno-strict-aliasing" />
<Add option="-Wno-format" />
<Add option="-Wno-unused-variable" />
<Add option="-Wno-unused-but-set-variable" />
<Add option="-DGARBAGE_COLLECTOR" />

View File

@ -92,7 +92,7 @@ void DocumentRef::Validate() const
// ------------------------------------------------------------------------------------------------
SQInteger ParseResult::Typename(HSQUIRRELVM vm)
{
static SQChar name[] = _SC("SqXmlParseResult");
static const SQChar name[] = _SC("SqXmlParseResult");
sq_pushstring(vm, name, sizeof(name));
return 1;
}

View File

@ -16,7 +16,7 @@ const Uint8 Date::MonthLengths[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 3
// ------------------------------------------------------------------------------------------------
SQInteger Date::Typename(HSQUIRRELVM vm)
{
static SQChar name[] = _SC("SqChronoDate");
static const SQChar name[] = _SC("SqChronoDate");
sq_pushstring(vm, name, sizeof(name));
return 1;
}

View File

@ -13,7 +13,7 @@ SQChar Time::Delimiter = ':';
// ------------------------------------------------------------------------------------------------
SQInteger Time::Typename(HSQUIRRELVM vm)
{
static SQChar name[] = _SC("SqChronoTime");
static const SQChar name[] = _SC("SqChronoTime");
sq_pushstring(vm, name, sizeof(name));
return 1;
}

View File

@ -13,7 +13,7 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------
SQInteger AES256::Typename(HSQUIRRELVM vm)
{
static SQChar name[] = _SC("SqAES256");
static const SQChar name[] = _SC("SqAES256");
sq_pushstring(vm, name, sizeof(name));
return 1;
}

View File

@ -36,7 +36,7 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------
SQInteger SysPath::Typename(HSQUIRRELVM vm)
{
static SQChar name[] = _SC("SqSysPath");
static const SQChar name[] = _SC("SqSysPath");
sq_pushstring(vm, name, sizeof(name));
return 1;
}
@ -1632,11 +1632,41 @@ SysPath SysPath::Null()
}
// ------------------------------------------------------------------------------------------------
SysPath SysPath::With(const SysPath & parent, CSStr name)
SysPath SysPath::With(const SysPath & parent, CSStr name)
{
return SysPath(parent, name);
}
// ------------------------------------------------------------------------------------------------
SysPath SysPath::MakeUnix(CSStr path)
{
return SysPath(path, Style::Unix);
}
// ------------------------------------------------------------------------------------------------
SysPath SysPath::MakeWindows(CSStr path)
{
return SysPath(path, Style::Windows);
}
// ------------------------------------------------------------------------------------------------
SysPath SysPath::MakeNative(CSStr path)
{
return SysPath(path, Style::Native);
}
// ------------------------------------------------------------------------------------------------
SysPath SysPath::MakeGuess(CSStr path)
{
return SysPath(path, Style::Guess);
}
// ------------------------------------------------------------------------------------------------
SysPath SysPath::MakeDynamic(CSStr path)
{
return SysPath(path, Style::Dynamic);
}
// ================================================================================================
void Register_SysPath(HSQUIRRELVM vm)
{
@ -1710,6 +1740,11 @@ void Register_SysPath(HSQUIRRELVM vm)
.StaticFunc(_SC("System"), &SysPath::System)
.StaticFunc(_SC("Null"), &SysPath::Null)
.StaticFunc(_SC("With"), &SysPath::With)
.StaticFunc(_SC("Unix"), &SysPath::MakeUnix)
.StaticFunc(_SC("Windows"), &SysPath::MakeWindows)
.StaticFunc(_SC("Native"), &SysPath::MakeNative)
.StaticFunc(_SC("Guess"), &SysPath::MakeGuess)
.StaticFunc(_SC("Dynamic"), &SysPath::MakeDynamic)
// Static Overloads
.StaticOverload< SysPath (*)(CSStr) >(_SC("ForDir"), &SysPath::ForDirectory)
.StaticOverload< SysPath (*)(CSStr, Int32) >(_SC("ForDir"), &SysPath::ForDirectory)

View File

@ -720,8 +720,32 @@ public:
* Creates a path from a parent path and a file name. The parent path is expected to reference
* a directory.
*/
static SysPath With(const SysPath & parent, CSStr name);
static SysPath With(const SysPath & parent, CSStr name);
/* --------------------------------------------------------------------------------------------
* Creates a path in unix format from a string.
*/
static SysPath MakeUnix(CSStr path);
/* --------------------------------------------------------------------------------------------
* Creates a path in windows format from a string.
*/
static SysPath MakeWindows(CSStr path);
/* --------------------------------------------------------------------------------------------
* Creates a path in native format from a string.
*/
static SysPath MakeNative(CSStr path);
/* --------------------------------------------------------------------------------------------
* Creates a path in and guess the format from a string.
*/
static SysPath MakeGuess(CSStr path);
/* --------------------------------------------------------------------------------------------
* Creates a path in dynamic format from a string.
*/
static SysPath MakeDynamic(CSStr path);
};
} // Namespace:: SqMod

View File

@ -18,7 +18,7 @@ Routine::Objects Routine::s_Objects;
// ------------------------------------------------------------------------------------------------
SQInteger Routine::Typename(HSQUIRRELVM vm)
{
static SQChar name[] = _SC("SqRoutine");
static const SQChar name[] = _SC("SqRoutine");
sq_pushstring(vm, name, sizeof(name));
return 1;
}