Introduce LLWStringView to prevent unnecessary memory allocations
parent
6377610f65
commit
2696b3de08
|
|
@ -758,7 +758,7 @@ std::string utf8str_showBytesUTF8(const std::string& utf8str)
|
|||
}
|
||||
|
||||
// Search for any emoji symbol, return true if found
|
||||
bool wstring_has_emoji(const LLWString& wstr)
|
||||
bool wstring_has_emoji(LLWStringView wstr)
|
||||
{
|
||||
for (const llwchar& wch : wstr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -448,6 +448,7 @@ template<class T> std::string LLStringUtilBase<T>::sLocale;
|
|||
typedef LLStringUtilBase<char> LLStringUtil;
|
||||
typedef LLStringUtilBase<llwchar> LLWStringUtil;
|
||||
typedef std::basic_string<llwchar> LLWString;
|
||||
typedef std::basic_string_view<llwchar> LLWStringView;
|
||||
|
||||
//@ Use this where we want to disallow input in the form of "foo"
|
||||
// This is used to catch places where english text is embedded in the code
|
||||
|
|
@ -749,7 +750,7 @@ LL_COMMON_API llwchar utf8str_to_wchar(const std::string& utf8str, size_t offset
|
|||
|
||||
LL_COMMON_API std::string utf8str_showBytesUTF8(const std::string& utf8str);
|
||||
|
||||
LL_COMMON_API bool wstring_has_emoji(const LLWString& wstr);
|
||||
LL_COMMON_API bool wstring_has_emoji(LLWStringView wstr);
|
||||
|
||||
LL_COMMON_API bool wstring_remove_emojis(LLWString& wstr);
|
||||
|
||||
|
|
|
|||
|
|
@ -587,13 +587,13 @@ void LLFloaterIMSessionTab::appendMessage(const LLChat& chat, const LLSD& args)
|
|||
mChatHistory->appendMessage(chat, chat_args);
|
||||
}
|
||||
|
||||
void LLFloaterIMSessionTab::updateUsedEmojis(LLWString text)
|
||||
void LLFloaterIMSessionTab::updateUsedEmojis(LLWStringView text)
|
||||
{
|
||||
LLEmojiDictionary* dictionary = LLEmojiDictionary::getInstance();
|
||||
llassert_always(dictionary);
|
||||
|
||||
bool emojiSent = false;
|
||||
for (llwchar& c : text)
|
||||
for (const llwchar& c : text)
|
||||
{
|
||||
if (dictionary->isEmoji(c))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ protected:
|
|||
std::string appendTime();
|
||||
void assignResizeLimits();
|
||||
|
||||
void updateUsedEmojis(LLWString text);
|
||||
void updateUsedEmojis(LLWStringView text);
|
||||
|
||||
S32 mFloaterExtraWidth;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue