1 /***************************************************************************
2 wordlist.h - description
4 begin : Don Sep 12 2002
5 copyright : (C) 2002 by Gunnar Schmi Dt
6 email : kmouth@schmi-dt.de
7 ***************************************************************************/
9 /***************************************************************************
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. *
16 ***************************************************************************/
24 #include <qvaluestack.h>
30 class KProgressDialog
;
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
);
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
{
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. */
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. */
82 /** returns a list of words */