mirror-chatterino2/src/messages/search/MessageFlagsPredicate.hpp
nerix 1043f9f803
Remove Unnecessary Includes in Headers (#4275)
* refactor: remove unnecessary includes in headers

* fix: formatting

* chore: changelog

* fix: scrollbar

* fix: suggestions and old appbase remains

* fix: suggestion

* fix: missing Qt forward declarations

* fix: another qt include

* fix: includes for precompiled-headers=off

* Add missing `<memory>` includes

* Add missing `#pragma once`

* Fix tests

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
2022-12-31 14:41:01 +00:00

51 lines
1.6 KiB
C++

#pragma once
#include "common/FlagsEnum.hpp"
#include "messages/Message.hpp"
#include "messages/search/MessagePredicate.hpp"
namespace chatterino {
using MessageFlags = FlagsEnum<MessageFlag>;
/**
* @brief MessagePredicate checking for message flags.
*
* This predicate will only allow messages with a list of flags.
* Specified by user-friendly names for the flags.
*/
class MessageFlagsPredicate : public MessagePredicate
{
public:
/**
* @brief Create a MessageFlagsPredicate with a list of flags to search for.
*
* The flags can be specified by user-friendly names.
* "deleted" and "disabled" are used for the "Disabled" flag.
* "sub" and "subscription" are used for the "Subscription" flag.
* "timeout" is used for the "Timeout" flag.
* "highlighted" is used for the "Highlighted" flag.
* "system" is used for the "System" flag.
*
* @param flags a string comma seperated list of names for the flags a message should have
* @param negate when set, excludes messages containg selected flags from results
*/
MessageFlagsPredicate(const QString &flags, bool negate);
protected:
/**
* @brief Checks whether the message has any of the flags passed
* in the constructor.
*
* @param message the message to check
* @return true if the message has at least one of the specified flags,
* false otherwise
*/
bool appliesToImpl(const Message &message) override;
private:
/// Holds the flags that will be searched for
MessageFlags flags_;
};
} // namespace chatterino