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 #include "LineFilter.h" 00012 00013 00014 LineFilter::LineFilter(const QString & name, MtpContext * ctxt) : Filter(name,ctxt) { 00015 m_context = ctxt; 00016 } 00017 00018 00019 LineFilter::~LineFilter() {} 00020 00021 bool LineFilter::applyTo(QString & msg) { 00022 MtpRegExp re(reg); 00023 bool match = re.exactMatch(msg); 00024 00025 if (match) 00026 setResult(applyProcessedRegexpToPattern(re,pattern)); 00027 00028 return match; 00029 } 00030 00031 void LineFilter::setRegExp(const QString& reg) { 00032 sreg = reg; 00033 this->reg = MtpRegExp(reg,m_context); 00034 } 00035 00036 void LineFilter::setResultPattern(const QString& pat) { 00037 this->pattern = pat; 00038 } 00039 00040 QString LineFilter::getRegExp() const { 00041 return sreg; 00042 } 00043 00044 QString LineFilter::getResultPattern() const { 00045 return pattern; 00046 }