4#ifndef QSTRINGALGORITHMS_H
5#define QSTRINGALGORITHMS_H
7#include <QtCore/qbytearrayalgorithms.h>
8#include <QtCore/qcontainerfwd.h>
9#include <QtCore/qnamespace.h>
10#include <QtCore/qstringfwd.h>
12#pragma qt_class(QStringAlgorithms)
18#include <QtCore/q20type_traits.h>
85#if QT_CONFIG(regularexpression)
131template <
typename Char,
size_t N> [[nodiscard]]
constexpr Q_ALWAYS_INLINE
134#if defined(__cpp_lib_constexpr_algorithms) && defined(Q_CC_GNU_ONLY)
142 for (
size_t i = 0;
i < N; ++
i) {
150template <
typename Char,
size_t N> [[nodiscard]]
constexpr Q_ALWAYS_INLINE
157 constexpr size_t RuntimeThreshold =
158#if defined(Q_CC_CLANG)
161#elif defined(Q_CC_GNU)
164 __cplusplus >= 202002L ? 39 : 17
169 if constexpr (N == 1) {
170 return str[0] ==
Char(0) ? 0 : 1;
171 }
else if constexpr (N > RuntimeThreshold) {
172#ifdef QT_SUPPORTS_IS_CONSTANT_EVALUATED
183#if !defined(Q_COMPILER_SLOW_QSTRNLEN_COMPILATION)
186 return strnlen_s(
str, maxlen);
190template <
typename Char,
size_t N> [[nodiscard]]
constexpr inline
193#ifdef QT_SUPPORTS_IS_CONSTANT_EVALUATED
201template <
typename Container>
\inmodule QtCore \reentrant
\inmodule QtCore \reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
QSet< QString >::iterator it
Combined button and popup list for selecting options.
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype lastIndexOf(QByteArrayView haystack, qsizetype from, char needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QByteArrayView haystack, QByteArrayView needle) noexcept
constexpr Q_ALWAYS_INLINE std::enable_if_t< sizeof(Char)==sizeof(char16_t), qsizetype > lengthHelperContainer(const Char(&str)[N])
Q_CORE_EXPORT QString convertToQString(QAnyStringView s)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findStringInsensitive(QStringView haystack, qsizetype from, char16_t needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isLower(QStringView s) noexcept
Q_CORE_EXPORT QList< uint > convertToUcs4(QStringView str)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isValidUtf16(QStringView s) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION QByteArrayView trimmed(QByteArrayView s) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QByteArrayView haystack, QByteArrayView needle) noexcept
Q_CORE_EXPORT QByteArray convertToLocal8Bit(QStringView str)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QStringView lhs, QStringView rhs) noexcept
qsizetype findString(QStringView str, qsizetype from, QChar needle, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isRightToLeft(QStringView string) noexcept
Q_CORE_EXPORT QByteArray convertToLatin1(QStringView str)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype qustrnlen(const char16_t *str, qsizetype maxlen) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
qsizetype indexOf(const QList< V > &list, const U &u, qsizetype from) noexcept
qsizetype qstrnlen_helper(const char *str, size_t maxlen)
constexpr Q_ALWAYS_INLINE qsizetype lengthHelperContainerLoop(const Char(&str)[N])
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isAscii(QLatin1StringView s) noexcept
Q_CORE_EXPORT QByteArray convertToUtf8(QStringView str)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype qustrlen(const char16_t *str) noexcept
constexpr bool isLatin1(QLatin1StringView s) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION const char16_t * qustrcasechr(QStringView str, char16_t ch) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isUpper(QStringView s) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION const char16_t * qustrchr(QStringView str, char16_t ch) noexcept
constexpr bool is_constant_evaluated() noexcept
size_t qstrnlen(const char *str, size_t maxlen)
#define Q_DECL_PURE_FUNCTION
static bool contains(const QJsonArray &haystack, unsigned needle)
GLenum GLenum GLsizei count