mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
25d79a9f3f
* Initial Qt6 config * Change Package order to reingfence missing packages * Update to QT 6.2.0 * Qt 6.2.0 updates * macOS fix * Simplify handling QT5 & Qt6 in parallel * Updates for Windows * Fix macos build * macOS linker fix * General support of QTDIR, update docu * MaxOS add default qt directories * Fix merge typo * Update default CMakeSettings.json with installation path options * Add additional libs required by Qt6 to CompileHowTo * Fix Qt5 items Co-authored-by: Paulchen-Panther <16664240+Paulchen-Panther@users.noreply.github.com>
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
#ifndef QSTRINGUTILS_H
|
|
#define QSTRINGUTILS_H
|
|
|
|
#include <QString>
|
|
#include <QStringList>
|
|
#include <QVector>
|
|
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
#include <QStringView>
|
|
#else
|
|
#include <QStringRef>
|
|
#endif
|
|
|
|
namespace QStringUtils {
|
|
|
|
enum class SplitBehavior {
|
|
KeepEmptyParts,
|
|
SkipEmptyParts,
|
|
};
|
|
|
|
inline QStringList split (const QString &string, const QString &sep, SplitBehavior behavior = SplitBehavior::KeepEmptyParts, Qt::CaseSensitivity cs = Qt::CaseSensitive)
|
|
{
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
|
return behavior == SplitBehavior::SkipEmptyParts ? string.split(sep, Qt::SkipEmptyParts , cs) : string.split(sep, Qt::KeepEmptyParts , cs);
|
|
#else
|
|
return behavior == SplitBehavior::SkipEmptyParts ? string.split(sep, QString::SkipEmptyParts , cs) : string.split(sep, QString::KeepEmptyParts , cs);
|
|
#endif
|
|
}
|
|
|
|
inline QStringList split (const QString &string, QChar sep, SplitBehavior behavior = SplitBehavior::KeepEmptyParts, Qt::CaseSensitivity cs = Qt::CaseSensitive)
|
|
{
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
|
return behavior == SplitBehavior::SkipEmptyParts ? string.split(sep, Qt::SkipEmptyParts , cs) : string.split(sep, Qt::KeepEmptyParts , cs);
|
|
#else
|
|
return behavior == SplitBehavior::SkipEmptyParts ? string.split(sep, QString::SkipEmptyParts , cs) : string.split(sep, QString::KeepEmptyParts , cs);
|
|
#endif
|
|
}
|
|
|
|
}
|
|
|
|
#endif // QSTRINGUTILS_H
|