Fix compilation

This commit is contained in:
Wojtek Figat
2024-10-06 23:54:20 +02:00
parent 4a4120864d
commit 28bf60e62d
2 changed files with 20 additions and 2 deletions

View File

@@ -15,6 +15,21 @@ constexpr char DirectorySeparatorChar = '\\';
constexpr char AltDirectorySeparatorChar = '/'; constexpr char AltDirectorySeparatorChar = '/';
constexpr char VolumeSeparatorChar = ':'; constexpr char VolumeSeparatorChar = ':';
#if PLATFORM_TEXT_IS_CHAR16
int32 StringUtils::Length(const wchar_t* str)
{
int32 result = 0;
if (str)
{
while (*str)
str++;
}
return result;
}
#endif
const Char* StringUtils::FindIgnoreCase(const Char* str, const Char* toFind) const Char* StringUtils::FindIgnoreCase(const Char* str, const Char* toFind)
{ {
if (toFind == nullptr || str == nullptr) if (toFind == nullptr || str == nullptr)

View File

@@ -115,6 +115,9 @@ public:
public: public:
// Gets the string length. Returns 0 if str is null. // Gets the string length. Returns 0 if str is null.
static int32 Length(const Char* str); static int32 Length(const Char* str);
#if PLATFORM_TEXT_IS_CHAR16
static int32 Length(const wchar_t* str);
#endif
// Gets the string length. Returns 0 if str is null. // Gets the string length. Returns 0 if str is null.
static int32 Length(const char* str); static int32 Length(const char* str);
@@ -224,7 +227,7 @@ public:
template<typename T> template<typename T>
static bool ParseHex(const T* str, uint32* result) static bool ParseHex(const T* str, uint32* result)
{ {
return StringUtils::ParseHex(str, StringUtils::Length((const T*)str), result); return StringUtils::ParseHex(str, StringUtils::Length(str), result);
} }
// Parses text to the unsigned integer value. Returns true if failed to convert the value. // Parses text to the unsigned integer value. Returns true if failed to convert the value.
@@ -321,7 +324,7 @@ public:
template<typename T, typename U> template<typename T, typename U>
static bool Parse(const T* str, U* result) static bool Parse(const T* str, U* result)
{ {
return StringUtils::Parse((const T*)str, StringUtils::Length((const T*)str), (U*)result); return StringUtils::Parse(str, StringUtils::Length(str), result);
} }
// Parses text to the scalar value. Returns true if failed to convert the value. // Parses text to the scalar value. Returns true if failed to convert the value.