Files
qTier/ircmessagetype.hpp
2024-05-27 13:53:31 -05:00

35 lines
809 B
C++

#ifndef IRCMESSAGETYPE_HPP
#define IRCMESSAGETYPE_HPP
#include <QMetaObject>
#include <QMetaType>
class IrcMessageType
{
Q_GADGET
public:
enum MessageType
{
UNKNOWN,
PRIVMSG,
PING
};
Q_ENUM(MessageType);
Q_PROPERTY(MessageType type READ getType)
static IrcMessageType Unknown() { return UNKNOWN; }
constexpr IrcMessageType(MessageType type) : _type(type) { }
IrcMessageType(int type);
IrcMessageType(const IrcMessageType& other);
bool operator ==(const IrcMessageType& other)
{ return this->_type == other._type; }
static IrcMessageType parse(QString str);
MessageType getType() const;
QString toString() const;
private:
const MessageType _type;
};
Q_DECLARE_METATYPE(IrcMessageType)
#endif // IRCMESSAGETYPE_HPP