Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qanystringview.h File Reference

(9efcf1457229ef33a4c336b6a8ffd31333f5c105)

#include <QtCore/qcompare.h>
#include <QtCore/qcontainerfwd.h>
#include <QtCore/qlatin1stringview.h>
#include <QtCore/qstringview.h>
#include <QtCore/qutf8stringview.h>
#include <QtCore/q20type_traits.h>
#include <limits>
Include dependency graph for qanystringview.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  QtPrivate::wrapped< Tag, Result >
struct  QtPrivate::is_compatible_utf32_char< Char >
struct  QtPrivate::is_compatible_utf32_char< char32_t >
struct  QtPrivate::is_compatible_utf32_char< wchar_t >
class  QAnyStringView
 \inmodule QtCore More...

Namespaces

namespace  QtPrivate

Macros

#define QT_ANYSTRINGVIEW_TAG_IN_LOWER_BITS

Typedefs

template<typename Tag, typename Result>
using QtPrivate::wrapped_t = typename wrapped<Tag, Result>::type

Functions

 Q_DECLARE_TYPEINFO (QAnyStringView, Q_PRIMITIVE_TYPE)
template<typename QStringLike, std::enable_if_t< std::disjunction_v< std::is_same< QStringLike, QString >, std::is_same< QStringLike, QByteArray > >, bool > = true>
QAnyStringView qToAnyStringViewIgnoringNull (const QStringLike &s) noexcept

Macro Definition Documentation

◆ QT_ANYSTRINGVIEW_TAG_IN_LOWER_BITS

#define QT_ANYSTRINGVIEW_TAG_IN_LOWER_BITS

Definition at line 37 of file qanystringview.h.

Function Documentation

◆ Q_DECLARE_TYPEINFO()

Q_DECLARE_TYPEINFO ( QAnyStringView ,
Q_PRIMITIVE_TYPE  )

◆ qToAnyStringViewIgnoringNull()

template<typename QStringLike, std::enable_if_t< std::disjunction_v< std::is_same< QStringLike, QString >, std::is_same< QStringLike, QByteArray > >, bool > = true>
QAnyStringView qToAnyStringViewIgnoringNull ( const QStringLike & s)
inlinenodiscardnoexcept
Since
6.0

Convert s to a QAnyStringView ignoring {s.isNull()}.

Returns a string view that references {s}'s data, but is never null.

This is a faster way to convert a QString or QByteArray to a QAnyStringView, if null QStrings or QByteArrays can legitimately be treated as empty ones.

See also
QString::isNull(), QAnyStringView

Definition at line 394 of file qanystringview.h.