Path: blob/master/thirdparty/icu4c/common/emojiprops.h
9903 views
// © 2021 and later: Unicode, Inc. and others.1// License & terms of use: https://www.unicode.org/copyright.html23// emojiprops.h4// created: 2021sep03 Markus W. Scherer56#ifndef __EMOJIPROPS_H__7#define __EMOJIPROPS_H__89#include "unicode/utypes.h"10#include "unicode/ucptrie.h"11#include "unicode/udata.h"12#include "unicode/uobject.h"13#include "uset_imp.h"1415U_NAMESPACE_BEGIN1617class EmojiProps : public UMemory {18public:19// @internal20EmojiProps(UErrorCode &errorCode) { load(errorCode); }21~EmojiProps();2223static const EmojiProps *getSingleton(UErrorCode &errorCode);24static UBool hasBinaryProperty(UChar32 c, UProperty which);25static UBool hasBinaryProperty(const char16_t *s, int32_t length, UProperty which);2627void addPropertyStarts(const USetAdder *sa, UErrorCode &errorCode) const;28void addStrings(const USetAdder *sa, UProperty which, UErrorCode &errorCode) const;2930enum {31// Byte offsets from the start of the data, after the generic header,32// in ascending order.33// UCPTrie=CodePointTrie, follows the indexes34IX_CPTRIE_OFFSET,35IX_RESERVED1,36IX_RESERVED2,37IX_RESERVED3,3839// UCharsTrie=CharsTrie40IX_BASIC_EMOJI_TRIE_OFFSET,41IX_EMOJI_KEYCAP_SEQUENCE_TRIE_OFFSET,42IX_RGI_EMOJI_MODIFIER_SEQUENCE_TRIE_OFFSET,43IX_RGI_EMOJI_FLAG_SEQUENCE_TRIE_OFFSET,44IX_RGI_EMOJI_TAG_SEQUENCE_TRIE_OFFSET,45IX_RGI_EMOJI_ZWJ_SEQUENCE_TRIE_OFFSET,46IX_RESERVED10,47IX_RESERVED11,48IX_RESERVED12,49IX_TOTAL_SIZE,5051// Not initially byte offsets.52IX_RESERVED14,53IX_RESERVED15,54IX_COUNT // 1655};5657// Properties in the code point trie.58enum {59// https://www.unicode.org/reports/tr51/#Emoji_Properties60BIT_EMOJI,61BIT_EMOJI_PRESENTATION,62BIT_EMOJI_MODIFIER,63BIT_EMOJI_MODIFIER_BASE,64BIT_EMOJI_COMPONENT,65BIT_EXTENDED_PICTOGRAPHIC,66// https://www.unicode.org/reports/tr51/#Emoji_Sets67BIT_BASIC_EMOJI68};6970private:71static UBool U_CALLCONV72isAcceptable(void *context, const char *type, const char *name, const UDataInfo *pInfo);73/** Input i: One of the IX_..._TRIE_OFFSET indexes into the data file indexes[] array. */74static int32_t getStringTrieIndex(int32_t i) {75return i - IX_BASIC_EMOJI_TRIE_OFFSET;76}7778void load(UErrorCode &errorCode);79UBool hasBinaryPropertyImpl(UChar32 c, UProperty which) const;80UBool hasBinaryPropertyImpl(const char16_t *s, int32_t length, UProperty which) const;8182UDataMemory *memory = nullptr;83UCPTrie *cpTrie = nullptr;84const char16_t *stringTries[6] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };85};8687U_NAMESPACE_END8889#endif // __EMOJIPROPS_H__909192