mirror of
				https://github.com/VCMP-SqMod/SqMod.git
				synced 2025-11-01 14:57:18 +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:
		| @@ -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; | ||||
| } | ||||
|   | ||||
| @@ -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; | ||||
| } | ||||
|   | ||||
| @@ -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; | ||||
| } | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user