File indexing completed on 2024-04-28 03:40:32
0001 /*************************************************************************** 0002 * Copyright (C) 2002 by Gunnar Schmi Dt <kmouth@schmi-dt.de * 0003 * (C) 2015 by Jeremy Whiting <jpwhiting@kde.org> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 0019 ***************************************************************************/ 0020 0021 #ifndef WORDLIST_H 0022 #define WORDLIST_H 0023 0024 #include <QMap> 0025 #include <QStringConverter> 0026 #include <QXmlStreamReader> 0027 0028 class QProgressDialog; 0029 0030 namespace WordList 0031 { 0032 0033 typedef QMap<QString, int> WordMap; 0034 0035 QProgressDialog *progressDialog(); 0036 0037 WordMap parseKDEDoc(QString language, QProgressDialog *pdlg); 0038 WordMap parseFile(const QString &filename, QStringConverter::Encoding encoding, QProgressDialog *pdlg); 0039 WordMap parseDir(const QString &directory, QStringConverter::Encoding encoding, QProgressDialog *pdlg); 0040 WordMap mergeFiles(const QMap<QString, int> &files, QProgressDialog *pdlg); 0041 0042 WordMap spellCheck(WordMap wordlist, const QString &dictionary, QProgressDialog *pdlg); 0043 0044 bool saveWordList(const WordMap &map, const QString &filename); 0045 0046 /** 0047 * This class implements a parser for reading docbooks and generating word 0048 * lists. 0049 */ 0050 0051 class XMLReader 0052 { 0053 public: 0054 XMLReader(); 0055 ~XMLReader(); 0056 0057 bool read(QIODevice *device); 0058 0059 QString errorString() const; 0060 0061 /** returns a list of words */ 0062 WordMap getList(); 0063 0064 private: 0065 WordMap list; 0066 QString text; 0067 0068 QXmlStreamReader xml; 0069 }; 0070 0071 } 0072 0073 #endif