2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2020-06-23 11:08:55 +02:00
|
|
|
*
|
2020-05-30 16:15:03 +02:00
|
|
|
* SPDX-FileCopyrightText: 2013-2016 Teo Mrnjavac <teo@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
|
2020-08-10 18:21:42 +02:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2014-06-06 16:00:42 +02:00
|
|
|
*
|
|
|
|
* Originally from Tomahawk, portions:
|
2020-05-30 16:15:03 +02:00
|
|
|
* SPDX-FileCopyrightText: 2010-2011 Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
|
|
|
* SPDX-FileCopyrightText: 2010-2011 Leo Franchi <lfranchi@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2010-2012 Jeff Mitchell <jeff@tomahawk-player.org>
|
2014-06-06 16:00:42 +02:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2014-06-06 16:00:42 +02:00
|
|
|
*
|
2020-05-30 16:15:03 +02:00
|
|
|
*
|
2014-06-06 16:00:42 +02:00
|
|
|
*/
|
|
|
|
|
2019-04-29 12:48:01 +02:00
|
|
|
#ifndef UTILS_STRING_H
|
|
|
|
#define UTILS_STRING_H
|
2014-06-06 16:00:42 +02:00
|
|
|
|
|
|
|
#include "DllMacro.h"
|
|
|
|
|
2019-04-29 12:48:01 +02:00
|
|
|
#include <QString>
|
2014-06-06 16:00:42 +02:00
|
|
|
|
2020-06-23 11:08:55 +02:00
|
|
|
/* Qt 5.14 changed the API to QString::split(), adding new overloads
|
|
|
|
* that take a different enum, then Qt 5.15 deprecated the old ones.
|
|
|
|
* To avoid overly-many warnings related to the API change, introduce
|
|
|
|
* Calamares-specific constants that pull from the correct enum.
|
|
|
|
*/
|
|
|
|
constexpr static const auto SplitSkipEmptyParts =
|
|
|
|
#if QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 )
|
|
|
|
QString::SkipEmptyParts
|
|
|
|
#else
|
|
|
|
Qt::SkipEmptyParts
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
|
|
|
constexpr static const auto SplitKeepEmptyParts =
|
|
|
|
#if QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 )
|
|
|
|
QString::KeepEmptyParts
|
|
|
|
#else
|
|
|
|
Qt::KeepEmptyParts
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
2017-03-01 13:34:48 +01:00
|
|
|
/**
|
|
|
|
* @brief The CalamaresUtils namespace contains utility functions.
|
|
|
|
*/
|
2014-06-06 16:00:42 +02:00
|
|
|
namespace CalamaresUtils
|
|
|
|
{
|
2019-08-04 21:22:54 +02:00
|
|
|
/**
|
|
|
|
* @brief removeDiacritics replaces letters with diacritics and ligatures with
|
|
|
|
* alternative forms and digraphs.
|
|
|
|
* @param string the string to transform.
|
|
|
|
* @return the output string with plain characters.
|
|
|
|
*/
|
|
|
|
DLLEXPORT QString removeDiacritics( const QString& string );
|
2015-09-25 15:24:35 +02:00
|
|
|
|
2019-08-04 21:22:54 +02:00
|
|
|
/**
|
|
|
|
* @brief obscure is a bidirectional obfuscation function, from KStringHandler.
|
|
|
|
* @param string the input string.
|
|
|
|
* @return the obfuscated string.
|
|
|
|
*/
|
|
|
|
DLLEXPORT QString obscure( const QString& string );
|
|
|
|
} // namespace CalamaresUtils
|
2014-06-06 16:00:42 +02:00
|
|
|
|
2019-04-29 12:12:18 +02:00
|
|
|
#endif
|