4#ifndef QANYSTRINGVIEWUTILS_P_H
5#define QANYSTRINGVIEWUTILS_P_H
17#include <QtCore/private/qjson_p.h>
19#include <QtCore/qanystringview.h>
20#include <QtCore/qcbormap.h>
21#include <QtCore/qcborvalue.h>
38 if (e.flags & QtCbor::Element::StringIsUtf16)
39 return data->asStringView();
40 if (e.flags & QtCbor::Element::StringIsAscii)
41 return data->asLatin1();
42 return data->asUtf8StringView();
54 return whole.length() >= part.
length() && whole.last(part.
length()) == part;
61 return whole.length() >= part.
length() && whole.first(part.
length()) == part;
77 return whole.lastIndexOf(part);
81 return whole.lastIndexOf(part);
105template<
typename StringView>
108 if constexpr (std::is_same_v<StringView, QStringView>)
110 if constexpr (std::is_same_v<StringView, QLatin1StringView>)
112 if constexpr (std::is_same_v<StringView, QUtf8StringView>)
124template<
typename StringView,
typename Handler>
127 if constexpr (std::is_same_v<StringView, QStringView>)
129 if constexpr (std::is_same_v<StringView, QLatin1StringView>)
131 if constexpr (std::is_same_v<StringView, QUtf8StringView>)
133 if constexpr (std::is_same_v<StringView, QByteArrayView>)
134 return handler(
string);
135 if constexpr (std::is_same_v<StringView, QByteArray>)
137 if constexpr (std::is_same_v<StringView, QAnyStringView>) {
146 struct Wrapper { Handler handler; };
148 return string.visit([
w = Wrapper { std::forward<Handler>(handler) }](
auto view)
mutable {
161 QList<QAnyStringView>
list;
constexpr decltype(auto) visit(Visitor &&v) const
Calls v with either a QUtf8StringView, QLatin1String, or QStringView, depending on the encoding of th...
bool contains(QByteArrayView a) const noexcept
int toInt(bool *ok=nullptr, int base=10) const
qsizetype lastIndexOf(QByteArrayView a) const noexcept
const QtCbor::ByteData * byteData(QtCbor::Element e) const
QList< QtCbor::Element > elements
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
static qint64 valueHelper(const QCborValue &v)
static QCborContainerPrivate * container(const QCborValue &v)
constexpr qsizetype length() const noexcept
bool contains(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
qsizetype length() const noexcept
const_reference at(qsizetype i) const noexcept
void append(parameter_type t)
QMap< QString, QString > map
[6]
QAnyStringView toStringView(const QCborValue &value)
qsizetype lastIndexOf(QAnyStringView whole, QLatin1StringView part)
bool contains(QAnyStringView whole, QLatin1Char part)
QAnyStringView trimmed(QAnyStringView string)
int toInt(QUtf8StringView view)
QAnyStringView doTrimmed(StringView string)
auto processAsUtf8(StringView string, Handler &&handler)
bool endsWith(QAnyStringView whole, QLatin1StringView part)
qsizetype getLastIndexOf(QStringView whole, QLatin1StringView part)
bool doesContain(QStringView whole, QLatin1Char part)
bool startsWith(QAnyStringView whole, QLatin1StringView part)
QList< QAnyStringView > split(QAnyStringView source, QLatin1StringView sep)
Combined button and popup list for selecting options.
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isAscii(QLatin1StringView s) noexcept
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLsizei GLsizei GLchar * source
static constexpr QChar sep
\inmodule QtCore \reentrant
constexpr char toLatin1() const noexcept
Converts a Latin-1 character to an 8-bit ASCII representation of the character.