27 lines
718 B
C++
27 lines
718 B
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
#include "message.h"
|
|
|
|
//ideen: nach sender filtern, nur nachrichten mit medien, nur nachrichten ohne medien, medien Dateinamen, nach datum filtern, service messages? (joined, kicked, invited,...), inverted (not conatain)
|
|
|
|
struct Filter {
|
|
virtual ~Filter() {}
|
|
virtual void setup(std::ostream& o, std::istream& str);
|
|
virtual bool filter(const Message& m) const = 0;
|
|
protected:
|
|
bool ignoreCase;
|
|
};
|
|
|
|
inline void resetStream(std::istream& i = std::cin) {
|
|
i.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
|
}
|
|
|
|
constexpr bool isLetter(char in, char compare) {
|
|
return in == compare || in == std::toupper(compare);
|
|
}
|
|
|
|
constexpr bool isYes(char c) {
|
|
return isLetter(c, 'y');
|
|
}
|