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 _BLOCKFILTER_H_ 00012 #define _BLOCKFILTER_H_ 00013 00014 #include <qregexp.h> 00015 00016 #include "Filter.h" 00017 #include "InputFilter.h" 00018 00023 class BlockFilter : public Filter { 00024 00025 public: 00026 00027 typedef enum { 00028 BEGIN, 00029 IN 00030 } Position; 00031 00032 BlockFilter(const QString & name, MtpContext * ctxt); 00033 ~BlockFilter(); 00034 00035 void setInputDependency(InputFilter *); 00036 InputFilter * getInputDependency(); 00037 00038 void setBeginRegExp(const QString& reg); 00039 void setEndRegExp(const QString& reg); 00040 void setResultPattern(const QString& pat); 00041 00042 QString getBeginRegExp() const; 00043 QString getEndRegExp() const; 00044 QString getResultPattern() const; 00045 00046 bool applyTo(QString &, Position pos = IN); 00047 bool isFinished() const; 00048 00049 private: 00050 InputFilter * dependency; 00051 bool finished; 00052 MtpRegExp beg_reg,end_reg; 00053 MtpContext * m_context; 00054 QString pattern,begin,end; 00055 }; 00056 00057 #endif