diff options
author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-03-12 16:52:30 +0100 |
---|---|---|
committer | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-03-12 16:52:30 +0100 |
commit | eb1ed3896fd82d4f115b2ef6ba742315ad32cc27 (patch) | |
tree | 110015e1703b331715fbf7fb1a01639c74c47e62 /indra/llcommon/llstring.h | |
parent | 748c0eb50d87a3f8895b25791409ce5e2e4926c4 (diff) | |
parent | afc943acbc2bb79e2e1aa5d5eaf448e01b6c2b00 (diff) |
Merge branch 'main' of https://github.com/secondlife/viewer into DRTVWR-600-maint-A
# Conflicts:
# autobuild.xml
# indra/llrender/llfontbitmapcache.cpp
# indra/llrender/llfontbitmapcache.h
# indra/llrender/llfontfreetype.cpp
# indra/llrender/llfontfreetype.h
# indra/llrender/llfontgl.cpp
# indra/llrender/llfontgl.h
# indra/llui/llbutton.h
# indra/llui/llfloater.cpp
# indra/llui/llfloater.h
# indra/llui/llfolderviewitem.cpp
# indra/llui/lllineeditor.cpp
# indra/llui/lllineeditor.h
# indra/llui/llscrollcontainer.cpp
# indra/llui/llscrollingpanellist.cpp
# indra/llui/llscrollingpanellist.h
# indra/llui/llscrolllistctrl.h
# indra/llui/lltextbase.cpp
# indra/llui/lltextbase.h
# indra/llui/lltexteditor.cpp
# indra/llui/lltexteditor.h
# indra/llui/lluictrl.cpp
# indra/llui/llview.cpp
# indra/llui/llview.h
# indra/newview/llchicletbar.h
# indra/newview/llconversationlog.h
# indra/newview/llfloaterimsessiontab.cpp
# indra/newview/llfloaterimsessiontab.h
# indra/newview/llfloateruipreview.cpp
# indra/newview/llnavigationbar.h
# indra/newview/llpaneltopinfobar.h
# indra/newview/llpathfindingpathtool.h
# indra/newview/lltextureview.cpp
# indra/newview/lltoolbrush.h
# indra/newview/lltoolcomp.h
# indra/newview/lltooldraganddrop.h
# indra/newview/lltoolface.h
# indra/newview/lltoolfocus.h
# indra/newview/lltoolindividual.h
# indra/newview/lltoolobjpicker.h
# indra/newview/lltoolpie.h
# indra/newview/lltoolpipette.h
# indra/newview/lltoolselectland.h
# indra/newview/llviewermediafocus.h
# indra/newview/llviewerparcelmediaautoplay.h
# indra/newview/llviewerwindow.cpp
# indra/newview/llvoicechannel.h
# indra/newview/llvoicevivox.h
# indra/newview/llworldmapview.cpp
Diffstat (limited to 'indra/llcommon/llstring.h')
-rw-r--r-- | indra/llcommon/llstring.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 6893b8ebff..605d0ac4d7 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -190,6 +190,8 @@ public: static bool isAlnum(char a) { return isalnum((unsigned char)a) != 0; } static bool isAlnum(llwchar a) { return iswalnum(a) != 0; } + static bool isEmoji(llwchar wch); + static S32 collate(const char* a, const char* b) { return strcoll(a, b); } static S32 collate(const llwchar* a, const llwchar* b); @@ -356,6 +358,8 @@ public: static void replaceNonstandardASCII( string_type& string, T replacement ); static void replaceChar( string_type& string, T target, T replacement ); static void replaceString( string_type& string, string_type target, string_type replacement ); + static string_type capitalize(const string_type& str); + static void capitalize(string_type& str); static bool containsNonprintable(const string_type& string); static void stripNonprintable(string_type& string); @@ -679,6 +683,8 @@ LL_COMMON_API S32 wstring_utf8_length(const LLWString& wstr); // Length in bytes of this wide char in a UTF8 string LL_COMMON_API S32 wchar_utf8_length(const llwchar wc); +LL_COMMON_API std::string wchar_utf8_preview(const llwchar wc); + LL_COMMON_API std::string utf8str_tolower(const std::string& utf8str); // Length in llwchar (UTF-32) of the first len units (16 bits) of the given UTF-16 string. @@ -738,6 +744,9 @@ LL_COMMON_API std::string mbcsstring_makeASCII(const std::string& str); LL_COMMON_API std::string utf8str_removeCRLF(const std::string& utf8str); +LL_COMMON_API llwchar utf8str_to_wchar(const std::string& utf8str, size_t offset, size_t length); + +LL_COMMON_API std::string utf8str_showBytesUTF8(const std::string& utf8str); #if LL_WINDOWS /* @name Windows string helpers @@ -1595,6 +1604,29 @@ void LLStringUtilBase<T>::replaceTabsWithSpaces( string_type& str, size_type spa } //static +template<class T> +std::basic_string<T> LLStringUtilBase<T>::capitalize(const string_type& str) +{ + string_type result(str); + capitalize(result); + return result; +} + +//static +template<class T> +void LLStringUtilBase<T>::capitalize(string_type& str) +{ + if (str.size()) + { + auto last = str[0] = toupper(str[0]); + for (U32 i = 1; i < str.size(); ++i) + { + last = (last == ' ' || last == '-' || last == '_') ? str[i] = toupper(str[i]) : str[i]; + } + } +} + +//static template<class T> bool LLStringUtilBase<T>::containsNonprintable(const string_type& string) { |