00001 /*************************************************************************** 00002 * Copyright (C) 2002 by Yann Hodique * 00003 * Yann.Hodique@lifl.fr * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 ***************************************************************************/ 00010 00011 #ifndef _FILTER_H_ 00012 #define _FILTER_H_ 00013 00014 #include <qstring.h> 00015 #include "MtpRegExp.h" 00016 #include "MtpContext.h" 00017 00023 class Filter { 00024 00025 public: 00026 typedef enum { 00027 Transient = 0, 00028 Final = 1 00029 } Policy; 00030 00031 Filter(const QString & name, MtpContext * ctxt = 0); 00032 virtual ~Filter(); 00033 00034 virtual bool applyTo(QString &) {return false;}; 00035 00036 void setPolicy(Policy p); 00037 Policy policy() const; 00038 00039 bool isEnabled() const; 00040 void setEnabled(bool); 00041 void enable(); 00042 void disable(); 00043 00044 QString getName() const; 00045 QString getResult() const; 00046 void setResult(const QString&); 00047 00048 QString applyProcessedRegexpToPattern(MtpRegExp &, const QString &); 00049 00050 private: 00051 QString name; 00052 QString result; 00053 Policy pol; 00054 bool active; 00055 MtpContext * m_context; 00056 00057 }; 00058 00059 #endif