QLatin1StringView Class

QLatin1StringView クラスは、US-ASCII/Latin-1 エンコードされた文字列リテラルの薄いラッパーを提供します。詳細...

ヘッダー #include <QLatin1StringView>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core

このクラスは強く比較可能です。

このクラスは char16_t,QChar,QStringView,QUtf8StringView,QString, および const char16_t * と強く比較可能です。

このクラスは、const char *,QByteArray,QByteArrayView強く比較可能です。

バイト配列データは utf-8 として解釈されます。

注意:このクラスの関数はすべてリエントラントです。

パブリック型

パブリック関数

QLatin1StringView()
(since 6.3) QLatin1StringView(QByteArrayView str)
QLatin1StringView(const QByteArray &str)
QLatin1StringView(const char *str)
(since 6.4) QLatin1StringView(std::nullptr_t)
QLatin1StringView(const char *first, const char *last)
QLatin1StringView(const char *str, qsizetype size)
QString arg(Args &&... args) const
QLatin1Char at(qsizetype pos) const
QLatin1Char back() const
QLatin1StringView::const_iterator begin() const
QLatin1StringView::const_iterator cbegin() const
QLatin1StringView::const_iterator cend() const
void chop(qsizetype length)
QLatin1StringView chopped(qsizetype length) const
int compare(QChar ch) const
int compare(QChar ch, Qt::CaseSensitivity cs) const
int compare(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int compare(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 6.5) int compare(QUtf8StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 6.4) const char *constBegin() const
(since 6.4) const char *constData() const
(since 6.4) const char *constEnd() const
bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool contains(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool contains(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 6.4) qsizetype count(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 6.4) qsizetype count(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 6.4) qsizetype count(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
QLatin1StringView::const_reverse_iterator crbegin() const
QLatin1StringView::const_reverse_iterator crend() const
const char *data() const
(since 6.4) bool empty() const
QLatin1StringView::const_iterator end() const
bool endsWith(QChar ch) const
bool endsWith(QChar ch, Qt::CaseSensitivity cs) const
bool endsWith(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool endsWith(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 6.4) QLatin1Char first() const
(since 6.0) QLatin1StringView first(qsizetype n) const
QLatin1Char front() const
qsizetype indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
qsizetype indexOf(QLatin1StringView l1, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
qsizetype indexOf(QStringView str, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool isEmpty() const
bool isNull() const
(since 6.4) QLatin1Char last() const
(since 6.0) QLatin1StringView last(qsizetype n) const
qsizetype lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
qsizetype lastIndexOf(QLatin1StringView l1, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
qsizetype lastIndexOf(QStringView str, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 6.3) qsizetype lastIndexOf(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 6.2) qsizetype lastIndexOf(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 6.2) qsizetype lastIndexOf(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
const char *latin1() const
QLatin1StringView left(qsizetype length) const
(since 6.4) qsizetype length() const
(since 6.8) qsizetype max_size() const
QLatin1StringView mid(qsizetype start, qsizetype length = -1) const
QLatin1StringView::const_reverse_iterator rbegin() const
QLatin1StringView::const_reverse_iterator rend() const
QLatin1StringView right(qsizetype length) const
qsizetype size() const
(since 6.8) QLatin1StringView &slice(qsizetype pos)
(since 6.8) QLatin1StringView &slice(qsizetype pos, qsizetype n)
(since 6.0) QLatin1StringView sliced(qsizetype pos) const
(since 6.0) QLatin1StringView sliced(qsizetype pos, qsizetype n) const
bool startsWith(QChar ch) const
bool startsWith(QChar ch, Qt::CaseSensitivity cs) const
bool startsWith(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool startsWith(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 6.4) double toDouble(bool *ok = nullptr) const
(since 6.4) float toFloat(bool *ok = nullptr) const
(since 6.4) int toInt(bool *ok = nullptr, int base = 10) const
(since 6.4) long toLong(bool *ok = nullptr, int base = 10) const
(since 6.4) qlonglong toLongLong(bool *ok = nullptr, int base = 10) const
(since 6.4) short toShort(bool *ok = nullptr, int base = 10) const
(since 6.0) QString toString() const
(since 6.4) uint toUInt(bool *ok = nullptr, int base = 10) const
(since 6.4) ulong toULong(bool *ok = nullptr, int base = 10) const
(since 6.4) qulonglong toULongLong(bool *ok = nullptr, int base = 10) const
(since 6.4) ushort toUShort(bool *ok = nullptr, int base = 10) const
(since 6.0) auto tokenize(Needle &&sep, Flags... flags) const
QLatin1StringView trimmed() const
void truncate(qsizetype length)
QLatin1Char operator[](qsizetype pos) const

静的パブリック・メンバー

(since 6.8) qsizetype maxSize()
ブール operator!=(const QChar&lhs, const QLatin1StringView&rhs)
ブール operator!=(const QLatin1StringView&lhs, const QChar&rhs)
ブール operator!=(const QLatin1StringView&lhs, const QLatin1StringView&rhs)
ブール operator!=(const QLatin1StringView&lhs, const QStringView&rhs)
ブール operator!=(const QLatin1StringView&lhs, const char *const&rhs)
ブール operator!=(const QStringView&lhs, const QLatin1StringView&rhs)
ブール operator!=(const char *const&lhs, const QLatin1StringView&rhs)
ブール operator!=(const QLatin1StringView&lhs, const QByteArray&rhs)
(since 6.4) QLatin1StringView operator""_L1(const char*str, size_tsize)
ブール operator<(const QChar&lhs, const QLatin1StringView&rhs)
ブール operator<(const QLatin1StringView&lhs, const QChar&rhs)
ブール operator<(const QLatin1StringView&lhs, const QLatin1StringView&rhs)
ブール operator<(const QLatin1StringView&lhs, const QStringView&rhs)
ブール operator<(const QLatin1StringView&lhs, const char *const&rhs)
ブール operator<(const QStringView&lhs, const QLatin1StringView&rhs)
ブール operator<(const char *const&lhs, const QLatin1StringView&rhs)
ブール operator<(const QLatin1StringView&lhs, const QByteArray&rhs)
ブール operator<=(const QChar&lhs, const QLatin1StringView&rhs)
ブール operator<=(const QLatin1StringView&lhs, const QChar&rhs)
ブール operator<=(const QLatin1StringView&lhs, const QLatin1StringView&rhs)
ブール operator<=(const QLatin1StringView&lhs, const QStringView&rhs)
ブール operator<=(const QLatin1StringView&lhs, const char *const&rhs)
ブール operator<=(const QStringView&lhs, const QLatin1StringView&rhs)
ブール operator<=(const char *const&lhs, const QLatin1StringView&rhs)
ブール operator<=(const QLatin1StringView&lhs, const QByteArray&rhs)
ブール operator==(const QChar&lhs, const QLatin1StringView&rhs)
ブール operator==(const QLatin1StringView&lhs, const QChar&rhs)
ブール operator==(const QLatin1StringView&lhs, const QLatin1StringView&rhs)
ブール operator==(const QLatin1StringView&lhs, const QStringView&rhs)
ブール operator==(const QLatin1StringView&lhs, const char *const&rhs)
ブール operator==(const QStringView&lhs, const QLatin1StringView&rhs)
ブール operator==(const char *const&lhs, const QLatin1StringView&rhs)
ブール operator==(const QLatin1StringView&lhs, const QByteArray&rhs)
ブール operator>(const QChar&lhs, const QLatin1StringView&rhs)
ブール operator>(const QLatin1StringView&lhs, const QChar&rhs)
ブール operator>(const QLatin1StringView&lhs, const QLatin1StringView&rhs)
ブール operator>(const QLatin1StringView&lhs, const QStringView&rhs)
ブール operator>(const QLatin1StringView&lhs, const char *const&rhs)
ブール operator>(const QStringView&lhs, const QLatin1StringView&rhs)
ブール operator>(const char *const&lhs, const QLatin1StringView&rhs)
ブール operator>(const QLatin1StringView&lhs, const QByteArray&rhs)
ブール operator>=(const QChar&lhs, const QLatin1StringView&rhs)
ブール operator>=(const QLatin1StringView&lhs, const QChar&rhs)
ブール operator>=(const QLatin1StringView&lhs, const QLatin1StringView&rhs)
ブール operator>=(const QLatin1StringView&lhs, const QStringView&rhs)
ブール operator>=(const QLatin1StringView&lhs, const char *const&rhs)
ブール operator>=(const QStringView&lhs, const QLatin1StringView&rhs)
ブール operator>=(const char *const&lhs, const QLatin1StringView&rhs)
ブール operator>=(const QLatin1StringView&lhs, const QByteArray&rhs)

詳細説明

QString のメンバ関数の多くは、QString の代わりにconst char * を受け付けるようにオーバーロードされている。これには、コピーコンストラクタ、代入演算子、比較演算子、およびinsert()、append()、prepend() などのさまざまな関数が含まれる。これらの関数の中には、const char * データに対してQString オブジェクトを構築しないように最適化されているものもあります。例えば、strQString

if (str == "auto" || str == "extern"
        || str == "static" || str == "register") {
    ...
}

if (str == QString("auto") || str == QString("extern")
        || str == QString("static") || str == QString("register")) {
    ...
}

なぜなら、4つの一時的なQString オブジェクトを構築したり、文字データのディープコピーを作成したりしないからです。

しかし、これはconst char * を受け取るすべてのQString メンバ関数に当てはまるわけではないので、アプリケーションはテンポラリが作成されることを前提にする必要があります。

str.append("Hello ").append("World");

QString ドキュメントで説明されているように)QT_NO_CAST_FROM_ASCII を定義するアプリケーションは、QStringconst char * API にアクセスできません。const char *定数Latin-1文字列を指定する効率的な方法を提供するために、QtはQLatin1StringViewを提供しています。 QLatin1StringViewを使用すると、上記のサンプルコードは次のようになります。

if (str == "auto"_L1
        || str == "extern"_L1
        || str == "static"_L1
        || str == "register"_L1 {
    ...
}

これは入力に少し時間がかかりますが、最初のバージョンのコードとまったく同じ利点を提供し、QString::fromLatin1 ()を使用してLatin-1文字列を変換するよりも高速です。

QString(QLatin1StringView)コンストラクタのおかげで、QLatin1StringViewはQString 。例えば

QLabel *label = new QLabel("MOD"_L1, this);

注意: QLatin1StringViewの引数で呼び出している関数が、実際にはQLatin1StringViewを取るようにオーバーロードされていない場合、QString への暗黙の変換がメモリ割り当ての引き金になります。これは通常、最初にQLatin1StringViewを使うことで避けたいことです。そのような場合、QStringLiteral を使用する方が良い選択かもしれません。

注意: Qtが要求しているように、ソースコードファイルがUTF-8でエンコードされている場合、QLatin1StringViewで使用できるのはUS-ASCIIリテラルだけです。QLatin1StringView("é") のような非US-ASCIIリテラルは正しく表現されません。代わりに8進数または16進数表記を使用することができます:それぞれQLatin1StringView("\351") またはQLatin1StringView("\xe9")

QString,QLatin1Char,QStringLiteral,QT_NO_CAST_FROM_ASCIIも参照してください

メンバー・タイプ・ドキュメント

[alias, since 6.7] QLatin1StringView::const_pointer

[alias, since 6.7] QLatin1StringView::pointer

value_type * のエイリアス。STL との互換性のために提供される。

この型定義は Qt 6.7 で導入された。

[alias] QLatin1StringView::const_iterator

iterator およびconst_reverse_iteratorも参照のこと

[alias] QLatin1StringView::const_reference

reference のエイリアス。STL との互換性のために提供される。

[alias] QLatin1StringView::const_reverse_iterator

reverse_iterator およびconst_iteratorも参照のこと

[alias] QLatin1StringView::difference_type

qsizetype のエイリアス。STL との互換性のために提供される。

[alias] QLatin1StringView::iterator

QLatin1StringView はミュータブル・イテレータをサポートしていないので、これは と同じである。const_iterator

const_iterator およびreverse_iteratorも参照してください

[alias] QLatin1StringView::reference

value_type & のエイリアス。STL との互換性のために提供される。

[alias] QLatin1StringView::reverse_iterator

QLatin1StringView はミュータブルな逆イテレータをサポートしていないので、これは と同じである。const_reverse_iterator

const_reverse_iterator およびiteratorも参照して ください。

[alias] QLatin1StringView::size_type

qsizetype のエイリアス。STL との互換性のために提供されています。

注意: Qt 6 より前のバージョンでは、これはint のエイリアスで、64 ビットアーキテクチャのQLatin1StringView に保持できるデータ量を制限していました。

[alias] QLatin1StringView::value_type

const char のエイリアス。STL との互換性のために提供されています。

メンバ関数ドキュメント

[constexpr noexcept] int QLatin1StringView::compare(QChar ch) const

[noexcept] int QLatin1StringView::compare(QChar ch, Qt::CaseSensitivity cs) const

[noexcept] int QLatin1StringView::compare(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

[noexcept] int QLatin1StringView::compare(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

この文字列ビューを UTF-16 文字列ビューstr 、 Latin-1 文字列ビューl1 、または文字ch とそれぞれ比較する。この文字列がstrl1ch より小さい場合は負の整数を返し、strl1ch より大きい場合は正の整数を返し、等しい場合はゼロを返します。

csQt::CaseSensitive (デフォルト) の場合、検索は大文字小文字を区別し、それ以外の場合、検索は大文字小文字を区別しない。

operator==()、operator<()、operator>()も参照

[constexpr noexcept] bool QLatin1StringView::startsWith(QChar ch) const

[noexcept] bool QLatin1StringView::startsWith(QChar ch, Qt::CaseSensitivity cs) const

[noexcept] bool QLatin1StringView::startsWith(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

[noexcept] bool QLatin1StringView::startsWith(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

この Latin-1 文字列ビューが、str で表示される UTF-16 文字列、l1 で表示される Latin-1 文字列、またはch で表示される文字列でそれぞれ始まる場合はtrue を返し、そうでない場合はfalse を返す。

csQt::CaseSensitive (デフォルト)の場合、検索は大文字小文字を区別します。

endsWith()も参照

[constexpr noexcept] bool QLatin1StringView::endsWith(QChar ch) const

[noexcept] bool QLatin1StringView::endsWith(QChar ch, Qt::CaseSensitivity cs) const

[noexcept] bool QLatin1StringView::endsWith(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

[noexcept] bool QLatin1StringView::endsWith(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

この Latin-1 文字列ビューが、str で表示された UTF-16 文字列、l1 で表示された Latin-1 文字列、またはch で表示された文字列でそれぞれ終了している場合はtrue を返し、そうでない場合はfalse を返す。

csQt::CaseSensitive の場合(デフォルト)、検索は大文字小文字を区別します。

startsWith()も参照

[noexcept] qsizetype QLatin1StringView::indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

[noexcept] qsizetype QLatin1StringView::indexOf(QLatin1StringView l1, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

[noexcept] qsizetype QLatin1StringView::indexOf(QStringView str, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

この Latin-1 文字列ビューにおいて、str が示す UTF-16 文字列、l1 が示す Latin-1 文字列、またはch が示す文字が、それぞれインデックス位置from から前方に検索して最初に出現するインデックス位置を返す。strl1c がそれぞれ見つからなければ -1 を返す。

csQt::CaseSensitive (デフォルト)の場合、検索は大文字小文字を区別する。

from が -1 の場合、検索は最後の文字から始まり、-2 の場合、最後から次の文字から始まる。

QString::indexOf()も参照のこと

[noexcept] bool QLatin1StringView::contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

[noexcept] bool QLatin1StringView::contains(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

[noexcept] bool QLatin1StringView::contains(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

この Latin-1 文字列ビューが、str で表示される UTF-16 文字列、l1 で表示される Latin-1 文字列、または文字ch をそれぞれ含む場合、true を返す。そうでない場合、false を返す。

csQt::CaseSensitive (デフォルト)の場合、検索は大文字小文字を区別する。

indexOf()、QStringView::contains()、QStringView::indexOf()、QString::indexOf()も参照

[noexcept] qsizetype QLatin1StringView::lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

[noexcept] qsizetype QLatin1StringView::lastIndexOf(QLatin1StringView l1, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

[noexcept] qsizetype QLatin1StringView::lastIndexOf(QStringView str, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

str l1 ch この Latin-1 文字列ビューにおいて、str が示す UTF-16 文字列、l1 が示す Latin-1 文字列、またはch が示す文字列が最後に出現するインデックス位置を、それぞれfrom から後方へ検索して返す。

from が -1 の場合、検索は最後の文字から始まり、-2 の場合、最後から次の文字から始まる。

csQt::CaseSensitive (デフォルト)の場合、検索は大文字小文字を区別する。

注意: 長さ0のstr またはl1 を検索する場合、-1 は通常文字列の末尾から検索すると考えられるが、from を負にすると、データの末尾のマッチは検索から除外される。このような最後の空マッチを含めるには、from に正の値を与えるか、from パラメータを完全に省略します。

indexOf()、QStringView::lastIndexOf()、QStringView::indexOf()、QString::indexOf()も参照のこと

[noexcept, since 6.2] qsizetype QLatin1StringView::lastIndexOf(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

[noexcept, since 6.2] qsizetype QLatin1StringView::lastIndexOf(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

この関数は、lastIndexOf ()をオーバーロードする。

str で見た UTF-16 文字列、またはl1 で見た Latin-1 文字列が、それぞれ最後に出現した Latin-1 文字列ビューのインデックス位置を返す。それぞれstr またはl1 が見つからない場合は -1 を返す。

csQt::CaseSensitive の場合(デフォルト)、検索は大文字小文字を区別します。

この関数は Qt 6.2 で導入されました。

[noexcept, since 6.4] qsizetype QLatin1StringView::count(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

[since 6.4] qsizetype QLatin1StringView::count(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

[since 6.4] qsizetype QLatin1StringView::count(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

この文字列ビューにおいて、str で表示される UTF-16 文字列、l1 で表示される Latin-1 文字列、またはch で表示される文字の(重複する可能性のある)出現回数をそれぞれ返します。

csQt::CaseSensitive の場合(デフォルト)、検索は大文字小文字を区別します。

この関数は Qt 6.4 で導入されました。

contains() およびindexOf()も参照してください

[since 6.4] int QLatin1StringView::toInt(bool *ok = nullptr, int base = 10) const

[since 6.4] long QLatin1StringView::toLong(bool *ok = nullptr, int base = 10) const

[since 6.4] qlonglong QLatin1StringView::toLongLong(bool *ok = nullptr, int base = 10) const

[since 6.4] qulonglong QLatin1StringView::toULongLong(bool *ok = nullptr, int base = 10) const

[since 6.4] short QLatin1StringView::toShort(bool *ok = nullptr, int base = 10) const

[since 6.4] uint QLatin1StringView::toUInt(bool *ok = nullptr, int base = 10) const

[since 6.4] ulong QLatin1StringView::toULong(bool *ok = nullptr, int base = 10) const

[since 6.4] ushort QLatin1StringView::toUShort(bool *ok = nullptr, int base = 10) const

このQLatin1StringView を、base を基本として対応する数値に変換して返す。Aは10、Bは11といった具合です。

base が0の場合、基数は以下の規則(この順序)で自動的に決定される:

  • "0x"で始まる場合、残りは16進数(基数16)として読み込まれる。
  • "0b"残りは2進数(基数2)として読まれます。
  • "0"それ以外は8進数(ベース8)として読みます。
  • それ以外は10進数として読み込まれる

変換に失敗した場合は0を返す。

oknullptr でない場合、失敗は *okfalse に設定することで報告され、成功は *oktrue に設定することで報告される。

注意: 数値の変換は、ユーザーのロケールに関係なく、デフォルトのCロケールで行われる。数値と文字列の間でロケールを意識した変換を行うには、QLocale を使用する。

この関数は、先頭と末尾のスペーシング文字を無視する。

注意: "0b" 接頭辞のサポートは Qt 6.4 で追加されました。

この関数は Qt 6.4 で導入されました。

[since 6.4] double QLatin1StringView::toDouble(bool *ok = nullptr) const

[since 6.4] float QLatin1StringView::toFloat(bool *ok = nullptr) const

このQLatin1StringView を対応する浮動小数点値に変換して返す。

変換がオーバーフローした場合は無限大を返し、その他の理由(アンダーフローなど)で変換に失敗した場合は 0.0 を返す。

oknullptr でない場合、失敗は *okfalse に設定することで報告され、成功は *oktrue に設定することで報告される。

警告: QLatin1StringView の内容には、プラス/マイナス記号、科学的記数法で使用される文字e、および小数点を 含む有効な数値文字のみを含めることができる。単位や追加の文字を含めると、変換エラーになります。

注意: 数値の変換は、ユーザーのロケールに関係なく、デフォルトのCロケールで行われる。数値と文字列間のロケール対応変換を行うには、QLocale を使用する。

この関数は、先頭と末尾のスペーシング文字を無視します。

この関数は Qt 6.4 で導入されました。

template <typename... Args> QString QLatin1StringView::arg(Args &&... args) const

この文字列内の%N の出現箇所を、args の対応する引数で置き換える。 引数は位置指定ではない。args の最初の引数は、%N を最も低いN (すべて) で置き換え、args の 2 番目の引数は、%N を次に低いN で置き換えるなど。

Args は、暗黙のうちに 、 、 に変換するものであれば何でも構わない。QString QStringView QLatin1StringView

さらに、以下の型もサポートされている:QChar QLatin1Char

QString::arg()も参照のこと

[constexpr noexcept(...), since 6.0] template <typename Needle, typename... Flags> auto QLatin1StringView::tokenize(Needle &&sep, Flags... flags) const

文字列を、sep が発生する箇所で部分文字列ビューに分割し、それらの文字列の遅延シーケンスを返します。

と同等です。

return QStringTokenizer{std::forward<Needle>(sep), flags...};

ただし、コンパイラで C++17 CTAD(Class Template Argument Deduction)が有効になっていなくても動作します。

sepflags がどのように相互作用して結果を形成するかについては、QStringTokenizer を参照してください。

: この関数はQStringTokenizer を返しますが、テンプレート引数に明示的な名前を付けることは絶対にしないでください。C++17 CTAD(Class Template Argument Deduction:クラス テンプレート引数推論)を使用できる場合は、次のように記述できます。

QStringTokenizer result = sv.tokenize(sep);

(と書くことができます(テンプレート引数なし)。C++17 CTAD を使用できない場合は、auto 変数にのみ戻り値を格納する必要があります:

auto result = sv.tokenize(sep);

これは、QStringTokenizer のテンプレート引数は、それが返される特定のtokenize() オーバーロードに非常に微妙に依存し、通常はセパレーターに使用される型に対応しないからです。

この関数は Qt 6.0 で導入されました。

注意: noexcept(qTokenize(std::declval<const QLatin1StringView &>(), std::forward<Needle>(needle), flags...))true の場合、この関数は noexcept となります。

QStringTokenizerqTokenize()も参照してください

[constexpr noexcept] QLatin1StringView::QLatin1StringView()

nullptr を格納する QLatin1StringView オブジェクトを構築する。

data(),isEmpty(),isNull(),Distinction Between Null and Empty Stringsも参照

[explicit constexpr noexcept, since 6.3] QLatin1StringView::QLatin1StringView(QByteArrayView str)

str のビューとして QLatin1StringView オブジェクトを構築する。

文字列データはコピーされない。呼び出し元は、QLatin1StringView オブジェクトが存在する限り、str が指すデータが削除されたり変更されたりしないことを保証できなければならない。サイズは、ヌル・ターミネータをチェックせずに、そのままstr から取得されます。

注意: : バイト配列内のヌル('˶'0')バイトはこの文字列に含まれます。この文字列がQString で使用される場合、Unicode のヌル文字(U+0000)に変換されます。

この関数は Qt 6.3 で導入されました。

latin1()も参照してください

[explicit noexcept] QLatin1StringView::QLatin1StringView(const QByteArray &str)

str のビューとして QLatin1StringView オブジェクトを構築する。

文字列データはコピーされない。呼び出し元は、QLatin1StringView オブジェクトが存在する限り、str が削除または変更されないことを保証できなければならない。

latin1()も参照

[explicit constexpr noexcept] QLatin1StringView::QLatin1StringView(const char *str)

str を格納する QLatin1StringView オブジェクトを構築する。

文字列データはコピーされない。呼び出し元は、QLatin1StringView オブジェクトが存在する限り、str が削除または変更されないことを保証できなければならない。

latin1()も参照のこと

[constexpr noexcept, since 6.4] QLatin1StringView::QLatin1StringView(std::nullptr_t)

nullptr を格納する QLatin1StringView オブジェクトを構築します。

この関数は Qt 6.4 で導入されました。

data(),isEmpty(),isNull(),Distinction Between Null and Empty Stringsも参照してください

[constexpr] QLatin1StringView::QLatin1StringView(const char *first, const char *last)

長さ (last -first) のfirst を格納する QLatin1StringView オブジェクトを構築する。

[first,last) の範囲は、このLatin-1文字列オブジェクトの有効期間中有効でなければなりません。

nullptrfirst として渡しても、lastnullptr であれば安全です。

lastfirst より前で、firstnullptr で、last がそうでない場合、またはlast - first > INT_MAX.

[constexpr noexcept] QLatin1StringView::QLatin1StringView(const char *str, qsizetype size)

sizestr を格納する QLatin1StringView オブジェクトを構築する。

文字列データはコピーされない。呼び出し元は、QLatin1StringView オブジェクトが存在する限り、str が削除または変更されないことを保証できなければなりません。

注意: : バイト配列内のヌル('˶'0')バイトはこの文字列に含まれます。この文字列がQString で使用される場合、Unicode のヌル文字(U+0000)に変換されます。この動作は Qt 5.x とは異なります。

latin1()も参照してください

[constexpr] QLatin1Char QLatin1StringView::at(qsizetype pos) const

このオブジェクトの位置pos にある文字を返します。

注意: この関数はエラーチェックを行わない。pos < 0 またはpos >=size() の場合の動作は未定義である。

operator[]()も参照

[constexpr] QLatin1Char QLatin1StringView::back() const

文字列の最後の文字を返す。at(size() - 1) と同じ。

この関数は STL との互換性のために提供されている。

警告: 空の文字列に対してこの関数を呼び出すと、未定義の動作になります。

front()、at()、operator[]()も参照

[constexpr noexcept] QLatin1StringView::const_iterator QLatin1StringView::begin() const

文字列の最初の文字を指す constSTL 形式のイテレータを返します。

この関数は STL との互換性のために提供されています。

end(),cbegin(),rbegin(),data()も参照

[constexpr noexcept] QLatin1StringView::const_iterator QLatin1StringView::cbegin() const

begin() と同じ。

この関数は STL との互換性のために提供されている。

cend(),begin(),crbegin(),data()も参照

[constexpr noexcept] QLatin1StringView::const_iterator QLatin1StringView::cend() const

end() と同じ。

この関数は STL との互換性のために提供されている。

cbegin(),end(),crend()も参照

[constexpr] void QLatin1StringView::chop(qsizetype length)

この文字列をlength 文字で切り捨てる。

*this = left(size() - length) と同じ。

注意: length < 0 またはlength >size() の場合の動作は未定義。

sliced()、first()、last()、chopped()、truncate()、slice()も参照のこと

[constexpr] QLatin1StringView QLatin1StringView::chopped(qsizetype length) const

このオブジェクトの先頭から始まる、長さsize() -length の部分文字列を返す。

left(size() - length) と同じ。

注意: length < 0 またはlength >size() の場合の動作は未定義。

sliced()、first()、last()、chop()、truncate()、slice()も参照

[noexcept, since 6.5] int QLatin1StringView::compare(QUtf8StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

この文字列ビューとstr を比較し、この文字列ビューがstr より小さい場合は負の整数を、str より大きい場合は正の整数を、等しい場合はゼロを返します。

csQt::CaseSensitive の場合(デフォルト)、比較は大文字小文字を区別します。

この関数は Qt 6.5 で導入されました。

operator==(),operator<(),operator>()も参照してください

[constexpr noexcept, since 6.4] const char *QLatin1StringView::constBegin() const

begin() と同じ。

この関数は、他の Qt コンテナとの互換性のために提供されています。

この関数は Qt 6.4 で導入されました。

constEnd(),begin(),cbegin(),data()も参照してください

[constexpr noexcept, since 6.4] const char *QLatin1StringView::constData() const

このオブジェクトが参照する Latin-1 文字列の開始位置を返します。

この関数は、他の Qt コンテナとの互換性のために提供されています。

この関数は Qt 6.4 で導入されました。

data()も参照してください

[constexpr noexcept, since 6.4] const char *QLatin1StringView::constEnd() const

end() と同じ。

この関数は、他の Qt コンテナとの互換性のために提供されています。

この関数は Qt 6.4 で導入されました。

constBegin(),end(),cend(),crend()も参照してください

[noexcept] QLatin1StringView::const_reverse_iterator QLatin1StringView::crbegin() const

rbegin() と同じ。

この関数は STL との互換性のために提供されている。

crend(),rbegin(),cbegin()も参照

[noexcept] QLatin1StringView::const_reverse_iterator QLatin1StringView::crend() const

rend() と同じ。

この関数は STL との互換性のために提供されている。

crbegin(),rend(),cend()も参照

[constexpr noexcept] const char *QLatin1StringView::data() const

このオブジェクトが参照する Latin-1 文字列の開始位置を返します。

[constexpr noexcept, since 6.4] bool QLatin1StringView::empty() const

このオブジェクトが参照する Latin-1 文字列が空(size() == 0 )かどうかを返します。

この関数は STL との互換性のために提供されています。

この関数は Qt 6.4 で導入されました。

isEmpty(),isNull(),size()も参照してください

[constexpr noexcept] QLatin1StringView::const_iterator QLatin1StringView::end() const

文字列の最後の文字の直後を指す、STL 形式のイテレータを返します。

この関数は STL との互換性のために提供されています。

begin(),cend(),rend()も参照

[constexpr, since 6.4] QLatin1Char QLatin1StringView::first() const

文字列の最初の文字を返す。at(0) またはfront() と同じ。

この関数は、他の Qt コンテナとの互換性のために提供されています。

警告 空の文字列に対してこの関数を呼び出すと、未定義の動作になります。

この関数は Qt 6.4 で導入されました。

last(),front(),back()も参照してください

[constexpr, since 6.0] QLatin1StringView QLatin1StringView::first(qsizetype n) const

この文字列ビューの最初のn 文字を含む Latin-1 文字列ビューを返す。

注意: n < 0 またはn >size() の場合の動作は未定義です。

この関数は Qt 6.0 で導入されました。

last(),startsWith(),chopped(),chop(),truncate(),slice()も参照してください

[constexpr] QLatin1Char QLatin1StringView::front() const

文字列の最初の文字を返す。at(0) と同じ。

この関数は STL との互換性のために提供されている。

警告: 空の文字列に対してこの関数を呼び出すと、未定義の動作になります。

back()、at()、operator[]()も参照

[constexpr noexcept] bool QLatin1StringView::isEmpty() const

このオブジェクトが参照する Latin-1 文字列が空 (size() == 0) かどうかを返します。

isNull() およびsize()も参照

[constexpr noexcept] bool QLatin1StringView::isNull() const

このオブジェクトが参照する Latin-1 文字列が null (data() == nullptr) かどうかを返します。

isEmpty() およびdata()も参照

[constexpr, since 6.4] QLatin1Char QLatin1StringView::last() const

文字列の最後の文字を返す。at(size() - 1) またはback() と同じ。

この関数は、他の Qt コンテナとの互換性のために提供されています。

警告 空の文字列に対してこの関数を呼び出すと、未定義の動作になります。

この関数は Qt 6.4 で導入されました。

first(),back(),front()も参照してください

[constexpr, since 6.0] QLatin1StringView QLatin1StringView::last(qsizetype n) const

この文字列ビューの最後のn 文字を含む Latin-1 文字列ビューを返す。

注意: n < 0 またはn >size() の場合の動作は未定義です。

この関数は Qt 6.0 で導入されました。

first(),endsWith(),chopped(),chop(),truncate(),slice()も参照してください

[noexcept, since 6.3] qsizetype QLatin1StringView::lastIndexOf(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

これはオーバーロードされた関数です。

この関数は Qt 6.3 で導入されました。

[constexpr noexcept] const char *QLatin1StringView::latin1() const

このオブジェクトが参照する Latin-1 文字列の開始位置を返します。

[constexpr] QLatin1StringView QLatin1StringView::left(qsizetype length) const

length が範囲外であってはならないことが分かっている場合、新しいコードではfirst() を代わりに使ってください。

このLatin-1文字列ビューの位置0から始まる長さlength の部分文字列を返します。

lengthsize() 以上、または 0 未満の場合は、Latin-1 文字列ビュー全体が返されます。

first()、last()、sliced()、startsWith()、chopped()、chop()、truncate()、slice()も参照

[constexpr noexcept, since 6.4] qsizetype QLatin1StringView::length() const

size() と同じ。

この関数は、他の Qt コンテナとの互換性のために提供されています。

この関数は Qt 6.4 で導入されました。

[static constexpr noexcept, since 6.8] qsizetype QLatin1StringView::maxSize()

文字列ビューが理論的に表現できる要素の最大数を返します。実際には、システムで利用可能なメモリ量によって制限されるため、この数はもっと少なくなります。

この関数は Qt 6.8 で導入されました。

[constexpr noexcept, since 6.8] qsizetype QLatin1StringView::max_size() const

この関数は STL との互換性のために提供されている。

maxSize() を返します。

この関数は Qt 6.8 で導入されました。

[constexpr] QLatin1StringView QLatin1StringView::mid(qsizetype start, qsizetype length = -1) const

この Latin-1 文字列ビューの位置start から始まる長さlength の部分文字列を返す。

startlength が範囲外であってはならないことが分かっている場合、新しいコードではsliced() を代わりに使ってください。

start がこの文字列ビューの長さを超える場合は、空の Latin-1 文字列ビューを返します。この文字列ビューで使用可能な文字がstart から始まるlength 未満の場合、またはlength が負(デフォルト)の場合、この関数はstart から使用可能なすべての文字を返します。

first()、last()、sliced()、chopped()、chop()、truncate()、slice()も参照

[noexcept] QLatin1StringView::const_reverse_iterator QLatin1StringView::rbegin() const

文字列の最初の文字を逆順で指す constSTL 形式の逆順イテレータを返します。

この関数は STL との互換性のために提供されています。

rend(),crbegin(),begin()も参照

[noexcept] QLatin1StringView::const_reverse_iterator QLatin1StringView::rend() const

文字列の最後の文字の直後を指すSTL 形式の逆順イテレータを返します。

この関数は STL との互換性のために用意されています。

rbegin(),crend(),end()も参照

length が範囲外であってはならないことが分かっている場合、新しいコードではlast() を代わりに使う。

このLatin-1文字列ビューの位置size() -length から始まる長さlength の部分文字列を返します。

lengthsize() 以上、または 0 以下の場合は、Latin-1 文字列ビュー全体が返されます。

first()、last()、sliced()、endsWith()、chopped()、chop()、truncate()、slice()も参照のこと

[constexpr noexcept] qsizetype QLatin1StringView::size() const

このオブジェクトが参照する Latin-1 文字列のサイズを返します。

注意: Qt 6 より前のバージョンでは、この関数はint を返し、64 ビットアーキテクチャでQLatin1StringView に保持できるデータ量を制限していました。

[constexpr, since 6.8] QLatin1StringView &QLatin1StringView::slice(qsizetype pos)

この Latin-1 文字列ビューをpos の位置から開始し、その終端まで拡張するように変更します。

注意: pos < 0 またはpos >size() の場合の動作は未定義です。

この関数は Qt 6.8 で導入されました。

sliced(),first(),last(),chopped(),chop(),truncate()も参照してください

[constexpr, since 6.8] QLatin1StringView &QLatin1StringView::slice(qsizetype pos, qsizetype n)

これはオーバーロードされた関数である。

n この Latin-1 文字列ビューをpos の位置から開始するように変更します。

注意: pos < 0,n < 0,pos + n > size() の場合の動作は未定義です。

この関数は Qt 6.8 で導入されました。

sliced(),first(),last(),chopped(),chop(),truncate()も参照してください

[constexpr, since 6.0] QLatin1StringView QLatin1StringView::sliced(qsizetype pos) const

この文字列ビューの位置pos から始まり、その終わりまで伸びる Latin-1 文字列ビューを返す。

注意: pos < 0 またはpos >size() の場合の動作は未定義です。

この関数は Qt 6.0 で導入されました。

first(),last(),chopped(),chop(),truncate(),slice()も参照してください

[constexpr, since 6.0] QLatin1StringView QLatin1StringView::sliced(qsizetype pos, qsizetype n) const

pos の位置から始まる、この文字列ビューのn 文字を指す Latin-1 文字列ビューを返します。

注意: pos < 0,n < 0,pos + n > size() の場合の動作は未定義です。

この関数は Qt 6.0 で導入されました。

first(),last(),chopped(),chop(),truncate(),slice()も参照してください

[since 6.0] QString QLatin1StringView::toString() const

この Latin-1 文字列をQString に変換します。

return QString(*this);

この関数は Qt 6.0 で導入されました。

[noexcept] QLatin1StringView QLatin1StringView::trimmed() const

先頭と末尾の空白を除去し、結果を返す。

空白文字とは、QChar::isSpace() がtrue を返す文字のことです。これには、ASCII キ ャラクタ ' \t'、' \n'、'˶v'、'˶f'、'˶r'、および ' が含まれます。

[constexpr] void QLatin1StringView::truncate(qsizetype length)

この文字列をlength の長さに切り詰める。

*this = left(length) と同じ。

注意: length < 0 またはlength >size() の場合の動作は未定義。

sliced()、first()、last()、chopped()、chop()も参照のこと

[constexpr] QLatin1Char QLatin1StringView::operator[](qsizetype pos) const

このオブジェクトの位置pos にある文字を返します。

注意: この関数はエラーチェックを行わない。pos < 0 またはpos >=size() のときの動作は未定義である。

at()も参照

関連する非会員

[noexcept] bool operator!=(const QChar &lhs, const QLatin1StringView &rhs)

charlhs が字句解析的に文字列rhs と等しくない場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator!=(const QLatin1StringView &lhs, const QChar &rhs)

文字列lhs が字句解析的に charrhs と等しくない場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator!=(const QLatin1StringView &lhs, const QLatin1StringView &rhs)

文字列lhs が字句解析的に文字列rhs と等しくない場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator!=(const QLatin1StringView &lhs, const QStringView &rhs)

文字列lhs が字句解析的に文字列ビューrhs と等しくない場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator!=(const QLatin1StringView &lhs, const char *const &rhs)

文字列lhs が const char ポインタrhs と等しくなければtrue を返し、そうでなければfalse を返す。

rhs const charポインタはQUtf8StringView に変換される。

アプリケーションのコンパイル時にQT_NO_CAST_FROM_ASCII を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザが見える文字列がすべてQObject::tr() を通過するようにしたい場合に便利です。

Comparing Stringsも参照のこと

[noexcept] bool operator!=(const QStringView &lhs, const QLatin1StringView &rhs)

文字列ビューlhs が字句解析的に文字列rhs と等しくない場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator!=(const char *const &lhs, const QLatin1StringView &rhs)

const char ポインタlhs がレキシカルに文字列rhs と等しくない場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator!=(const QLatin1StringView &lhs, const QByteArray &rhs)

この関数はoperator!=()をオーバーロードする。

rhs バイト配列はQUtf8StringView に変換される。

アプリケーションのコンパイル時にQT_NO_CAST_FROM_ASCII を定義することで、この演算子を無効にすることができます。これは、たとえば、すべてのユーザー可視文字列がQObject::tr() を通過するようにしたい場合に便利です。

[constexpr noexcept, since 6.4] QLatin1StringView operator""_L1(const char *str, size_t size)

文字列リテラルstr の最初の文字size からQLatin1StringView を作成するリテラル演算子。

次のコードは、QLatin1StringView を作成します:

using namespace Qt::Literals::StringLiterals;

auto str = "hello"_L1;

この関数は Qt 6.4 で導入されました。

Qt::Literals::StringLiteralsも参照してください

[noexcept] bool operator<(const QChar &lhs, const QLatin1StringView &rhs)

文字lhs が文字列rhs よりレキシカルに小さい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator<(const QLatin1StringView &lhs, const QChar &rhs)

文字列lhs が字句解析的に charrhs より小さい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator<(const QLatin1StringView &lhs, const QLatin1StringView &rhs)

文字列lhs が文字列rhs より語彙的に小さい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator<(const QLatin1StringView &lhs, const QStringView &rhs)

文字列lhs が文字列ビューrhs よりレキシカルに小さい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator<(const QLatin1StringView &lhs, const char *const &rhs)

文字列lhs がレキシカルに const char ポインタrhs より小さい場合はtrue を返し、そうでない場合はfalse を返す。

rhs const charポインタはQUtf8StringView に変換される。

アプリケーションのコンパイル時にQT_NO_CAST_FROM_ASCII を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザから見える文字列がすべてQObject::tr() を通過するようにしたい場合に便利です。

Comparing Stringsも参照のこと

[noexcept] bool operator<(const QStringView &lhs, const QLatin1StringView &rhs)

文字列ビューlhs が文字列rhs よりレキシカルに小さい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator<(const char *const &lhs, const QLatin1StringView &rhs)

文字列rhs よりも const char ポインタlhs の方が字句解析的に小さい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator<(const QLatin1StringView &lhs, const QByteArray &rhs)

これはオーバーロードされた関数である。

rhs バイト配列はQUtf8StringView に変換される。

アプリケーションのコンパイル時にQT_NO_CAST_FROM_ASCII を定義することで、この演算子を無効にすることができます。これは、たとえば、すべてのユーザー可視文字列がQObject::tr() を通過するようにしたい場合に便利です。

[noexcept] bool operator<=(const QChar &lhs, const QLatin1StringView &rhs)

文字列lhs が字句解析的に文字列rhs 以下であればtrue を返し、そうでなければfalse を返す。

[noexcept] bool operator<=(const QLatin1StringView &lhs, const QChar &rhs)

文字列lhs が字句解析的に文字rhs 以下の場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator<=(const QLatin1StringView &lhs, const QLatin1StringView &rhs)

文字列lhs が字句解析的に文字列rhs 以下であればtrue を返し、そうでなければfalse を返す。

[noexcept] bool operator<=(const QLatin1StringView &lhs, const QStringView &rhs)

文字列lhs が字句解析的に文字列ビューrhs 以下であればtrue を返し、そうでなければfalse を返す。

[noexcept] bool operator<=(const QLatin1StringView &lhs, const char *const &rhs)

文字列lhs がレキシカルに const char ポインタrhs 以下であればtrue を返し、そうでなければfalse を返す。

rhs const charポインタはQUtf8StringView に変換される。

アプリケーションのコンパイル時にQT_NO_CAST_FROM_ASCII を定義することで、この演算子を無効にすることができます。これは、例えば、すべてのユーザー可視文字列がQObject::tr() を通過するようにしたい場合に便利です。

Comparing Stringsも参照のこと

[noexcept] bool operator<=(const QStringView &lhs, const QLatin1StringView &rhs)

文字列ビューlhs がレキシカルに文字列rhs 以下であればtrue を返し、そうでなければfalse を返す。

[noexcept] bool operator<=(const char *const &lhs, const QLatin1StringView &rhs)

const char ポインタlhs がレキシカルに文字列rhs 以下であればtrue を返し、そうでなければfalse を返す。

[noexcept] bool operator<=(const QLatin1StringView &lhs, const QByteArray &rhs)

これはオーバーロードされた関数である。

rhs バイト配列はQUtf8StringView に変換される。

アプリケーションのコンパイル時にQT_NO_CAST_FROM_ASCII を定義することで、この演算子を無効にすることができます。これは、たとえば、すべてのユーザー可視文字列がQObject::tr() を通過するようにしたい場合に便利です。

[noexcept] bool operator==(const QChar &lhs, const QLatin1StringView &rhs)

charlhs が字句解析的に文字列rhs と等しい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator==(const QLatin1StringView &lhs, const QChar &rhs)

文字列lhs が字句解析的に charrhs と等しい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator==(const QLatin1StringView &lhs, const QLatin1StringView &rhs)

文字列lhs が文字列rhs と語彙的に等しい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator==(const QLatin1StringView &lhs, const QStringView &rhs)

文字列lhs が文字列ビューrhs と語彙的に等しい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator==(const QLatin1StringView &lhs, const char *const &rhs)

文字列lhs が const char ポインタrhs と等しければtrue を返し、そうでなければfalse を返す。

rhs const charポインタはQUtf8StringView に変換される。

アプリケーションのコンパイル時にQT_NO_CAST_FROM_ASCII を定義することで、この演算子を無効にすることができます。これは、例えば、すべてのユーザー可視文字列がQObject::tr() を通過するようにしたい場合に便利です。

Comparing Stringsも参照のこと

[noexcept] bool operator==(const QStringView &lhs, const QLatin1StringView &rhs)

文字列ビューlhs が文字列rhs と語彙的に等しい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator==(const char *const &lhs, const QLatin1StringView &rhs)

定数 char ポインタlhs が文字列rhs とレキシカルに等しい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator==(const QLatin1StringView &lhs, const QByteArray &rhs)

これはオーバーロードされた関数である。

rhs バイト配列はQUtf8StringView に変換される。

アプリケーションのコンパイル時にQT_NO_CAST_FROM_ASCII を定義することで、この演算子を無効にすることができます。これは、たとえば、すべてのユーザー可視文字列がQObject::tr() を通過するようにしたい場合に便利です。

[noexcept] bool operator>(const QChar &lhs, const QLatin1StringView &rhs)

文字列rhs よりも文字列lhs の方が語彙的に大きい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator>(const QLatin1StringView &lhs, const QChar &rhs)

文字列lhs が文字列rhs より語彙的に大きい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator>(const QLatin1StringView &lhs, const QLatin1StringView &rhs)

文字列lhs が文字列rhs より語彙的に大きい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator>(const QLatin1StringView &lhs, const QStringView &rhs)

文字列lhs が文字列ビューrhs より語彙的に大きい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator>(const QLatin1StringView &lhs, const char *const &rhs)

文字列lhs がレキシカルに const char ポインタrhs より大きければtrue を返し、そうでなければfalse を返す。

rhs const charポインタはQUtf8StringView に変換される。

アプリケーションのコンパイル時にQT_NO_CAST_FROM_ASCII を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザから見える文字列がすべてQObject::tr() を通過するようにしたい場合に便利です。

Comparing Stringsも参照のこと

[noexcept] bool operator>(const QStringView &lhs, const QLatin1StringView &rhs)

文字列ビューlhs が文字列rhs より語彙的に大きい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator>(const char *const &lhs, const QLatin1StringView &rhs)

文字列rhs よりも const char ポインタlhs が字句の並び上大きい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator>(const QLatin1StringView &lhs, const QByteArray &rhs)

これはオーバーロードされた関数である。

rhs バイト配列はQUtf8StringView に変換される。

アプリケーションのコンパイル時にQT_NO_CAST_FROM_ASCII を定義することで、この演算子を無効にすることができます。これは、たとえば、すべてのユーザー可視文字列がQObject::tr() を通過するようにしたい場合に便利です。

[noexcept] bool operator>=(const QChar &lhs, const QLatin1StringView &rhs)

文字列lhs が字句解析的に文字列rhs 以上であればtrue を返し、そうでなければfalse を返す。

[noexcept] bool operator>=(const QLatin1StringView &lhs, const QChar &rhs)

文字列lhs が字句解析的に文字rhs 以上であればtrue を返し、そうでなければfalse を返す。

[noexcept] bool operator>=(const QLatin1StringView &lhs, const QLatin1StringView &rhs)

文字列lhs が字句解析的に文字列rhs 以上であればtrue を返し、そうでなければfalse を返す。

[noexcept] bool operator>=(const QLatin1StringView &lhs, const QStringView &rhs)

文字列lhs が文字列ビューrhs と語彙的に等しいか大きい場合はtrue を返し、そうでない場合はfalse を返す。

[noexcept] bool operator>=(const QLatin1StringView &lhs, const char *const &rhs)

文字列lhs がレキシカルに const char ポインタrhs 以上であればtrue を返し、そうでなければfalse を返す。

rhs const charポインタはQUtf8StringView に変換される。

アプリケーションのコンパイル時にQT_NO_CAST_FROM_ASCII を定義することで、この演算子を無効にすることができます。これは、例えば、すべてのユーザー可視文字列がQObject::tr() を通過するようにしたい場合に便利です。

Comparing Stringsも参照のこと

[noexcept] bool operator>=(const QStringView &lhs, const QLatin1StringView &rhs)

文字列ビューlhs がレキシカルに文字列rhs 以上であればtrue を返し、そうでなければfalse を返す。

[noexcept] bool operator>=(const char *const &lhs, const QLatin1StringView &rhs)

const char ポインタlhs がレキシカルに文字列rhs 以上であればtrue を返し、そうでなければfalse を返す。

[noexcept] bool operator>=(const QLatin1StringView &lhs, const QByteArray &rhs)

これはオーバーロードされた関数である。

rhs バイト配列はQUtf8StringView に変換される。

アプリケーションのコンパイル時にQT_NO_CAST_FROM_ASCII を定義することで、この演算子を無効にすることができます。これは、たとえば、すべてのユーザー可視文字列がQObject::tr() を通過するようにしたい場合に便利です。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.