mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
10850c0ec7
refactored the rendering process
46 lines
939 B
C++
46 lines
939 B
C++
#pragma once
|
|
|
|
#include "messages/message.hpp"
|
|
|
|
#include <QRegularExpression>
|
|
|
|
#include <ctime>
|
|
|
|
namespace chatterino {
|
|
namespace messages {
|
|
|
|
class MessageBuilder
|
|
{
|
|
public:
|
|
MessageBuilder();
|
|
|
|
MessagePtr getMessage();
|
|
|
|
void setHighlight(bool value);
|
|
void appendElement(MessageElement *element);
|
|
|
|
// typename std::enable_if<std::is_base_of<MessageElement, T>::value, T>::type
|
|
|
|
template <class T, class... Args>
|
|
T *append(Args &&... args)
|
|
{
|
|
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);
|
|
|
|
QString matchLink(const QString &string);
|
|
|
|
QString originalMessage;
|
|
|
|
protected:
|
|
MessagePtr message;
|
|
};
|
|
|
|
} // namespace messages
|
|
} // namespace chatterino
|