Clean and order documentation in source files. Source ready to beta 2 release
[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     \brief Implementation of stardict plugin's translation.
24
25     \author Mateusz Półrola <mateusz.polrola@comarch.pl>
26  */
27
28 #ifndef TRANSLATIONSTARDICT_H
29 #define TRANSLATIONSTARDICT_H
30
31 #include <QString>
32 #include <QHash>
33 #include <QDebug>
34 #include <QTranslator>
35 #include <QCoreApplication>
36 #include <QThread>
37 #include <QSet>
38
39 #include "StarDictReaderFactory.h"
40 #include "../../include/translation.h"
41 #include "StarDictPlugin.h"
42 #include "../../include/Notify.h"
43 #include "TranslationStarDict.h"
44
45 class TranslationStarDict : public Translation
46 {
47 public:
48     TranslationStarDict();
49     TranslationStarDict(QString _key,
50                     QString _dictionaryInfo,
51                     StarDictPlugin *starDictPlugin);
52     TranslationStarDict(const TranslationStarDict &base);
53
54     //! \return word to be translated
55     QString key() const;
56
57     //! \return parsed raw format into xml
58     QString toXml() const;
59
60     /*!
61         sets the word for which we want to find a translation
62         \param word for which we want to find a translation
63     */
64     void setKey(QString);
65
66     //! sets information about dictionary
67     void setDictionaryInfo(QString);
68
69     //! \return whether given translation is taken from bookmarks
70     int isBookmark() const {
71         return _bookmark;
72    }
73
74     //! returns corresponding dict object
75     uint dict() const {return _dictHash;}
76
77     /*!
78         Add another hit in *.id(x) file
79         \param offset offset from begining of file to searched keyword
80         \param len lenght of searched keyword
81     */
82     void add(qint64 offset, qint32 len);
83
84     bool operator==(const TranslationStarDict &key) {
85         if (this->key() == key.key())
86             return true;
87         return false;
88     }
89
90 private:
91     QString _key;
92     QString _dictionaryInfo;
93     StarDictPlugin *starDictPlugin;
94     int _dictHash;
95     QVector<qint64> offsets;
96     QVector<qint32> lengths;
97 };
98
99
100 #endif // TRANSLATIONSTARDICT_H
101