mirror-chatterino2/src/emojis.h

44 lines
903 B
C
Raw Normal View History

#pragma once
2017-01-06 23:28:48 +01:00
2017-01-18 04:52:47 +01:00
#include "concurrentmap.h"
2017-01-18 21:30:23 +01:00
#include "messages/lazyloadedimage.h"
2017-01-18 04:52:47 +01:00
2017-01-06 23:28:48 +01:00
#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-04-14 17:52:22 +02:00
namespace chatterino {
2017-01-18 21:30:23 +01:00
2017-01-06 23:28:48 +01:00
class Emojis
{
public:
2017-04-12 17:46:44 +02:00
static void parseEmojis(std::vector<std::tuple<messages::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-18 04:33:30 +01:00
static QRegularExpression findShortCodesRegex;
2017-01-07 20:43:55 +01:00
2017-01-18 04:33:30 +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-18 21:30:23 +01:00
static ConcurrentMap<QString, messages::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
};
} // namespace chatterino