Common/String: Add helpers for std::string, std::string_view
This commit is contained in:
@ -266,6 +266,18 @@ void String::AppendString(const char* appendString, u32 Count)
|
||||
InternalAppend(appendString, Count);
|
||||
}
|
||||
|
||||
void String::AppendString(const std::string& appendString)
|
||||
{
|
||||
if (!appendString.empty())
|
||||
InternalAppend(appendString.c_str(), static_cast<u32>(appendString.size()));
|
||||
}
|
||||
|
||||
void String::AppendString(const std::string_view& appendString)
|
||||
{
|
||||
if (!appendString.empty())
|
||||
InternalAppend(appendString.data(), static_cast<u32>(appendString.size()));
|
||||
}
|
||||
|
||||
void String::AppendSubString(const String& appendStr, s32 Offset /* = 0 */, s32 Count /* = INT_std::max */)
|
||||
{
|
||||
u32 appendStrLength = appendStr.GetLength();
|
||||
@ -379,6 +391,18 @@ void String::PrependString(const char* appendString, u32 Count)
|
||||
InternalPrepend(appendString, Count);
|
||||
}
|
||||
|
||||
void String::PrependString(const std::string& appendStr)
|
||||
{
|
||||
if (!appendStr.empty())
|
||||
InternalPrepend(appendStr.c_str(), static_cast<u32>(appendStr.size()));
|
||||
}
|
||||
|
||||
void String::PrependString(const std::string_view& appendStr)
|
||||
{
|
||||
if (!appendStr.empty())
|
||||
InternalPrepend(appendStr.data(), static_cast<u32>(appendStr.size()));
|
||||
}
|
||||
|
||||
void String::PrependSubString(const String& appendStr, s32 Offset /* = 0 */, s32 Count /* = INT_std::max */)
|
||||
{
|
||||
u32 appendStrLength = appendStr.GetLength();
|
||||
@ -504,6 +528,16 @@ void String::InsertString(s32 offset, const char* appendStr, u32 appendStrLength
|
||||
m_pStringData->pBuffer[m_pStringData->StringLength] = 0;
|
||||
}
|
||||
|
||||
void String::InsertString(s32 offset, const std::string& appendStr)
|
||||
{
|
||||
InsertString(offset, appendStr.c_str(), static_cast<u32>(appendStr.size()));
|
||||
}
|
||||
|
||||
void String::InsertString(s32 offset, const std::string_view& appendStr)
|
||||
{
|
||||
InsertString(offset, appendStr.data(), static_cast<u32>(appendStr.size()));
|
||||
}
|
||||
|
||||
void String::Format(const char* FormatString, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@ -555,6 +589,18 @@ void String::Assign(String&& moveString)
|
||||
moveString.m_pStringData = const_cast<String::StringData*>(&s_EmptyStringData);
|
||||
}
|
||||
|
||||
void String::Assign(const std::string& copyString)
|
||||
{
|
||||
Clear();
|
||||
AppendString(copyString.data(), static_cast<u32>(copyString.size()));
|
||||
}
|
||||
|
||||
void String::Assign(const std::string_view& copyString)
|
||||
{
|
||||
Clear();
|
||||
AppendString(copyString.data(), static_cast<u32>(copyString.size()));
|
||||
}
|
||||
|
||||
void String::AssignCopy(const String& copyString)
|
||||
{
|
||||
Clear();
|
||||
|
||||
Reference in New Issue
Block a user