mirror-chatterino2/emojis.h

43 lines
857 B
C
Raw Normal View History

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