mirror-chatterino2/src/messages/messagebuilder.hpp

40 lines
736 B
C++
Raw Normal View History

2017-06-06 21:18:05 +02:00
#pragma once
2017-04-12 17:46:44 +02:00
2017-06-11 09:31:45 +02:00
#include "messages/message.hpp"
2017-06-06 21:18:05 +02:00
2017-07-26 09:08:19 +02:00
#include <QRegularExpression>
2017-04-12 17:46:44 +02:00
2017-07-31 00:57:42 +02:00
#include <ctime>
2017-04-14 17:52:22 +02:00
namespace chatterino {
namespace messages {
2017-04-12 17:46:44 +02:00
class MessageBuilder
{
public:
MessageBuilder();
SharedMessage getMessage();
2017-04-12 17:46:44 +02:00
2017-09-12 19:06:16 +02:00
void appendWord(const Word &&word);
2017-04-12 17:46:44 +02:00
void appendTimestamp();
void appendTimestamp(QDateTime &time);
2017-09-24 18:43:24 +02:00
void setHighlight(bool value);
2017-04-12 17:46:44 +02:00
QString matchLink(const QString &string);
2017-08-05 18:44:14 +02:00
QRegularExpression linkRegex;
2017-04-12 17:46:44 +02:00
2017-06-06 21:18:05 +02:00
QString originalMessage;
2017-12-17 17:48:46 +01:00
protected:
2017-09-12 19:06:16 +02:00
std::shared_ptr<messages::Message> message;
2017-12-17 17:48:46 +01:00
private:
2017-04-12 17:46:44 +02:00
std::vector<Word> _words;
bool highlight = false;
2017-04-12 17:46:44 +02:00
std::chrono::time_point<std::chrono::system_clock> _parseTime;
};
2017-06-06 21:18:05 +02:00
} // namespace messages
} // namespace chatterino