mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 14:02:59 +01:00
Refactor scenario sources to C++
This commit is contained in:
@@ -252,7 +252,7 @@ namespace String
|
||||
size_t newStringSize = ch - firstNonWhitespace;
|
||||
#if DEBUG
|
||||
size_t currentStringSize = String::SizeOf(str);
|
||||
assert(newStringSize < currentStringSize);
|
||||
Guard::Assert(newStringSize < currentStringSize, GUARD_LINE);
|
||||
#endif
|
||||
|
||||
Memory::Move(str, firstNonWhitespace, newStringSize);
|
||||
@@ -265,4 +265,25 @@ namespace String
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
const utf8 * TrimStart(const utf8 * str)
|
||||
{
|
||||
codepoint_t codepoint;
|
||||
const utf8 * ch = str;
|
||||
const utf8 * nextCh;
|
||||
while ((codepoint = GetNextCodepoint(ch, &nextCh)) != '\0')
|
||||
{
|
||||
if (codepoint <= WCHAR_MAX && !iswspace((wchar_t)codepoint))
|
||||
{
|
||||
return ch;
|
||||
}
|
||||
ch = nextCh;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
utf8 * TrimStart(utf8 * buffer, size_t bufferSize, const utf8 * src)
|
||||
{
|
||||
return String::Set(buffer, bufferSize, TrimStart(src));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user