Fix include
[kdeaccessibility.git] / kttsd / filters / stringreplacer / stringreplacerproc.h
blobf263df88d9cfc8f2defd0d3ada2c6a1e66bcbfa9
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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 ******************************************************************************/
25 #ifndef _STRINGREPLACERPROC_H_
26 #define _STRINGREPLACERPROC_H_
28 // Qt includes.
29 #include <QObject>
30 #include <QTextStream>
31 #include <QRegExp>
32 #include <QList>
34 // KTTS includes.
35 #include "filterproc.h"
37 class StringReplacerProc : virtual public KttsFilterProc
39 Q_OBJECT
41 public:
42 /**
43 * Constructor.
45 StringReplacerProc( QObject *parent, const QStringList &args = QStringList() );
47 /**
48 * Destructor.
50 virtual ~StringReplacerProc();
52 /**
53 * Initialize the filter.
54 * @param config Settings object.
55 * @param configGroup Settings Group.
56 * @return False if filter is not ready to filter.
58 * Note: The parameters are for reading from kttsdrc file. Plugins may wish to maintain
59 * separate configuration files of their own.
61 virtual bool init(KConfig *config, const QString &configGroup);
63 /**
64 * Convert input, returning output.
65 * @param inputText Input text.
66 * @param talkerCode TalkerCode structure for the talker that KTTSD intends to
67 * use for synthing the text. Useful for extracting hints about
68 * how to filter the text. For example, languageCode.
69 * @param appId The DCOP appId of the application that queued the text.
70 * Also useful for hints about how to do the filtering.
72 virtual QString convert(const QString& inputText, TalkerCode* talkerCode, const QString& appId);
74 /**
75 * Did this filter do anything? If the filter returns the input as output
76 * unmolested, it should return False when this method is called.
78 virtual bool wasModified();
80 private:
81 // Language codes supported by the filter.
82 QStringList m_languageCodeList;
83 // If not empty, apply filter only to apps containing one or more of these strings.
84 QStringList m_appIdList;
86 // List of regular expressions to match.
87 QList<QRegExp> m_matchList;
88 // List of substitutions to replace matches.
89 QList<QString> m_substList;
90 // True if this filter did anything to the text.
91 bool m_wasModified;
94 #endif // _STRINGREPLACERPROC_H_