A few new icons...
[kdeaccessibility.git] / kmouth / wordcompletion / wordlist.h
blobd2f85ac0c0cae327702416a44f213d4d32a48a10
1 /***************************************************************************
2 wordlist.h - description
3 -------------------
4 begin : Don Sep 12 2002
5 copyright : (C) 2002 by Gunnar Schmi Dt
6 email : kmouth@schmi-dt.de
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 // $Id$
20 #ifndef WORDLIST_H
21 #define WORDLIST_H
23 #include <qxml.h>
24 #include <qvaluestack.h>
25 #include <qstring.h>
26 #include <qobject.h>
27 #include <qmap.h>
29 class QTextCodec;
30 class KProgressDialog;
32 namespace WordList {
34 typedef QMap<QString,int> WordMap;
36 KProgressDialog *progressDialog();
38 WordMap parseKDEDoc (QString language, KProgressDialog *pdlg);
39 WordMap parseFile (QString filename, QTextStream::Encoding encoding, QTextCodec *codec, KProgressDialog *pdlg);
40 WordMap parseDir (QString directory, QTextStream::Encoding encoding, QTextCodec *codec, KProgressDialog *pdlg);
41 WordMap mergeFiles (QMap<QString,int> files, KProgressDialog *pdlg);
43 WordMap spellCheck (WordMap wordlist, QString dictionary, KProgressDialog *pdlg);
45 bool saveWordList (WordMap map, QString filename);
47 /**
48 * This class implements a parser for reading docbooks and generating word
49 * lists. It is intended to be used together with the Qt SAX2 framework.
50 * @author Gunnar Schmi Dt
53 class XMLParser : public QXmlDefaultHandler {
54 public:
55 XMLParser();
56 ~XMLParser();
58 bool warning (const QXmlParseException &exception);
59 bool error (const QXmlParseException &exception);
60 bool fatalError (const QXmlParseException &exception);
61 QString errorString();
63 /** Processes the start of the document. */
64 bool startDocument();
66 /** Processes the start tag of an element. */
67 bool startElement (const QString &, const QString &, const QString &name,
68 const QXmlAttributes &attributes);
70 /** Processes a chunk of normal character data. */
71 bool characters (const QString &ch);
73 /** Processes whitespace. */
74 bool ignorableWhitespace (const QString &ch);
76 /** Processes the end tag of an element. */
77 bool endElement (const QString &, const QString &, const QString &name);
79 /** Processes the end of the document. */
80 bool endDocument();
82 /** returns a list of words */
83 WordMap getList();
85 private:
86 WordMap list;
87 QString text;
92 #endif