QHttpHeaders Class
QHttpHeaders は HTTP ヘッダーを保持するクラスです。詳細...
ヘッダー | #include <QHttpHeaders> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Network) target_link_libraries(mytarget PRIVATE Qt6::Network) |
qmake: | QT += network |
以来: | Qt 6.7 |
パブリックな型
enum class | WellKnownHeader { AIM, Accept, AcceptAdditions, AcceptCH, AcceptDatetime, …, ProtocolQuery } |
パブリック関数
QHttpHeaders() | |
QHttpHeaders(const QHttpHeaders &other) | |
QHttpHeaders(QHttpHeaders &&other) | |
~QHttpHeaders() | |
bool | append(QAnyStringView name, QAnyStringView value) |
bool | append(QHttpHeaders::WellKnownHeader name, QAnyStringView value) |
void | clear() |
QByteArray | combinedValue(QAnyStringView name) const |
QByteArray | combinedValue(QHttpHeaders::WellKnownHeader name) const |
bool | contains(QAnyStringView name) const |
bool | contains(QHttpHeaders::WellKnownHeader name) const |
(since 6.10) std::optional<QDateTime> | dateTimeValue(QAnyStringView name) const |
(since 6.10) std::optional<QDateTime> | dateTimeValue(QHttpHeaders::WellKnownHeader name) const |
(since 6.10) std::optional<QDateTime> | dateTimeValueAt(qsizetype i) const |
(since 6.10) std::optional<QList<QDateTime>> | dateTimeValues(QAnyStringView name) const |
(since 6.10) std::optional<QList<QDateTime>> | dateTimeValues(QHttpHeaders::WellKnownHeader name) const |
bool | insert(qsizetype i, QAnyStringView name, QAnyStringView value) |
bool | insert(qsizetype i, QHttpHeaders::WellKnownHeader name, QAnyStringView value) |
(since 6.10) std::optional<qint64> | intValue(QAnyStringView name) const |
(since 6.10) std::optional<qint64> | intValue(QHttpHeaders::WellKnownHeader name) const |
(since 6.10) std::optional<qint64> | intValueAt(qsizetype i) const |
(since 6.10) std::optional<QList<qint64>> | intValues(QAnyStringView name) const |
(since 6.10) std::optional<QList<qint64>> | intValues(QHttpHeaders::WellKnownHeader name) const |
bool | isEmpty() const |
QLatin1StringView | nameAt(qsizetype i) const |
void | removeAll(QAnyStringView name) |
void | removeAll(QHttpHeaders::WellKnownHeader name) |
void | removeAt(qsizetype i) |
bool | replace(qsizetype i, QAnyStringView name, QAnyStringView newValue) |
bool | replace(qsizetype i, QHttpHeaders::WellKnownHeader name, QAnyStringView newValue) |
(since 6.8) bool | replaceOrAppend(QHttpHeaders::WellKnownHeader name, QAnyStringView newValue) |
bool | replaceOrAppend(QAnyStringView name, QAnyStringView newValue) |
void | reserve(qsizetype size) |
(since 6.10) void | setDateTimeValue(QAnyStringView name, const QDateTime &dateTime) |
(since 6.10) void | setDateTimeValue(QHttpHeaders::WellKnownHeader name, const QDateTime &dateTime) |
qsizetype | size() const |
void | swap(QHttpHeaders &other) |
QList<std::pair<QByteArray, QByteArray>> | toListOfPairs() const |
QMultiHash<QByteArray, QByteArray> | toMultiHash() const |
QMultiMap<QByteArray, QByteArray> | toMultiMap() const |
QByteArrayView | value(QAnyStringView name, QByteArrayView defaultValue = {}) const |
QByteArrayView | value(QHttpHeaders::WellKnownHeader name, QByteArrayView defaultValue = {}) const |
QByteArrayView | valueAt(qsizetype i) const |
QList<QByteArray> | values(QAnyStringView name) const |
QList<QByteArray> | values(QHttpHeaders::WellKnownHeader name) const |
QHttpHeaders & | operator=(QHttpHeaders &&other) |
QHttpHeaders & | operator=(const QHttpHeaders &other) |
静的パブリックメンバ
QHttpHeaders | fromListOfPairs(const QList<std::pair<QByteArray, QByteArray>> &headers) |
QHttpHeaders | fromMultiHash(const QMultiHash<QByteArray, QByteArray> &headers) |
QHttpHeaders | fromMultiMap(const QMultiMap<QByteArray, QByteArray> &headers) |
QByteArrayView | wellKnownHeaderName(QHttpHeaders::WellKnownHeader name) |
関連する非メンバー
QDebug | operator<<(QDebug debug, const QHttpHeaders &headers) |
詳細説明
このクラスは、このようなヘッダを使用または消費する Qt Networking API 用のインタフェース型です。
フィールド名と値の文字
HTTP ヘッダは名前と 値から構成されます。これらを設定する際、QHttpHeaders はnameとvalueが HTTP RFC で許可されている文字のみを含むかどうかを検証します。詳しい情報はRFC 9110の5.1章と5.5章を参照してください。
つまり
name
可視ASCII文字で構成され、空であってはならない。value
value
は空でもよい。
このクラスのセッターは、値の先頭や末尾の空白を自動的に取り除きます。
値の組み合わせ
ほとんどの HTTP ヘッダ値は、コンマ','
とオプションの空白文字で組み合わせることができ、 意味は保持されます。例として、これら二つは意味的に似ているはずです:
// Values as separate header entries myheadername: myheadervalue1 myheadername: myheadervalue2 // Combined value myheadername: myheadervalue1, myheadervalue2
しかし、このルールには顕著な例外があります:Set-Cookieである。このことと、カスタムな使用例の可能性のために、QHttpHeaders は自動的に値を結合しません。
パフォーマンス
ほとんどの QHttpHeaders 関数は、QHttpHeaders::WellKnownHeader とQAnyStringView の両方のオーバーロードを提供します。メモリ使用量と計算量の観点から、QHttpHeaders::WellKnownHeader のオーバーロードを使用することをお勧めします。
メンバ型ドキュメント
enum class QHttpHeaders::WellKnownHeader
IANA レジストリによる、よく知られたヘッダのリスト。
定数 | 値 |
---|---|
QHttpHeaders::WellKnownHeader::AIM | 0 |
QHttpHeaders::WellKnownHeader::Accept | 1 |
QHttpHeaders::WellKnownHeader::AcceptAdditions | 2 |
QHttpHeaders::WellKnownHeader::AcceptCH | 3 |
QHttpHeaders::WellKnownHeader::AcceptDatetime | 4 |
QHttpHeaders::WellKnownHeader::AcceptEncoding | 5 |
QHttpHeaders::WellKnownHeader::AcceptFeatures | 6 |
QHttpHeaders::WellKnownHeader::AcceptLanguage | 7 |
QHttpHeaders::WellKnownHeader::AcceptPatch | 8 |
QHttpHeaders::WellKnownHeader::AcceptPost | 9 |
QHttpHeaders::WellKnownHeader::AcceptRanges | 10 |
QHttpHeaders::WellKnownHeader::AcceptSignature | 11 |
QHttpHeaders::WellKnownHeader::AccessControlAllowCredentials | 12 |
QHttpHeaders::WellKnownHeader::AccessControlAllowHeaders | 13 |
QHttpHeaders::WellKnownHeader::AccessControlAllowMethods | 14 |
QHttpHeaders::WellKnownHeader::AccessControlAllowOrigin | 15 |
QHttpHeaders::WellKnownHeader::AccessControlExposeHeaders | 16 |
QHttpHeaders::WellKnownHeader::AccessControlMaxAge | 17 |
QHttpHeaders::WellKnownHeader::AccessControlRequestHeaders | 18 |
QHttpHeaders::WellKnownHeader::AccessControlRequestMethod | 19 |
QHttpHeaders::WellKnownHeader::Age | 20 |
QHttpHeaders::WellKnownHeader::Allow | 21 |
QHttpHeaders::WellKnownHeader::ALPN | 22 |
QHttpHeaders::WellKnownHeader::AltSvc | 23 |
QHttpHeaders::WellKnownHeader::AltUsed | 24 |
QHttpHeaders::WellKnownHeader::Alternates | 25 |
QHttpHeaders::WellKnownHeader::ApplyToRedirectRef | 26 |
QHttpHeaders::WellKnownHeader::AuthenticationControl | 27 |
QHttpHeaders::WellKnownHeader::AuthenticationInfo | 28 |
QHttpHeaders::WellKnownHeader::Authorization | 29 |
QHttpHeaders::WellKnownHeader::CacheControl | 30 |
QHttpHeaders::WellKnownHeader::CacheStatus | 31 |
QHttpHeaders::WellKnownHeader::CalManagedID | 32 |
QHttpHeaders::WellKnownHeader::CalDAVTimezones | 33 |
QHttpHeaders::WellKnownHeader::CapsuleProtocol | 34 |
QHttpHeaders::WellKnownHeader::CDNCacheControl | 35 |
QHttpHeaders::WellKnownHeader::CDNLoop | 36 |
QHttpHeaders::WellKnownHeader::CertNotAfter | 37 |
QHttpHeaders::WellKnownHeader::CertNotBefore | 38 |
QHttpHeaders::WellKnownHeader::ClearSiteData | 39 |
QHttpHeaders::WellKnownHeader::ClientCert | 40 |
QHttpHeaders::WellKnownHeader::ClientCertChain | 41 |
QHttpHeaders::WellKnownHeader::Close | 42 |
QHttpHeaders::WellKnownHeader::Connection | 43 |
QHttpHeaders::WellKnownHeader::ContentDigest | 44 |
QHttpHeaders::WellKnownHeader::ContentDisposition | 45 |
QHttpHeaders::WellKnownHeader::ContentEncoding | 46 |
QHttpHeaders::WellKnownHeader::ContentID | 47 |
QHttpHeaders::WellKnownHeader::ContentLanguage | 48 |
QHttpHeaders::WellKnownHeader::ContentLength | 49 |
QHttpHeaders::WellKnownHeader::ContentLocation | 50 |
QHttpHeaders::WellKnownHeader::ContentRange | 51 |
QHttpHeaders::WellKnownHeader::ContentSecurityPolicy | 52 |
QHttpHeaders::WellKnownHeader::ContentSecurityPolicyReportOnly | 53 |
QHttpHeaders::WellKnownHeader::ContentType | 54 |
QHttpHeaders::WellKnownHeader::Cookie | 55 |
QHttpHeaders::WellKnownHeader::CrossOriginEmbedderPolicy | 56 |
QHttpHeaders::WellKnownHeader::CrossOriginEmbedderPolicyReportOnly | 57 |
QHttpHeaders::WellKnownHeader::CrossOriginOpenerPolicy | 58 |
QHttpHeaders::WellKnownHeader::CrossOriginOpenerPolicyReportOnly | 59 |
QHttpHeaders::WellKnownHeader::CrossOriginResourcePolicy | 60 |
QHttpHeaders::WellKnownHeader::DASL | 61 |
QHttpHeaders::WellKnownHeader::Date | 62 |
QHttpHeaders::WellKnownHeader::DAV | 63 |
QHttpHeaders::WellKnownHeader::DeltaBase | 64 |
QHttpHeaders::WellKnownHeader::Depth | 65 |
QHttpHeaders::WellKnownHeader::Destination | 66 |
QHttpHeaders::WellKnownHeader::DifferentialID | 67 |
QHttpHeaders::WellKnownHeader::DPoP | 68 |
QHttpHeaders::WellKnownHeader::DPoPNonce | 69 |
QHttpHeaders::WellKnownHeader::EarlyData | 70 |
QHttpHeaders::WellKnownHeader::ETag | 71 |
QHttpHeaders::WellKnownHeader::Expect | 72 |
QHttpHeaders::WellKnownHeader::ExpectCT | 73 |
QHttpHeaders::WellKnownHeader::Expires | 74 |
QHttpHeaders::WellKnownHeader::Forwarded | 75 |
QHttpHeaders::WellKnownHeader::From | 76 |
QHttpHeaders::WellKnownHeader::Hobareg | 77 |
QHttpHeaders::WellKnownHeader::Host | 78 |
QHttpHeaders::WellKnownHeader::If | 79 |
QHttpHeaders::WellKnownHeader::IfMatch | 80 |
QHttpHeaders::WellKnownHeader::IfModifiedSince | 81 |
QHttpHeaders::WellKnownHeader::IfNoneMatch | 82 |
QHttpHeaders::WellKnownHeader::IfRange | 83 |
QHttpHeaders::WellKnownHeader::IfScheduleTagMatch | 84 |
QHttpHeaders::WellKnownHeader::IfUnmodifiedSince | 85 |
QHttpHeaders::WellKnownHeader::IM | 86 |
QHttpHeaders::WellKnownHeader::IncludeReferredTokenBindingID | 87 |
QHttpHeaders::WellKnownHeader::KeepAlive | 88 |
QHttpHeaders::WellKnownHeader::Label | 89 |
QHttpHeaders::WellKnownHeader::LastEventID | 90 |
QHttpHeaders::WellKnownHeader::LastModified | 91 |
QHttpHeaders::WellKnownHeader::Link | 92 |
QHttpHeaders::WellKnownHeader::Location | 93 |
QHttpHeaders::WellKnownHeader::LockToken | 94 |
QHttpHeaders::WellKnownHeader::MaxForwards | 95 |
QHttpHeaders::WellKnownHeader::MementoDatetime | 96 |
QHttpHeaders::WellKnownHeader::Meter | 97 |
QHttpHeaders::WellKnownHeader::MIMEVersion | 98 |
QHttpHeaders::WellKnownHeader::Negotiate | 99 |
QHttpHeaders::WellKnownHeader::NEL | 100 |
QHttpHeaders::WellKnownHeader::ODataEntityId | 101 |
QHttpHeaders::WellKnownHeader::ODataIsolation | 102 |
QHttpHeaders::WellKnownHeader::ODataMaxVersion | 103 |
QHttpHeaders::WellKnownHeader::ODataVersion | 104 |
QHttpHeaders::WellKnownHeader::OptionalWWWAuthenticate | 105 |
QHttpHeaders::WellKnownHeader::OrderingType | 106 |
QHttpHeaders::WellKnownHeader::Origin | 107 |
QHttpHeaders::WellKnownHeader::OriginAgentCluster | 108 |
QHttpHeaders::WellKnownHeader::OSCORE | 109 |
QHttpHeaders::WellKnownHeader::OSLCCoreVersion | 110 |
QHttpHeaders::WellKnownHeader::Overwrite | 111 |
QHttpHeaders::WellKnownHeader::PingFrom | 112 |
QHttpHeaders::WellKnownHeader::PingTo | 113 |
QHttpHeaders::WellKnownHeader::Position | 114 |
QHttpHeaders::WellKnownHeader::Prefer | 115 |
QHttpHeaders::WellKnownHeader::PreferenceApplied | 116 |
QHttpHeaders::WellKnownHeader::Priority | 117 |
QHttpHeaders::WellKnownHeader::ProxyAuthenticate | 118 |
QHttpHeaders::WellKnownHeader::ProxyAuthenticationInfo | 119 |
QHttpHeaders::WellKnownHeader::ProxyAuthorization | 120 |
QHttpHeaders::WellKnownHeader::ProxyStatus | 121 |
QHttpHeaders::WellKnownHeader::PublicKeyPins | 122 |
QHttpHeaders::WellKnownHeader::PublicKeyPinsReportOnly | 123 |
QHttpHeaders::WellKnownHeader::Range | 124 |
QHttpHeaders::WellKnownHeader::RedirectRef | 125 |
QHttpHeaders::WellKnownHeader::Referer | 126 |
QHttpHeaders::WellKnownHeader::Refresh | 127 |
QHttpHeaders::WellKnownHeader::ReplayNonce | 128 |
QHttpHeaders::WellKnownHeader::ReprDigest | 129 |
QHttpHeaders::WellKnownHeader::RetryAfter | 130 |
QHttpHeaders::WellKnownHeader::ScheduleReply | 131 |
QHttpHeaders::WellKnownHeader::ScheduleTag | 132 |
QHttpHeaders::WellKnownHeader::SecPurpose | 133 |
QHttpHeaders::WellKnownHeader::SecTokenBinding | 134 |
QHttpHeaders::WellKnownHeader::SecWebSocketAccept | 135 |
QHttpHeaders::WellKnownHeader::SecWebSocketExtensions | 136 |
QHttpHeaders::WellKnownHeader::SecWebSocketKey | 137 |
QHttpHeaders::WellKnownHeader::SecWebSocketProtocol | 138 |
QHttpHeaders::WellKnownHeader::SecWebSocketVersion | 139 |
QHttpHeaders::WellKnownHeader::Server | 140 |
QHttpHeaders::WellKnownHeader::ServerTiming | 141 |
QHttpHeaders::WellKnownHeader::SetCookie | 142 |
QHttpHeaders::WellKnownHeader::Signature | 143 |
QHttpHeaders::WellKnownHeader::SignatureInput | 144 |
QHttpHeaders::WellKnownHeader::SLUG | 145 |
QHttpHeaders::WellKnownHeader::SoapAction | 146 |
QHttpHeaders::WellKnownHeader::StatusURI | 147 |
QHttpHeaders::WellKnownHeader::StrictTransportSecurity | 148 |
QHttpHeaders::WellKnownHeader::Sunset | 149 |
QHttpHeaders::WellKnownHeader::SurrogateCapability | 150 |
QHttpHeaders::WellKnownHeader::SurrogateControl | 151 |
QHttpHeaders::WellKnownHeader::TCN | 152 |
QHttpHeaders::WellKnownHeader::TE | 153 |
QHttpHeaders::WellKnownHeader::Timeout | 154 |
QHttpHeaders::WellKnownHeader::Topic | 155 |
QHttpHeaders::WellKnownHeader::Traceparent | 156 |
QHttpHeaders::WellKnownHeader::Tracestate | 157 |
QHttpHeaders::WellKnownHeader::Trailer | 158 |
QHttpHeaders::WellKnownHeader::TransferEncoding | 159 |
QHttpHeaders::WellKnownHeader::TTL | 160 |
QHttpHeaders::WellKnownHeader::Upgrade | 161 |
QHttpHeaders::WellKnownHeader::Urgency | 162 |
QHttpHeaders::WellKnownHeader::UserAgent | 163 |
QHttpHeaders::WellKnownHeader::VariantVary | 164 |
QHttpHeaders::WellKnownHeader::Vary | 165 |
QHttpHeaders::WellKnownHeader::Via | 166 |
QHttpHeaders::WellKnownHeader::WantContentDigest | 167 |
QHttpHeaders::WellKnownHeader::WantReprDigest | 168 |
QHttpHeaders::WellKnownHeader::WWWAuthenticate | 169 |
QHttpHeaders::WellKnownHeader::XContentTypeOptions | 170 |
QHttpHeaders::WellKnownHeader::XFrameOptions | 171 |
QHttpHeaders::WellKnownHeader::AcceptCharset | 172 |
QHttpHeaders::WellKnownHeader::CPEPInfo | 173 |
QHttpHeaders::WellKnownHeader::Pragma | 174 |
QHttpHeaders::WellKnownHeader::ProtocolInfo | 175 |
QHttpHeaders::WellKnownHeader::ProtocolQuery | 176 |
メンバ関数のドキュメント
[noexcept]
QHttpHeaders::QHttpHeaders()
新しい QHttpHeaders オブジェクトを作成します。
QHttpHeaders::QHttpHeaders(const QHttpHeaders &other)
other のコピーを作成する。
[noexcept]
QHttpHeaders::QHttpHeaders(QHttpHeaders &&other)
移動-other からオブジェクトを構築し、empty に残す。
[noexcept]
QHttpHeaders::~QHttpHeaders()
ヘッダーオブジェクトを破棄します。
bool QHttpHeaders::append(QAnyStringView name, QAnyStringView value)
ヘッダエントリをname とvalue で追加し、成功した場合はtrue
を返します。
append(QHttpHeaders::WellKnownHeader, QAnyStringView) およびAllowed field name and value charactersも参照してください 。
bool QHttpHeaders::append(QHttpHeaders::WellKnownHeader name, QAnyStringView value)
この関数はQHttpHeaders::append(QAnyStringView, QAnyStringView) をオーバーロードします。
void QHttpHeaders::clear()
すべてのヘッダー・エントリーをクリアする。
size()も参照のこと 。
QByteArray QHttpHeaders::combinedValue(QAnyStringView name) const
ヘッダーname の値をカンマで結合した文字列で返す。name を持つヘッダーが存在しない場合、null
QByteArray を返す。
注意: 'Set-Cookie'ヘッダーの値にこの方法でアクセスすることは、 意図したようには動作しないかもしれない。HTTPのRFCでは、この方法で値を組み合わせることができないという、特筆すべき例外があります。代わりにvalues() を使ってください。
values(QAnyStringView)も 参照してください。
QByteArray QHttpHeaders::combinedValue(QHttpHeaders::WellKnownHeader name) const
この関数はQHttpHeaders::combinedValue(QAnyStringView) をオーバーロードします。
bool QHttpHeaders::contains(QAnyStringView name) const
ヘッダにname のヘッダが含まれているかどうかを返します。
contains(QHttpHeaders::WellKnownHeader)も参照してください 。
bool QHttpHeaders::contains(QHttpHeaders::WellKnownHeader name) const
この関数は QHttpHeaders::has(QAnyStringView) をオーバーロードします。
[since 6.10]
std::optional<QDateTime> QHttpHeaders::dateTimeValue(QAnyStringView name) const
最初に見つかったname のヘッダー値を、標準的なHTTPの日付書式に従って、QDateTime オブジェクトに変換する。ヘッダが存在しないか、無効なQDateTime を含む場合は、std::nullopt
を返します。
この関数は Qt 6.10 で導入されました。
setDateTimeValue()、dateTimeValues(QAnyStringView name)、dateTimeValueAt(qsizetype i)も参照してください 。
[since 6.10]
std::optional<QDateTime> QHttpHeaders::dateTimeValue(QHttpHeaders::WellKnownHeader name) const
この関数はQHttpHeaders::dateTimeValue(QAnyStringView) をオーバーロードしています。
この関数は Qt 6.10 で導入されました。
[since 6.10]
std::optional<QDateTime> QHttpHeaders::dateTimeValueAt(qsizetype i) const
インデックスi のヘッダー値を、標準HTTP日付書式に従ったQDateTime オブジェクトに変換する。インデックスi は有効でなければなりません。
この関数は Qt 6.10 で導入されました。
dateTimeValue(QAnyStringView name) およびdateTimeValues(QAnyStringView name)も参照してください 。
[since 6.10]
std::optional<QList<QDateTime>> QHttpHeaders::dateTimeValues(QAnyStringView name) const
QDateTime オブジェクトのリストにあるname のすべてのヘッダ値を、標準の HTTP 日付書式に従って返します。有効な日付時刻値が見つからない場合は、std::nullopt
を返します。
この関数は Qt 6.10 で導入されました。
dateTimeValue(QAnyStringView name) およびdateTimeValueAt(qsizetype i)も参照してください 。
[since 6.10]
std::optional<QList<QDateTime>> QHttpHeaders::dateTimeValues(QHttpHeaders::WellKnownHeader name) const
この関数はQHttpHeaders::dateTimeValues(QAnyStringView) をオーバーロードしています。
この関数は Qt 6.10 で導入されました。
[static]
QHttpHeaders QHttpHeaders::fromListOfPairs(const QList<std::pair<QByteArray, QByteArray>> &headers)
headers を含む新しいQHttpHeaders オブジェクトを作成する。
Allowed field name and value charactersも参照 。
[static]
QHttpHeaders QHttpHeaders::fromMultiHash(const QMultiHash<QByteArray, QByteArray> &headers)
headers を含む新しいQHttpHeaders オブジェクトを作成する。
Allowed field name and value charactersも参照 。
[static]
QHttpHeaders QHttpHeaders::fromMultiMap(const QMultiMap<QByteArray, QByteArray> &headers)
headers を含む新しいQHttpHeaders オブジェクトを作成する。
Allowed field name and value charactersも参照 。
bool QHttpHeaders::insert(qsizetype i, QAnyStringView name, QAnyStringView value)
name valueインデックスi にヘッダーエントリーを挿入する。インデックスは有効でなければならない (size() を参照)。挿入が成功したかどうかを返します。
append()、insert(qsizetype, QHttpHeaders::WellKnownHeader, QAnyStringView)、size()、およびAllowed field name and value charactersも参照してください 。
bool QHttpHeaders::insert(qsizetype i, QHttpHeaders::WellKnownHeader name, QAnyStringView value)
この関数はQHttpHeaders::insert(qsizetype, QAnyStringView, QAnyStringView) をオーバーロードします。
[noexcept, since 6.10]
std::optional<qint64> QHttpHeaders::intValue(QAnyStringView name) const
64ビット整数として解釈される最初の有効なヘッダーname の値を返す。ヘッダが存在しないか、整数として解析できない場合は、std::nullopt
を返します。
この関数は Qt 6.10 で導入されました。
intValues(QAnyStringView name) およびintValueAt(qsizetype i)も参照してください 。
[noexcept, since 6.10]
std::optional<qint64> QHttpHeaders::intValue(QHttpHeaders::WellKnownHeader name) const
この関数はQHttpHeaders::intValue(QAnyStringView) をオーバーロードしています。
この関数は Qt 6.10 で導入されました。
[noexcept, since 6.10]
std::optional<qint64> QHttpHeaders::intValueAt(qsizetype i) const
インデックスi で64ビット整数として解釈されるヘッダー値を返す。インデックスi は有効でなければなりません。
この関数は Qt 6.10 で導入されました。
intValues(QAnyStringView name) およびintValue(QAnyStringView name)も参照してください 。
[since 6.10]
std::optional<QList<qint64>> QHttpHeaders::intValues(QAnyStringView name) const
64ビット整数として解釈されたヘッダーname の値をリストで返す。ヘッダが存在しないか、整数として解析できない場合は、std::nullopt
を返します。
この関数は Qt 6.10 で導入されました。
intValue(QAnyStringView name) およびintValueAt(qsizetype i)も参照してください 。
[since 6.10]
std::optional<QList<qint64>> QHttpHeaders::intValues(QHttpHeaders::WellKnownHeader name) const
この関数はQHttpHeaders::intValues(QAnyStringView) をオーバーロードしています。
この関数は Qt 6.10 で導入されました。
[noexcept]
bool QHttpHeaders::isEmpty() const
ヘッダーのサイズが 0 の場合はtrue
を返し、そうでない場合はfalse
を返す。
size()も参照のこと 。
[noexcept]
QLatin1StringView QHttpHeaders::nameAt(qsizetype i) const
インデックスi にあるヘッダー名を返す。インデックスi は有効でなければならない (size() を参照)。
ヘッダー名は大文字小文字を区別しません。
void QHttpHeaders::removeAll(QAnyStringView name)
ヘッダname を削除します。
removeAt() およびremoveAll(QHttpHeaders::WellKnownHeader)も参照してください 。
void QHttpHeaders::removeAll(QHttpHeaders::WellKnownHeader name)
この関数はQHttpHeaders::removeAll(QAnyStringView) をオーバーロードします。
void QHttpHeaders::removeAt(qsizetype i)
インデックスi のヘッダーを削除する。インデックスi は有効でなければなりません (size() を参照)。
removeAll(QHttpHeaders::WellKnownHeader)、removeAll(QAnyStringView)、およびsize()も参照してください 。
bool QHttpHeaders::replace(qsizetype i, QAnyStringView name, QAnyStringView newValue)
インデックスi のヘッダーエントリーをname とnewValue で置き換える。インデックスは有効でなければならない (size() を参照)。置換が成功したかどうかを返します。
append()、replace(qsizetype, QHttpHeaders::WellKnownHeader, QAnyStringView)、size()、およびAllowed field name and value charactersも参照ください 。
bool QHttpHeaders::replace(qsizetype i, QHttpHeaders::WellKnownHeader name, QAnyStringView newValue)
この関数はQHttpHeaders::replace(qsizetype, QAnyStringView, QAnyStringView) をオーバーロードします。
[since 6.8]
bool QHttpHeaders::replaceOrAppend(QHttpHeaders::WellKnownHeader name, QAnyStringView newValue)
QHttpHeaders がすでにname を含んでいる場合、その値をnewValue に置き換え、追加される可能性のあるname エントリを削除する。name が存在しなかった場合、新しいエントリを追加する。成功すればtrue
を返す。
この関数は、一意なname:newValue ヘッダーを設定するための便利なメソッドである。ほとんどのヘッダでは、相対的な順序は問題ではないので、既存のエントリがあればそれを再利用できます。
この関数は Qt 6.8 で導入されました。
replaceOrAppend(QAnyStringView, QAnyStringView)も参照してください 。
bool QHttpHeaders::replaceOrAppend(QAnyStringView name, QAnyStringView newValue)
この関数は、QHttpHeaders::replaceOrAppend(WellKnownHeader, QAnyStringView) をオーバーロードします。
void QHttpHeaders::reserve(qsizetype size)
少なくともsize 個のヘッダーエントリーのためのメモリーを割り当てようとする。
事前にヘッダーエントリーの数がわかっている場合は、再割り当てやメモリーの断片化を防ぐためにこの関数を呼んでもよい。
[since 6.10]
void QHttpHeaders::setDateTimeValue(QAnyStringView name, const QDateTime &dateTime)
標準のHTTP IMF-fixdateフォーマットに従って、ヘッダー名name の値をdateTime に設定する。ヘッダが存在しない場合は、新しいヘッダを追加します。
この関数は Qt 6.10 で導入されました。
dateTimeValue(QAnyStringView name) およびdateTimeValueAt(qsizetype i)も参照してください 。
[since 6.10]
void QHttpHeaders::setDateTimeValue(QHttpHeaders::WellKnownHeader name, const QDateTime &dateTime)
この関数は、QHttpHeaders::setDateTimeValue(QAnyStringView) をオーバーロードします。
この関数は Qt 6.10 で導入されました。
[noexcept]
qsizetype QHttpHeaders::size() const
ヘッダー・エントリーの数を返す。
[noexcept]
void QHttpHeaders::swap(QHttpHeaders &other)
このQHttpHeaders をother と入れ替える。この操作は非常に速く、失敗することはない。
QList<std::pair<QByteArray, QByteArray>> QHttpHeaders::toListOfPairs() const
ヘッダーエントリーを(name, value)ペアのリストとして返す。ヘッダ名は大文字小文字を区別しません。
QMultiHash<QByteArray, QByteArray> QHttpHeaders::toMultiHash() const
ヘッダーエントリーを名前から値へのハッシュとして返す。ヘッダ名は大文字小文字を区別しません。
QMultiMap<QByteArray, QByteArray> QHttpHeaders::toMultiMap() const
ヘッダーエントリーを名前から値へのマップとして返す。ヘッダ名は大文字小文字を区別しません。
[noexcept]
QByteArrayView QHttpHeaders::value(QAnyStringView name, QByteArrayView defaultValue = {}) const
(最初の)ヘッダname の値を返し、存在しない場合はdefaultValue を返します。
value(QHttpHeaders::WellKnownHeader、QByteArrayView)も参照してください 。
[noexcept]
QByteArrayView QHttpHeaders::value(QHttpHeaders::WellKnownHeader name, QByteArrayView defaultValue = {}) const
この関数はQHttpHeaders::value(QAnyStringView, QByteArrayView) をオーバーロードします。
[noexcept]
QByteArrayView QHttpHeaders::valueAt(qsizetype i) const
インデックスi のヘッダー値を返す。インデックスi は有効でなければならない (size() を参照)。
size()、value()、values()、combinedValue()、nameAt()も参照 。
QList<QByteArray> QHttpHeaders::values(QAnyStringView name) const
ヘッダーname の値をリストで返す。name を持つヘッダが存在しない場合は空のリストを返します。
values(QHttpHeaders::WellKnownHeader)も参照してください 。
QList<QByteArray> QHttpHeaders::values(QHttpHeaders::WellKnownHeader name) const
この関数はQHttpHeaders::values(QAnyStringView) をオーバーロードします。
[static noexcept]
QByteArrayView QHttpHeaders::wellKnownHeaderName(QHttpHeaders::WellKnownHeader name)
指定されたname に対応するヘッダー名をビューとして返します。
[noexcept]
QHttpHeaders &QHttpHeaders::operator=(QHttpHeaders &&other)
Move-assignother 、このオブジェクトへの参照を返す。
other はempty に残される。
QHttpHeaders &QHttpHeaders::operator=(const QHttpHeaders &other)
other の内容を代入し、このオブジェクトへの参照を返す。
© 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.