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
QHttpHeaderRange Class Reference

QHttpHeaderRange represents a single byte range as used in the HTTP {Range} and {Content-Range} headers. More...

#include <qhttpheaders.h>

Collaboration diagram for QHttpHeaderRange:

Public Member Functions

constexpr bool isValid () const noexcept
 \variable std::optional<qint64> QHttpHeaderRange::start

Public Attributes

std::optional< qint64start
std::optional< qint64end

Friends

Q_NETWORK_EXPORT QDebug operator<< (QDebug debug, const QHttpHeaderRange &range)
constexpr bool comparesEqual (const QHttpHeaderRange &lhs, const QHttpHeaderRange &rhs) noexcept
size_t qHash (QHttpHeaderRange range, size_t seed=0) noexcept

Detailed Description

QHttpHeaderRange represents a single byte range as used in the HTTP {Range} and {Content-Range} headers.

Since
6.12 \inmodule QtNetwork \compares equality

A range has an optional start and an optional end, both expressed as byte offsets. A missing start or end is represented as {std::nullopt}.

Use \l isValid() to check whether a range is well-formed before passing it to \l QHttpHeaders::setRangeValues().

See also
QHttpHeaders::rangeValues(), QHttpHeaders::setRangeValues()

Definition at line 26 of file qhttpheaders.h.

Member Function Documentation

◆ isValid()

bool QHttpHeaderRange::isValid ( ) const
inlineconstexprnoexcept

\variable std::optional<qint64> QHttpHeaderRange::start

Contains the start byte offset of the range, or {std::nullopt} if no start was set. A range without a start but with an end (e.g., {bytes=-500}) represents the last N bytes of the resource.

See also
end

\variable std::optional<qint64> QHttpHeaderRange::end

Contains the end byte offset of the range, or {std::nullopt} if no end was set. A range with a start but without an end (e.g., {bytes=500-}) requests all bytes from the given offset to the end of the resource.

See also
start

Returns true if the range is well-formed, false otherwise.

A range is considered invalid if: \list

  • Both start and end are {std::nullopt}.
  • The start value is negative.
  • The end value is negative.
  • Both start and end are set, and start is greater than end. \endlist

Definition at line 31 of file qhttpheaders.h.

◆ comparesEqual

bool comparesEqual ( const QHttpHeaderRange & lhs,
const QHttpHeaderRange & rhs )
friend

Definition at line 49 of file qhttpheaders.h.

◆ operator<<

Q_NETWORK_EXPORT QDebug operator<< ( QDebug debug,
const QHttpHeaderRange & range )
friend
Since
6.12

Writes range to the debug stream.

Definition at line 2004 of file qhttpheaders.cpp.

◆ qHash

size_t qHash ( QHttpHeaderRange range,
size_t seed = 0 )
friend

Definition at line 56 of file qhttpheaders.h.

Member Data Documentation

◆ end

std::optional<qint64> QHttpHeaderRange::end

Definition at line 29 of file qhttpheaders.h.

◆ start

std::optional<qint64> QHttpHeaderRange::start

Definition at line 28 of file qhttpheaders.h.


The documentation for this class was generated from the following files: