fix small bug(wildcard), and change some comments
[mdictionary] / src / plugins / stardict / TranslationStarDict.h
1 /*******************************************************************************
2
3     This file is part of mDictionary.
4
5     mDictionary is free software: you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation, either version 3 of the License, or
8     (at your option) any later version.
9
10     mDictionary is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
17
18     Copyright 2010 Comarch S.A.
19
20 *******************************************************************************/
21 /*!
22     \file TranslationStarDict.h
23     \author Mateusz Półrola <mateusz.polrola@comarch.pl>
24  */
25
26 #ifndef TRANSLATIONSTARDICT_H
27 #define TRANSLATIONSTARDICT_H
28
29 #include <QString>
30 #include <QHash>
31 #include <QDebug>
32 #include <QTranslator>
33 #include <QCoreApplication>
34 #include <QThread>
35 #include <QSet>
36
37 #include "StarDictReaderFactory.h"
38 #include "../../include/translation.h"
39 #include "StarDictPlugin.h"
40 #include "../../include/Notify.h"
41 #include "TranslationStarDict.h"
42
43 class TranslationStarDict : public Translation
44 {
45 public:
46     TranslationStarDict();
47     TranslationStarDict(QString _key,
48                     QString _dictionaryInfo,
49                     StarDictPlugin *starDictPlugin);
50     TranslationStarDict(const TranslationStarDict &base);
51
52     //! \return word to be translated
53     QString key() const;
54
55     //! \return parsed raw format into xml
56     QString toXml() const;
57
58     /*!
59         sets the word for which we want to find a translation
60         \param word for which we want to find a translation
61     */
62     void setKey(QString);
63
64     //! sets information about dictionary
65     void setDictionaryInfo(QString);
66
67     //! \return whether given translation is taken from bookmarks
68     int isBookmark() const {
69         return _bookmark;
70    }
71
72     //! returns corresponding dict object
73     uint dict() const {return _dictHash;}
74
75     /*!
76         Add another hit in *.id(x) file
77         \param offset offset from begining of file to searched keyword
78         \param len lenght of searched keyword
79     */
80     void add(qint64 offset, qint32 len);
81
82     bool operator==(const TranslationStarDict &key) {
83         if (this->key() == key.key())
84             return true;
85         return false;
86     }
87
88 private:
89     QString _key;
90     QString _dictionaryInfo;
91     StarDictPlugin *starDictPlugin;
92     int _dictHash;
93     QVector<qint64> offsets;
94     QVector<qint32> lengths;
95 };
96
97
98 #endif // TRANSLATIONSTARDICT_H
99