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
|
|
|
|
2018-01-28 03:29:42 +01:00
|
|
|
struct MessageBuilder
|
2017-04-12 17:46:44 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
MessageBuilder();
|
|
|
|
|
2018-01-11 20:16:25 +01:00
|
|
|
MessagePtr getMessage();
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-09-24 18:43:24 +02:00
|
|
|
void setHighlight(bool value);
|
2018-01-11 20:16:25 +01:00
|
|
|
void appendElement(MessageElement *element);
|
|
|
|
|
|
|
|
// typename std::enable_if<std::is_base_of<MessageElement, T>::value, T>::type
|
|
|
|
|
|
|
|
template <class T, class... Args>
|
2018-01-22 14:39:24 +01:00
|
|
|
T *emplace(Args &&... args)
|
2018-01-11 20:16:25 +01:00
|
|
|
{
|
|
|
|
static_assert(std::is_base_of<MessageElement, T>::value, "T must extend MessageElement");
|
|
|
|
|
|
|
|
T *element = new T(std::forward<Args>(args)...);
|
|
|
|
this->appendElement(element);
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
|
|
|
void appendTimestamp();
|
|
|
|
void appendTimestamp(const QTime &time);
|
2017-04-12 17:46:44 +02:00
|
|
|
|
|
|
|
QString matchLink(const QString &string);
|
|
|
|
|
2017-06-06 21:18:05 +02:00
|
|
|
QString originalMessage;
|
|
|
|
|
2017-12-17 17:48:46 +01:00
|
|
|
protected:
|
2018-01-11 20:16:25 +01:00
|
|
|
MessagePtr message;
|
2017-04-12 17:46:44 +02:00
|
|
|
};
|
|
|
|
|
2017-06-06 21:18:05 +02:00
|
|
|
} // namespace messages
|
|
|
|
} // namespace chatterino
|