mirror-chatterino2/emojis.h
2017-01-18 21:30:23 +01:00

46 lines
907 B
C++

#ifndef EMOJIS_H
#define EMOJIS_H
#include "concurrentmap.h"
#include "messages/lazyloadedimage.h"
#include <QObject>
#include <QRegularExpression>
#include <QString>
#include <unordered_map>
namespace chatterino {
class Emojis
{
public:
static void parseEmojis(
std::vector<std::tuple<messages::LazyLoadedImage *, QString>> &vector,
const QString &text);
static void loadEmojis();
static QString replaceShortCodes(const QString &text);
struct EmojiData {
QString value;
QString code;
};
private:
static QRegularExpression findShortCodesRegex;
static QMap<QString, EmojiData> shortCodeToEmoji;
static QMap<QString, QString> emojiToShortCode;
static QMap<QChar, QMap<QString, QString>> firstEmojiChars;
static ConcurrentMap<QString, messages::LazyLoadedImage *> imageCache;
Emojis()
{
}
};
}
#endif // EMOJIS_H