mirror-chatterino2/emojis.h

40 lines
829 B
C
Raw Normal View History

2017-01-06 23:28:48 +01:00
#ifndef EMOJIS_H
#define EMOJIS_H
#include <QRegularExpression>
#include <QObject>
#include <QString>
2017-01-07 20:43:55 +01:00
#include <unordered_map>
2017-01-06 23:28:48 +01:00
#include "lazyloadedimage.h"
#include "concurrentmap.h"
class Emojis
{
public:
2017-01-07 20:43:55 +01:00
static void parseEmojis(std::vector<std::tuple<LazyLoadedImage*, QString>>& vector, const QString& text);
2017-01-06 23:28:48 +01:00
static void initEmojis();
2017-01-07 20:43:55 +01:00
static QString replaceShortCodes(const QString& text);
struct EmojiData {
QString value;
QString code;
};
2017-01-06 23:28:48 +01:00
private:
2017-01-07 20:43:55 +01:00
2017-01-06 23:28:48 +01:00
static QRegularExpression* findShortCodesRegex;
2017-01-07 20:43:55 +01:00
static QMap<QString, EmojiData>* shortCodeToEmoji;
2017-01-06 23:28:48 +01:00
static QMap<QString, QString>* emojiToShortCode;
2017-01-07 20:43:55 +01:00
static QMap<QChar, QMap<QString, QString>>* firstEmojiChars;
static ConcurrentMap<QString, LazyLoadedImage*>* imageCache;
2017-01-06 23:28:48 +01:00
Emojis() {}
};
#endif // EMOJIS_H