2020-08-04 13:15:02 +08:00
|
|
|
#include "EmojiParser.h"
|
|
|
|
|
|
|
|
EmojiParser* EmojiParser::_inst = new EmojiParser();
|
|
|
|
|
|
|
|
EmojiParser::EmojiParser()
|
|
|
|
{
|
|
|
|
std::vector<std::string> tags({ "88","am","bs","bz","ch","cool","dhq","dn","fd","gz","han","hx","hxiao","hxiu" });
|
|
|
|
|
2022-07-21 19:19:08 +08:00
|
|
|
for (auto&& str : tags)
|
2020-08-04 13:15:02 +08:00
|
|
|
_handlers[":" + str] = UBB_TAG_HANDLER(EmojiParser::onTag_Emoji, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EmojiParser::onTag_Emoji(const std::string & tagName, bool end, const std::string & attr, std::string & replacement)
|
|
|
|
{
|
|
|
|
std::string str = tagName.substr(1);
|
|
|
|
transform(str.begin(), str.end(), str.begin(), ::tolower);
|
|
|
|
replacement = "<img src='ui://Emoji/" + str + "'/>";
|
|
|
|
}
|