summaryrefslogtreecommitdiff
path: root/indra/llui/llemojidictionary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llemojidictionary.cpp')
-rw-r--r--indra/llui/llemojidictionary.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/indra/llui/llemojidictionary.cpp b/indra/llui/llemojidictionary.cpp
index eefa4047a2..c31638b0bf 100644
--- a/indra/llui/llemojidictionary.cpp
+++ b/indra/llui/llemojidictionary.cpp
@@ -175,17 +175,26 @@ LLWString LLEmojiDictionary::findMatchingEmojis(const std::string& needle) const
return result;
}
-std::string LLEmojiDictionary::getNameFromEmoji(llwchar ch)
+const LLEmojiDescriptor* LLEmojiDictionary::getDescriptorFromShortCode(const std::string& short_code) const
+{
+ const auto it = mShortCode2Descr.find(short_code);
+ return (mShortCode2Descr.end() != it) ? &it->second : nullptr;
+}
+
+std::string LLEmojiDictionary::getNameFromEmoji(llwchar ch) const
{
const auto it = mEmoji2Descr.find(ch);
- return (mEmoji2Descr.end() != it) ? it->second->Name : LLStringUtil::null;
+ return (mEmoji2Descr.end() != it) ? it->second.Name : LLStringUtil::null;
}
void LLEmojiDictionary::addEmoji(LLEmojiDescriptor&& descr)
{
mEmojis.push_back(descr);
- const LLEmojiDescriptor& back = mEmojis.back();
- mEmoji2Descr.insert(std::make_pair(descr.Character, &back));
+ mEmoji2Descr.insert(std::make_pair(descr.Character, mEmojis.back()));
+ for (const std::string& shortCode : descr.ShortCodes)
+ {
+ mShortCode2Descr.insert(std::make_pair(shortCode, mEmojis.back()));
+ }
}
// ============================================================================