1 #ifndef CARDFILTER_H 2 #define CARDFILTER_H 3 4 #include <QObject> 5 #include <QString> 6 #include <utility> 7 8 class CardFilter : public QObject 9 { 10 Q_OBJECT 11 12 public: 13 enum Type 14 { 15 TypeAnd = 0, 16 TypeOr, 17 TypeAndNot, 18 TypeOrNot, 19 TypeEnd 20 }; 21 22 /* if you add an attribute here you also need to 23 * add its string representation in attrName */ 24 enum Attr 25 { 26 AttrCmc = 0, 27 AttrColor, 28 AttrLoyalty, 29 AttrManaCost, 30 AttrName, 31 AttrPow, 32 AttrRarity, 33 AttrSet, 34 AttrText, 35 AttrTough, 36 AttrType, 37 AttrFormat, 38 AttrEnd 39 }; 40 41 private: 42 QString trm; 43 enum Type t; 44 enum Attr a; 45 46 public: CardFilter(QString & term,Type type,Attr attr)47 CardFilter(QString &term, Type type, Attr attr) : trm(term), t(type), a(attr){}; 48 type()49 Type type() const 50 { 51 return t; 52 } term()53 const QString &term() const 54 { 55 return trm; 56 } attr()57 Attr attr() const 58 { 59 return a; 60 } 61 62 static const QString typeName(Type t); 63 static const QString attrName(Attr a); 64 }; 65 66 #endif 67