-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdictloader_edict.h
36 lines (22 loc) · 1.06 KB
/
dictloader_edict.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef DICTLOADER_H
#define DICTLOADER_H
#include <QString>
#include <QHash>
// loads a hashtable from dics in the cc-cedict or handedict format
class DictLoaderEdict
{
public:
// loads the dic from the resources, keys can be traditional or simplified
DictLoaderEdict();
QHash<QString,QString> getDict() const { return charDefSimp;} // hash map containining the char as a key, and the definition as value
QHash<QString, QString> getDictT() const; // traditional of the above
QMultiHash<QChar, QChar> getSTMap() const; // mapping between simplified and traditional chars
QChar s2T(QChar simpChar); // attemps to convert the simplified char to a traditional variant
QChar t2S(QChar tradChar); // as above, but the other way round
private:
QHash<QString,QString> charDefSimp; // simplified definitions
QHash<QString, QString> charDefTrad; // traditional definitions
QMultiHash<QChar, QChar> sTMap;
static void addChar(QHash<QString, QString> * charDefSimp, QString chineseChar, QString definition);
};
#endif // DICTLOADER_H