summaryrefslogtreecommitdiff
path: root/indra/llui/llemojidictionary.h
diff options
context:
space:
mode:
authorAlexander Gavriliuk <alexandrgproductengine@lindenlab.com>2023-07-06 23:48:06 +0200
committerGuru <alexandrgproductengine@lindenlab.com>2023-07-07 00:22:34 +0200
commit9793308a600c1e1ce35ec727ed6341e7668848ea (patch)
tree17d47429881ed210f341695fb83475a488782170 /indra/llui/llemojidictionary.h
parent4abecaa04bd003136ed027e3892a2ca13d895936 (diff)
SL-19951 Organize emoji categories in groups
Diffstat (limited to 'indra/llui/llemojidictionary.h')
-rw-r--r--indra/llui/llemojidictionary.h78
1 files changed, 48 insertions, 30 deletions
diff --git a/indra/llui/llemojidictionary.h b/indra/llui/llemojidictionary.h
index 1507ebfad3..f6442684a7 100644
--- a/indra/llui/llemojidictionary.h
+++ b/indra/llui/llemojidictionary.h
@@ -36,14 +36,20 @@
struct LLEmojiDescriptor
{
- LLEmojiDescriptor(const LLSD& descriptor_sd);
+ llwchar Character;
+ std::string Category;
+ std::list<std::string> ShortCodes;
+ std::string getShortCodes() const;
+};
- bool isValid() const;
+// ============================================================================
+// LLEmojiGroup class
+//
- std::string Name;
- llwchar Character;
- std::list<std::string> ShortCodes;
- std::list<std::string> Categories;
+struct LLEmojiGroup
+{
+ llwchar Character;
+ std::list<std::string> Categories;
};
// ============================================================================
@@ -52,36 +58,48 @@ struct LLEmojiDescriptor
class LLEmojiDictionary : public LLParamSingleton<LLEmojiDictionary>, public LLInitClass<LLEmojiDictionary>
{
- LLSINGLETON(LLEmojiDictionary);
- ~LLEmojiDictionary() override {};
+ LLSINGLETON(LLEmojiDictionary);
+ ~LLEmojiDictionary() override {};
public:
- typedef std::map<llwchar, const LLEmojiDescriptor*> emoji2descr_map_t;
- typedef emoji2descr_map_t::value_type emoji2descr_item_t;
- typedef std::map<std::string, const LLEmojiDescriptor*> code2descr_map_t;
- typedef code2descr_map_t::value_type code2descr_item_t;
- typedef std::map<std::string, std::vector<const LLEmojiDescriptor*>> cat2descrs_map_t;
- typedef cat2descrs_map_t::value_type cat2descrs_item_t;
-
- static void initClass();
- LLWString findMatchingEmojis(const std::string& needle) const;
- const LLEmojiDescriptor* getDescriptorFromEmoji(llwchar emoji) const;
- const LLEmojiDescriptor* getDescriptorFromShortCode(const std::string& short_code) const;
- std::string getNameFromEmoji(llwchar ch) const;
- bool isEmoji(llwchar ch) const;
-
- const emoji2descr_map_t& getEmoji2Descr() const { return mEmoji2Descr; }
- const code2descr_map_t& getShortCode2Descr() const { return mShortCode2Descr; }
- const cat2descrs_map_t& getCategory2Descrs() const { return mCategory2Descrs; }
+ typedef std::map<std::string, std::string> cat2cat_map_t;
+ typedef std::map<std::string, const LLEmojiGroup*> cat2group_map_t;
+ typedef std::map<llwchar, const LLEmojiDescriptor*> emoji2descr_map_t;
+ typedef std::map<std::string, const LLEmojiDescriptor*> code2descr_map_t;
+ typedef std::map<std::string, std::vector<const LLEmojiDescriptor*>> cat2descrs_map_t;
+
+ static void initClass();
+ LLWString findMatchingEmojis(const std::string& needle) const;
+ const LLEmojiDescriptor* getDescriptorFromEmoji(llwchar emoji) const;
+ const LLEmojiDescriptor* getDescriptorFromShortCode(const std::string& short_code) const;
+ std::string getNameFromEmoji(llwchar ch) const;
+ bool isEmoji(llwchar ch) const;
+
+ const std::vector<LLEmojiGroup>& getGroups() const { return mGroups; }
+ const emoji2descr_map_t& getEmoji2Descr() const { return mEmoji2Descr; }
+ const cat2descrs_map_t& getCategory2Descrs() const { return mCategory2Descrs; }
+ const code2descr_map_t& getShortCode2Descr() const { return mShortCode2Descr; }
private:
- void addEmoji(LLEmojiDescriptor&& descr);
+ void loadTranslations();
+ void loadGroups();
+ void loadEmojis();
+
+ static llwchar loadIcon(const LLSD& sd);
+ static std::list<std::string> loadCategories(const LLSD& sd);
+ static std::list<std::string> loadShortCodes(const LLSD& sd);
+ void translateCategories(std::list<std::string>& categories);
private:
- std::list<LLEmojiDescriptor> mEmojis;
- emoji2descr_map_t mEmoji2Descr;
- code2descr_map_t mShortCode2Descr;
- cat2descrs_map_t mCategory2Descrs;
+ std::vector<LLEmojiGroup> mGroups;
+ std::list<LLEmojiDescriptor> mEmojis;
+ std::list<std::string> mSkipCategories;
+
+ cat2cat_map_t mTranslations;
+ cat2group_map_t mCategory2Group;
+ emoji2descr_map_t mEmoji2Descr;
+ cat2descrs_map_t mCategory2Descrs;
+ code2descr_map_t mShortCode2Descr;
};
// ============================================================================