Krita Source Code Documentation
Loading...
Searching...
No Matches
KoUnicodeBlockData.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6#ifndef KOUNICODEBLOCKDATA_H
7#define KOUNICODEBLOCKDATA_H
8
9#include <QString>
10#include <QChar>
11#include <QScopedPointer>
12#include "kritaflake_export.h"
13
14#include <boost/operators.hpp>
15#include <klocalizedstring.h>
16
17struct KRITAFLAKE_EXPORT KoUnicodeBlockData : public boost::equality_comparable<KoUnicodeBlockData> {
18 KoUnicodeBlockData(QString name, uint start, uint end)
19 : name(name)
20 , start(start)
21 , end(end) {}
22 QString name;
25
26 bool operator==(const KoUnicodeBlockData &rhs) const {
27 return (start == rhs.start && end == rhs.end);
28 }
29
30 bool match (const uint &codepoint) const {
31 return codepoint >= start && codepoint <= end;
32 }
33};
34
35// This is a helper class to generate unicode block data.
36
37class KRITAFLAKE_EXPORT KoUnicodeBlockDataFactory {
38public:
41
42 // Returns the unicode block for the given code point, if not available, returns noBlock().
43 KoUnicodeBlockData blockForUCS(const uint &codepoint);
44
45 // Default block when there's no other blocks.
47 return KoUnicodeBlockData(i18nc("@title", "No Block"), 0x10FFFF, 0x10FFFF);
48 }
49private:
50 struct Private;
51
52 QScopedPointer<Private> d;
53};
54
55#endif // KOUNICODEBLOCKDATA_H
unsigned int uint
static KoUnicodeBlockData noBlock()
QScopedPointer< Private > d
bool match(const uint &codepoint) const
bool operator==(const KoUnicodeBlockData &rhs) const
KoUnicodeBlockData(QString name, uint start, uint end)
QString name
Name of the block.
uint start
Start char.