diff --git a/Source/Engine/Core/Types/StringView.cpp b/Source/Engine/Core/Types/StringView.cpp
index 6f84ed22d..27b85d9df 100644
--- a/Source/Engine/Core/Types/StringView.cpp
+++ b/Source/Engine/Core/Types/StringView.cpp
@@ -62,12 +62,12 @@ StringAnsi StringView::ToStringAnsi() const
bool operator==(const String& a, const StringView& b)
{
- return a.Length() == b.Length() && StringUtils::Compare(a.GetText(), b.GetNonTerminatedText(), b.Length()) == 0;
+ return a.Length() == b.Length() && StringUtils::Compare(a.GetText(), b.GetText(), b.Length()) == 0;
}
bool operator!=(const String& a, const StringView& b)
{
- return a.Length() != b.Length() || StringUtils::Compare(a.GetText(), b.GetNonTerminatedText(), b.Length()) != 0;
+ return a.Length() != b.Length() || StringUtils::Compare(a.GetText(), b.GetText(), b.Length()) != 0;
}
StringAnsiView StringAnsiView::Empty;
@@ -111,10 +111,10 @@ StringAnsi StringAnsiView::ToStringAnsi() const
bool operator==(const StringAnsi& a, const StringAnsiView& b)
{
- return a.Length() == b.Length() && StringUtils::Compare(a.GetText(), b.GetNonTerminatedText(), b.Length()) == 0;
+ return a.Length() == b.Length() && StringUtils::Compare(a.GetText(), b.GetText(), b.Length()) == 0;
}
bool operator!=(const StringAnsi& a, const StringAnsiView& b)
{
- return a.Length() != b.Length() || StringUtils::Compare(a.GetText(), b.GetNonTerminatedText(), b.Length()) != 0;
+ return a.Length() != b.Length() || StringUtils::Compare(a.GetText(), b.GetText(), b.Length()) != 0;
}
diff --git a/Source/Engine/Core/Types/StringView.h b/Source/Engine/Core/Types/StringView.h
index 61ac3c6ec..b0a77913e 100644
--- a/Source/Engine/Core/Types/StringView.h
+++ b/Source/Engine/Core/Types/StringView.h
@@ -60,7 +60,7 @@ public:
{
const bool thisIsShorter = Length() < str.Length();
const int32 minLength = thisIsShorter ? Length() : str.Length();
- const int32 prefixCompare = searchCase == StringSearchCase::CaseSensitive ? StringUtils::Compare(GetNonTerminatedText(), str.GetNonTerminatedText(), minLength) : StringUtils::CompareIgnoreCase(GetNonTerminatedText(), str.GetNonTerminatedText(), minLength);
+ const int32 prefixCompare = searchCase == StringSearchCase::CaseSensitive ? StringUtils::Compare(GetText(), str.GetText(), minLength) : StringUtils::CompareIgnoreCase(GetText(), str.GetText(), minLength);
if (prefixCompare != 0)
return prefixCompare;
if (Length() == str.Length())
@@ -111,8 +111,18 @@ public:
///
/// Gets the pointer to the string or to the static empty text if string is null. Returned pointer is always non-null, but is not null-terminated.
+ /// [Deprecated on 26.10.2022, expires on 26.10.2024] Use GetText()
///
- FORCE_INLINE const T* GetNonTerminatedText() const
+ FORCE_INLINE DEPRECATED const T* GetNonTerminatedText() const
+ {
+ return _data ? _data : (const T*)TEXT("");
+ }
+
+ ///
+ /// Gets the pointer to the string or to the static empty text if string is null. Returned pointer is always valid (read-only).
+ ///
+ /// The string handle.
+ FORCE_INLINE const T* GetText() const
{
return _data ? _data : (const T*)TEXT("");
}
diff --git a/Source/Engine/Localization/LocalizedStringTable.cpp b/Source/Engine/Localization/LocalizedStringTable.cpp
index 8b91db0fe..2a6272009 100644
--- a/Source/Engine/Localization/LocalizedStringTable.cpp
+++ b/Source/Engine/Localization/LocalizedStringTable.cpp
@@ -52,7 +52,7 @@ String LocalizedStringTable::GetPluralString(const String& id, int32 n) const
result = messages->At(n);
if (result.IsEmpty() && FallbackTable)
result = FallbackTable->GetPluralString(id, n);
- return String::Format(result.GetNonTerminatedText(), n);
+ return String::Format(result.GetText(), n);
}
#if USE_EDITOR
diff --git a/Source/Engine/Platform/Windows/WindowsClipboard.cpp b/Source/Engine/Platform/Windows/WindowsClipboard.cpp
index dd9a3e907..28f4c2188 100644
--- a/Source/Engine/Platform/Windows/WindowsClipboard.cpp
+++ b/Source/Engine/Platform/Windows/WindowsClipboard.cpp
@@ -27,7 +27,7 @@ void WindowsClipboard::SetText(const StringView& text)
const HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeWithoutNull + sizeof(Char));
Char* pMem = static_cast(GlobalLock(hMem));
- Platform::MemoryCopy(pMem, text.GetNonTerminatedText(), sizeWithoutNull);
+ Platform::MemoryCopy(pMem, text.GetText(), sizeWithoutNull);
Platform::MemorySet(pMem + text.Length(), sizeof(Char), 0);
GlobalUnlock(hMem);