Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

InputFilter.cpp

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

Generated on Sat May 10 15:09:26 2003 for qnet by doxygen1.3