summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorCallum Linden <113564339+callumlinden@users.noreply.github.com>2023-03-07 11:46:27 -0800
committerGitHub <noreply@github.com>2023-03-07 11:46:27 -0800
commit6b0b751a207737c06544ac4de13174661b1dcb35 (patch)
tree95f472eabe4407cca653af3a867808f32402551c /indra/llcommon
parent98f0656f5c21a9469984cc8c916a1310d2fc2849 (diff)
parent4072fd84fb201e37827a6a98264fadea18fd30e4 (diff)
Merge pull request #83 from KittyBarnett/DRTVWR-489-emoji
Drtvwr 489 emoji
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/CMakeLists.txt2
-rw-r--r--indra/llcommon/llstring.cpp26
-rw-r--r--indra/llcommon/llstring.h2
3 files changed, 30 insertions, 0 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 108149b5f7..3371306f11 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -3,6 +3,7 @@
project(llcommon)
include(00-Common)
+include(ICU4C)
include(LLCommon)
include(bugsplat)
include(Linking)
@@ -304,6 +305,7 @@ target_link_libraries(
${APRUTIL_LIBRARIES}
${APR_LIBRARIES}
${EXPAT_LIBRARIES}
+ ${ICU4C_LIBRARY}
${JSONCPP_LIBRARIES}
${ZLIBNG_LIBRARIES}
${WINDOWS_LIBRARIES}
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index f6629803ee..cda1791e45 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -30,6 +30,7 @@
#include "llerror.h"
#include "llfasttimer.h"
#include "llsd.h"
+#include <unicode/uchar.h>
#include <vector>
#if LL_WINDOWS
@@ -833,6 +834,31 @@ std::string LLStringOps::sDayFormat;
std::string LLStringOps::sAM;
std::string LLStringOps::sPM;
+// static
+bool LLStringOps::isEmoji(llwchar wch)
+{
+ switch (ublock_getCode(wch))
+ {
+ case UBLOCK_MISCELLANEOUS_SYMBOLS:
+ case UBLOCK_DINGBATS:
+ case UBLOCK_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS:
+ case UBLOCK_EMOTICONS:
+ case UBLOCK_TRANSPORT_AND_MAP_SYMBOLS:
+#if U_ICU_VERSION_MAJOR_NUM > 56
+ // Boost uses ICU so we can't update it independently
+ case UBLOCK_SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS:
+#endif // U_ICU_VERSION_MAJOR_NUM > 56
+ return true;
+ default:
+#if U_ICU_VERSION_MAJOR_NUM > 56
+ return false;
+#else
+ // See https://en.wikipedia.org/wiki/Supplemental_Symbols_and_Pictographs
+ return wch >= 0x1F900 && wch <= 0x1F9FF;
+#endif // U_ICU_VERSION_MAJOR_NUM > 56
+ }
+}
+
S32 LLStringOps::collate(const llwchar* a, const llwchar* b)
{
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 1fd6cac14a..9afbea9afe 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -189,6 +189,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);