mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 11:33:03 +01:00
reinstate theme editor and fix bugs
This commit is contained in:
@@ -10,6 +10,11 @@ extern "C"
|
||||
|
||||
namespace String
|
||||
{
|
||||
bool IsNullOrEmpty(const utf8 * str)
|
||||
{
|
||||
return str == nullptr || str[0] == '\0';
|
||||
}
|
||||
|
||||
bool Equals(const utf8 * a, const utf8 * b, bool ignoreCase)
|
||||
{
|
||||
if (a == b) return true;
|
||||
@@ -51,6 +56,28 @@ namespace String
|
||||
}
|
||||
}
|
||||
|
||||
size_t LastIndexOf(const utf8 * str, utf8 match)
|
||||
{
|
||||
const utf8 * lastOccurance = nullptr;
|
||||
const utf8 * ch = str;
|
||||
for (; ch != '\0'; ch++)
|
||||
{
|
||||
if (*ch == match)
|
||||
{
|
||||
lastOccurance = ch;
|
||||
}
|
||||
}
|
||||
|
||||
if (lastOccurance == nullptr)
|
||||
{
|
||||
return SIZE_MAX;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (size_t)(lastOccurance - str);
|
||||
}
|
||||
}
|
||||
|
||||
size_t LengthOf(const utf8 * str)
|
||||
{
|
||||
return utf8_length(str);
|
||||
@@ -137,7 +164,7 @@ namespace String
|
||||
return replacement;
|
||||
}
|
||||
|
||||
utf8 * DiscardDuplicate(utf8 * * ptr, utf8 * replacement)
|
||||
utf8 * DiscardDuplicate(utf8 * * ptr, const utf8 * replacement)
|
||||
{
|
||||
return DiscardUse(ptr, String::Duplicate(replacement));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user