summaryrefslogtreecommitdiffstats
path: root/intl/icu/source/common/emojiprops.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /intl/icu/source/common/emojiprops.h
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'intl/icu/source/common/emojiprops.h')
-rw-r--r--intl/icu/source/common/emojiprops.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/intl/icu/source/common/emojiprops.h b/intl/icu/source/common/emojiprops.h
new file mode 100644
index 0000000000..777b7b11a8
--- /dev/null
+++ b/intl/icu/source/common/emojiprops.h
@@ -0,0 +1,90 @@
+// © 2021 and later: Unicode, Inc. and others.
+// License & terms of use: https://www.unicode.org/copyright.html
+
+// emojiprops.h
+// created: 2021sep03 Markus W. Scherer
+
+#ifndef __EMOJIPROPS_H__
+#define __EMOJIPROPS_H__
+
+#include "unicode/utypes.h"
+#include "unicode/ucptrie.h"
+#include "unicode/udata.h"
+#include "unicode/uobject.h"
+#include "uset_imp.h"
+
+U_NAMESPACE_BEGIN
+
+class EmojiProps : public UMemory {
+public:
+ // @internal
+ EmojiProps(UErrorCode &errorCode) { load(errorCode); }
+ ~EmojiProps();
+
+ static const EmojiProps *getSingleton(UErrorCode &errorCode);
+ static UBool hasBinaryProperty(UChar32 c, UProperty which);
+ static UBool hasBinaryProperty(const char16_t *s, int32_t length, UProperty which);
+
+ void addPropertyStarts(const USetAdder *sa, UErrorCode &errorCode) const;
+ void addStrings(const USetAdder *sa, UProperty which, UErrorCode &errorCode) const;
+
+ enum {
+ // Byte offsets from the start of the data, after the generic header,
+ // in ascending order.
+ // UCPTrie=CodePointTrie, follows the indexes
+ IX_CPTRIE_OFFSET,
+ IX_RESERVED1,
+ IX_RESERVED2,
+ IX_RESERVED3,
+
+ // UCharsTrie=CharsTrie
+ IX_BASIC_EMOJI_TRIE_OFFSET,
+ IX_EMOJI_KEYCAP_SEQUENCE_TRIE_OFFSET,
+ IX_RGI_EMOJI_MODIFIER_SEQUENCE_TRIE_OFFSET,
+ IX_RGI_EMOJI_FLAG_SEQUENCE_TRIE_OFFSET,
+ IX_RGI_EMOJI_TAG_SEQUENCE_TRIE_OFFSET,
+ IX_RGI_EMOJI_ZWJ_SEQUENCE_TRIE_OFFSET,
+ IX_RESERVED10,
+ IX_RESERVED11,
+ IX_RESERVED12,
+ IX_TOTAL_SIZE,
+
+ // Not initially byte offsets.
+ IX_RESERVED14,
+ IX_RESERVED15,
+ IX_COUNT // 16
+ };
+
+ // Properties in the code point trie.
+ enum {
+ // https://www.unicode.org/reports/tr51/#Emoji_Properties
+ BIT_EMOJI,
+ BIT_EMOJI_PRESENTATION,
+ BIT_EMOJI_MODIFIER,
+ BIT_EMOJI_MODIFIER_BASE,
+ BIT_EMOJI_COMPONENT,
+ BIT_EXTENDED_PICTOGRAPHIC,
+ // https://www.unicode.org/reports/tr51/#Emoji_Sets
+ BIT_BASIC_EMOJI
+ };
+
+private:
+ static UBool U_CALLCONV
+ isAcceptable(void *context, const char *type, const char *name, const UDataInfo *pInfo);
+ /** Input i: One of the IX_..._TRIE_OFFSET indexes into the data file indexes[] array. */
+ static int32_t getStringTrieIndex(int32_t i) {
+ return i - IX_BASIC_EMOJI_TRIE_OFFSET;
+ }
+
+ void load(UErrorCode &errorCode);
+ UBool hasBinaryPropertyImpl(UChar32 c, UProperty which) const;
+ UBool hasBinaryPropertyImpl(const char16_t *s, int32_t length, UProperty which) const;
+
+ UDataMemory *memory = nullptr;
+ UCPTrie *cpTrie = nullptr;
+ const char16_t *stringTries[6] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
+};
+
+U_NAMESPACE_END
+
+#endif // __EMOJIPROPS_H__