Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Akregator
Commits
fc3be546
Commit
fc3be546
authored
Feb 25, 2022
by
Laurent Montel
Browse files
Add textutil
parent
610a9ea2
Pipeline
#142061
passed with stage
in 1 minute and 30 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
fc3be546
...
...
@@ -190,6 +190,8 @@ target_sources(akregatorpart PRIVATE
crashwidget/crashwidget.cpp
utils/filtercolumnsproxymodel.cpp
utils/textutil.cpp
utils/textutil.h
command/deletesubscriptioncommand.cpp
command/createfeedcommand.cpp
...
...
src/utils/textutil.cpp
0 → 100644
View file @
fc3be546
/*
SPDX-FileCopyrightText: 2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include
"textutil.h"
// code from kitinerary/src/lib/stringutil.cpp
QChar
TextUtil
::
normalize
(
QChar
c
)
{
// case folding
const
auto
n
=
c
.
toCaseFolded
();
// if the character has a canonical decomposition use that and skip the
// combining diacritic markers following it
// see https://en.wikipedia.org/wiki/Unicode_equivalence
// see https://en.wikipedia.org/wiki/Combining_character
if
(
n
.
decompositionTag
()
==
QChar
::
Canonical
)
{
return
n
.
decomposition
().
at
(
0
);
}
return
n
;
}
QString
TextUtil
::
normalize
(
QStringView
str
)
{
QString
out
;
out
.
reserve
(
str
.
size
());
for
(
const
auto
c
:
str
)
{
out
.
push_back
(
normalize
(
c
));
}
return
out
;
}
src/utils/textutil.h
0 → 100644
View file @
fc3be546
/*
SPDX-FileCopyrightText: 2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include
<QString>
namespace
TextUtil
{
Q_REQUIRED_RESULT
QString
normalize
(
QStringView
str
);
Q_REQUIRED_RESULT
QChar
normalize
(
QChar
c
);
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment