Warning--
[kdeaccessibility.git] / kttsd / filters / stringreplacer / stringreplacerproc.h
blob66af42b7c99ea3b777d3678070e5867a88226516
1 /***************************************************** vim:set ts=4 sw=4 sts=4:
2 Generic String Replacement Filter Processing class.
3 This is the interface definition for text filters.
4 -------------------
5 Copyright:
6 (C) 2005 by Gary Cramblitt <garycramblitt@comcast.net>
7 -------------------
8 Original author: Gary Cramblitt <garycramblitt@comcast.net>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.
23 ******************************************************************************/
25 #ifndef _STRINGREPLACERPROC_H_
26 #define _STRINGREPLACERPROC_H_
28 // Qt includes.
29 #include <qobject.h>
30 #include <qtextstream.h>
31 #include <q3valuelist.h>
32 #include <qregexp.h>
33 #include <qstringlist.h>
34 //Added by qt3to4:
35 #include <Q3CString>
37 // KTTS includes.
38 #include "filterproc.h"
40 class StringReplacerProc : virtual public KttsFilterProc
42 Q_OBJECT
44 public:
45 /**
46 * Constructor.
48 StringReplacerProc( QObject *parent, const char *name, const QStringList &args = QStringList() );
50 /**
51 * Destructor.
53 virtual ~StringReplacerProc();
55 /**
56 * Initialize the filter.
57 * @param config Settings object.
58 * @param configGroup Settings Group.
59 * @return False if filter is not ready to filter.
61 * Note: The parameters are for reading from kttsdrc file. Plugins may wish to maintain
62 * separate configuration files of their own.
64 virtual bool init(KConfig *config, const QString &configGroup);
66 /**
67 * Convert input, returning output.
68 * @param inputText Input text.
69 * @param talkerCode TalkerCode structure for the talker that KTTSD intends to
70 * use for synthing the text. Useful for extracting hints about
71 * how to filter the text. For example, languageCode.
72 * @param appId The DCOP appId of the application that queued the text.
73 * Also useful for hints about how to do the filtering.
75 virtual QString convert(const QString& inputText, TalkerCode* talkerCode, const Q3CString& appId);
77 /**
78 * Did this filter do anything? If the filter returns the input as output
79 * unmolested, it should return False when this method is called.
81 virtual bool wasModified();
83 private:
84 // Language codes supported by the filter.
85 QStringList m_languageCodeList;
86 // If not empty, apply filter only to apps containing one or more of these strings.
87 QStringList m_appIdList;
89 // List of regular expressions to match.
90 Q3ValueList<QRegExp> m_matchList;
91 // List of substitutions to replace matches.
92 Q3ValueList<QString> m_substList;
93 // True if this filter did anything to the text.
94 bool m_wasModified;
97 #endif // _STRINGREPLACERPROC_H_