2022-10-01 14:30:29 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "messages/search/MessagePredicate.hpp"
|
|
|
|
|
2022-12-31 15:41:01 +01:00
|
|
|
#include <QString>
|
|
|
|
#include <QStringList>
|
|
|
|
|
2022-10-01 14:30:29 +02:00
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief MessagePredicate checking for the badges of a message.
|
|
|
|
*
|
|
|
|
* This predicate will only allow messages that are sent by a subscribed user
|
|
|
|
* who has a specified subtier (i.e. 1,2,3..)
|
|
|
|
*/
|
|
|
|
class SubtierPredicate : public MessagePredicate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @brief Create an SubtierPredicate with a list of subtiers to search for.
|
|
|
|
*
|
2022-12-04 12:34:13 +01:00
|
|
|
* @param subtiers one or more comma-separated subtiers that the message should contain
|
|
|
|
* @param negate when set, excludes messages containing selected subtiers from results
|
2022-10-01 14:30:29 +02:00
|
|
|
*/
|
2022-12-04 12:34:13 +01:00
|
|
|
SubtierPredicate(const QString &subtiers, bool negate);
|
2022-10-01 14:30:29 +02:00
|
|
|
|
2022-12-04 12:34:13 +01:00
|
|
|
protected:
|
2022-10-01 14:30:29 +02:00
|
|
|
/**
|
|
|
|
* @brief Checks whether the message contains any of the subtiers passed
|
|
|
|
* in the constructor.
|
|
|
|
*
|
|
|
|
* @param message the message to check
|
|
|
|
* @return true if the message contains a subtier listed in the specified subtiers,
|
|
|
|
* false otherwise
|
|
|
|
*/
|
2022-12-04 12:34:13 +01:00
|
|
|
bool appliesToImpl(const Message &message) override;
|
2022-10-01 14:30:29 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
/// Holds the subtiers that will be searched for
|
|
|
|
QStringList subtiers_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|