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>
26[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
const char16_t *
qustrchr(QStringView str,
char16_t ch)
noexcept;
27[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
const char16_t *
qustrcasechr(QStringView str,
char16_t ch)
noexcept;
39[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool equalStrings(QStringView lhs, QStringView rhs)
noexcept;
40[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool equalStrings(QStringView lhs, QLatin1StringView rhs)
noexcept;
41[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool equalStrings(QStringView lhs, QBasicUtf8StringView<
false> rhs)
noexcept;
42[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool equalStrings(QLatin1StringView lhs, QStringView rhs)
noexcept;
43[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool equalStrings(QLatin1StringView lhs, QLatin1StringView rhs)
noexcept;
44[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool equalStrings(QLatin1StringView lhs, QBasicUtf8StringView<
false> rhs)
noexcept;
45[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool equalStrings(QBasicUtf8StringView<
false> lhs, QStringView rhs)
noexcept;
46[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool equalStrings(QBasicUtf8StringView<
false> lhs, QLatin1StringView rhs)
noexcept;
47[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool equalStrings(QBasicUtf8StringView<
false> lhs, QBasicUtf8StringView<
false> rhs)
noexcept;
54[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool endsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs =
Qt::
CaseSensitive)
noexcept;
55[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool endsWith(QStringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs =
Qt::
CaseSensitive)
noexcept;
56[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool endsWith(QLatin1StringView haystack, QStringView needle, Qt::CaseSensitivity cs =
Qt::
CaseSensitive)
noexcept;
57[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool endsWith(QLatin1StringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs =
Qt::
CaseSensitive)
noexcept;
74[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool isLower(QStringView s)
noexcept;
75[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool isUpper(QStringView s)
noexcept;
84#if QT_CONFIG(regularexpression)
126[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool isAscii(QLatin1StringView s)
noexcept;
127[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool isAscii(QStringView s)
noexcept;
129[[
nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION
bool isLatin1(QStringView s)
noexcept;
132template <
typename Char, size_t N> [[nodiscard]]
constexpr Q_ALWAYS_INLINE
135#if defined(__cpp_lib_constexpr_algorithms) && defined(Q_CC_GNU_ONLY)
159#if defined(Q_CC_CLANG)
162#elif defined(Q_CC_GNU)
170 if constexpr (
N == 1) {
171 return str[0] ==
Char(0) ? 0 : 1;
173#ifdef QT_SUPPORTS_IS_CONSTANT_EVALUATED
184#if !defined(Q_COMPILER_SLOW_QSTRNLEN_COMPILATION)
185 return qstrnlen(str, maxlen);
187 return strnlen_s(str, maxlen);
191template <
typename Char, size_t N> [[nodiscard]]
constexpr inline
194#ifdef QT_SUPPORTS_IS_CONSTANT_EVALUATED
195 if (!q20::is_constant_evaluated())
196 return qstrnlen_helper(
reinterpret_cast<
const char *>(str), N);
199 return lengthHelperContainerLoop(str);
202template <
typename Container>
205 return qsizetype(
std::size(c));
~QStringTokenizerBaseBase()=default
constexpr QStringTokenizerBaseBase(Qt::SplitBehavior sb, Qt::CaseSensitivity cs) noexcept
friend constexpr bool operator!=(const iterator &lhs, sentinel) noexcept
constexpr const Haystack * operator->() const
friend constexpr bool operator==(const iterator &lhs, sentinel) noexcept
iterator() noexcept=default
constexpr const Haystack & operator*() const
friend constexpr bool operator!=(sentinel, const iterator &rhs) noexcept
friend constexpr bool operator==(sentinel, const iterator &rhs) noexcept
friend constexpr bool operator==(sentinel, sentinel) noexcept
friend constexpr bool operator!=(sentinel, sentinel) noexcept
constexpr sentinel end() const noexcept
iterator begin() const noexcept
constexpr QStringTokenizerBase(Haystack haystack, Needle needle, Qt::SplitBehavior sb, Qt::CaseSensitivity cs) noexcept
iterator cbegin() const noexcept
constexpr sentinel cend() const noexcept
Container toContainer(Container &&c={}) const &&
Container toContainer(Container &&c={}) const &
constexpr QStringTokenizer(Haystack haystack, Needle needle, Qt::CaseSensitivity cs, Qt::SplitBehavior sb=Qt::KeepEmptyParts) noexcept(std::is_nothrow_copy_constructible< QStringTokenizer >::value)
\typealias QStringTokenizer::sentinel
Combined button and popup list for selecting options.
constexpr qsizetype size(QChar) noexcept
constexpr qsizetype size(const String &s) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
constexpr qsizetype lengthHelperContainer(const Container &c) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isLower(QStringView s) noexcept
constexpr std::enable_if_t< sizeof(Char)==1, qsizetype > lengthHelperContainer(const Char(&str)[N])
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isValidUtf16(QStringView s) noexcept
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 Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
qsizetype qstrnlen_helper(const char *str, size_t maxlen)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isAscii(QLatin1StringView s) 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 auto qTokenize(Haystack &&h, Needle &&n, Flags...flags) noexcept(QtPrivate::Tok::is_nothrow_constructible_from< Haystack, Needle >::value) -> decltype(QtPrivate::Tok::TokenizerResult< Haystack, Needle >{std::forward< Haystack >(h), std::forward< Needle >(n), flags...})
friend constexpr bool operator!=(tokenizer_state lhs, tokenizer_state rhs) noexcept
friend constexpr bool operator==(tokenizer_state lhs, tokenizer_state rhs) noexcept
constexpr auto haystackView(Arg &&a) noexcept -> decltype(this->view(std::forward< Arg >(a)))
constexpr auto needleView(Arg &&a) noexcept -> decltype(this->view(std::forward< Arg >(a)))
constexpr QStringView view(const T &) const noexcept
constexpr Pinning(T &&s) noexcept
constexpr Pinning(const T &) noexcept
constexpr T view(T t) const noexcept