Initial Cross Platform Work

This commit is contained in:
2025-04-24 16:39:24 +02:00
parent dbffb7f316
commit 13c2869ba8
170 changed files with 18611 additions and 10292 deletions

View File

@ -36,48 +36,47 @@ namespace Strings {
* @param exts List of Extensions to check for
* @return true if one of the extensions is found in the String
*/
bool StringEndsWith(const std::string& str,
const std::vector<std::string>& exts);
PD_CORE_API bool StringEndsWith(const std::string& str,
const std::vector<std::string>& exts);
/**
* Function to Create a wstring of a string
* @param s Input String to Convert
* @return Result wstring
* @note Currently using std::filesystem::path for this as wstring_convert
* got removed in c++ 20
* @note Returns Empty if it has an error
*/
std::wstring MakeWstring(const std::string& s);
PD_CORE_API std::wstring MakeWstring(const std::string& s);
/**
* Generate a Formatted String by an Nanoseconds Input
* @param nanos Nanoseconds Input
* @return Result String
*/
const std::string FormatNanos(unsigned long long nanos);
PD_CORE_API const std::string FormatNanos(unsigned long long nanos);
/**
* Generate a Formatted String by an Milliseconds Input
* @param millis Milliseconds Input
* @return Result String
*/
const std::string FormatMillis(unsigned long long millis);
PD_CORE_API const std::string FormatMillis(unsigned long long millis);
/**
* Create a formatted String by an input bytes value
* @param bytes value in bytes
* @result Formatted String for example `2.5MB`
*/
const std::string FormatBytes(unsigned long long bytes);
PD_CORE_API const std::string FormatBytes(unsigned long long bytes);
/**
* Extract the Filename out of a Path
* @param path Path to extract from
* @param saperators Path Split Chars
* @return extracted filename
*/
const std::string GetFileName(const std::string& path,
const std::string& saperators = "/\\");
PD_CORE_API const std::string GetFileName(
const std::string& path, const std::string& saperators = "/\\");
/**
* Remove Extension from a Path / Filename
* @param path Input Path
* @return Path without Extension
*/
const std::string PathRemoveExtension(const std::string& path);
PD_CORE_API const std::string PathRemoveExtension(const std::string& path);
/**
* Function to Convert a Type to a hex value
* @tparam T Type
@ -95,7 +94,7 @@ inline const std::string ToHex(const T& v) {
* @param s String to hash
* @return 32Bit Hash
*/
u32 FastHash(const std::string& s);
PD_CORE_API u32 FastHash(const std::string& s);
/**
* Function to Generate a Compiler Name and Version String
* Based on their Macros
@ -105,14 +104,14 @@ inline const std::string GetCompilerVersion() {
/// As the function looks like this Project is meant to
/// Be ported to other systems as well
std::stringstream res;
#ifdef __GNUC__
res << "GCC: " << __GNUC__;
res << "." << __GNUC_MINOR__ << ".";
res << __GNUC_PATCHLEVEL__;
#elif __clang__
#ifdef __clang__ // Check clang first
res << "Clang: " << __clang_major__ << ".";
res << __clang_minor__ << ".";
res << __clang_patchlevel__;
#elif __GNUC__
res << "GCC: " << __GNUC__;
res << "." << __GNUC_MINOR__ << ".";
res << __GNUC_PATCHLEVEL__;
#elif _MSC_VER
res << "MSVC: " << _MSC_VER;
#else