File: kcharselectdata_p.h

package info (click to toggle)
kwidgetsaddons 5.28.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 62,388 kB
  • ctags: 3,611
  • sloc: cpp: 26,647; python: 682; sh: 23; makefile: 6
file content (93 lines) | stat: -rw-r--r-- 2,762 bytes parent folder | download
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* This file is part of the KDE libraries

   Copyright (C) 2007 Daniel Laidig <d.laidig@gmx.de>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef KCHARSELECTDATA_H
#define KCHARSELECTDATA_H

#include <QtCore/QChar>
#include <QtCore/QVector>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QFuture>
#include <QFont>

// Internal class used by KCharSelect

typedef QMap<QString, QVector<quint16> > Index;

class KCharSelectData
{
public:
    QString formatCode(uint code, int length = 4, const QString &prefix = QStringLiteral("U+"), int base = 16);

    QVector<uint> blockContents(int block);
    QVector<int> sectionContents(int section);

    QStringList sectionList();

    QString block(uint c);
    QString section(uint c);
    QString name(uint c);

    int blockIndex(uint c);
    int sectionIndex(int block);

    QString blockName(int index);
    QString sectionName(int index);

    QStringList aliases(uint c);
    QStringList notes(uint c);
    QVector<uint> seeAlso(uint c);
    QStringList equivalents(uint c);
    QStringList approximateEquivalents(uint c);

    QStringList unihanInfo(uint c);

    QChar::Category category(uint c);
    bool isPrint(uint c);
    bool isDisplayable(uint c);
    bool isIgnorable(uint c);
    bool isCombining(uint c);
    QString display(uint c, const QFont &font);
    QString displayCombining(uint c);

    QString categoryText(QChar::Category category);

    QVector<uint> find(const QString &s);

private:
    bool openDataFile();
    quint32 getDetailIndex(uint c) const;
    QSet<uint> getMatchingChars(const QString &s);

    QStringList splitString(const QString &s);
    void appendToIndex(Index *index, quint16 unicode, const QString &s);
    Index createIndex(const QByteArray &dataFile);

    quint16 mapCodePointToDataBase(uint code) const;
    uint mapDataBaseToCodePoint(quint16 code) const;

    QByteArray dataFile;
    QFuture<Index> futureIndex;
    int remapType;
    friend class RunIndexCreation;
};

#endif  /* #ifndef KCHARSELECTDATA_H */