1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2007 Daniel Laidig <d.laidig@gmx.de> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef KCHARSELECTDATA_H |
9 | #define KCHARSELECTDATA_H |
10 | |
11 | #include <QChar> |
12 | #include <QFont> |
13 | #include <QFuture> |
14 | #include <QList> |
15 | #include <QString> |
16 | #include <QStringList> |
17 | |
18 | // Internal class used by KCharSelect |
19 | |
20 | typedef QMap<QString, QList<quint16>> Index; |
21 | |
22 | class KCharSelectData |
23 | { |
24 | public: |
25 | QString formatCode(uint code, int length = 4, const QString &prefix = QStringLiteral("U+" ), int base = 16); |
26 | |
27 | QList<uint> blockContents(int block); |
28 | QList<int> sectionContents(int section); |
29 | |
30 | QStringList sectionList(); |
31 | |
32 | QString block(uint c); |
33 | QString section(uint c); |
34 | QString name(uint c); |
35 | |
36 | int blockIndex(uint c); |
37 | int sectionIndex(int block); |
38 | |
39 | QString blockName(int index); |
40 | QString sectionName(int index); |
41 | |
42 | QStringList aliases(uint c); |
43 | QStringList notes(uint c); |
44 | QList<uint> seeAlso(uint c); |
45 | QStringList equivalents(uint c); |
46 | QStringList approximateEquivalents(uint c); |
47 | QList<uint> decomposition(uint c); |
48 | |
49 | QStringList unihanInfo(uint c); |
50 | |
51 | QChar::Category category(uint c); |
52 | bool isPrint(uint c); |
53 | bool isDisplayable(uint c); |
54 | bool isIgnorable(uint c); |
55 | bool isCombining(uint c); |
56 | QString display(uint c, const QFont &font); |
57 | QString displayCombining(uint c); |
58 | |
59 | QString categoryText(QChar::Category category); |
60 | |
61 | QList<uint> find(const QString &s); |
62 | |
63 | private: |
64 | bool openDataFile(); |
65 | quint32 getDetailIndex(uint c) const; |
66 | QSet<uint> getMatchingChars(const QString &s); |
67 | |
68 | QStringList splitString(const QString &s); |
69 | void appendToIndex(Index *index, quint16 unicode, const QString &s); |
70 | Index createIndex(const QByteArray &dataFile); |
71 | |
72 | quint16 mapCodePointToDataBase(uint code) const; |
73 | uint mapDataBaseToCodePoint(quint16 code) const; |
74 | |
75 | QByteArray dataFile; |
76 | QFuture<Index> futureIndex; |
77 | int remapType; |
78 | friend class RunIndexCreation; |
79 | }; |
80 | |
81 | #endif /* #ifndef KCHARSELECTDATA_H */ |
82 | |