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

QHttpHeaderRangeSet represents the byte ranges of an HTTP {Range} header. More...

#include <qhttpheaders.h>

Collaboration diagram for QHttpHeaderRangeSet:

Public Member Functions

Q_NETWORK_EXPORT QHttpHeaderRangeSet ()
 Constructs a QHttpHeaderRangeSet object with no ranges.
Q_NETWORK_EXPORT QHttpHeaderRangeSet (const QHttpHeaderRangeSet &other)
 Creates a copy of other.
 QHttpHeaderRangeSet (QHttpHeaderRangeSet &&)=default
 Move-constructs the object from other, which is left with no ranges.
Q_NETWORK_EXPORT Q_IMPLICIT QHttpHeaderRangeSet (QSpan< const QHttpHeaderRangeSpec > r)
 Constructs a QHttpHeaderRangeSet object holding r, in the given order.
Q_IMPLICIT QHttpHeaderRangeSet (std::initializer_list< QHttpHeaderRangeSpec > r)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Constructs a QHttpHeaderRangeSet object holding the ranges in r, in the given order.
Q_NETWORK_EXPORT QHttpHeaderRangeSet & operator= (const QHttpHeaderRangeSet &other)
 Assigns the contents of other and returns a reference to this object.
Q_NETWORK_EXPORT ~QHttpHeaderRangeSet ()
 Destroys the object.
void swap (QHttpHeaderRangeSet &other) noexcept
 \memberswap{ranges object}
Q_NETWORK_EXPORT QSpan< const QHttpHeaderRangeSpec > ranges () const noexcept
 Returns a view of the ranges held by this object.
Q_NETWORK_EXPORT void setRanges (QSpan< const QHttpHeaderRangeSpec > r)
 Sets the ranges held by this object to r.

Friends

Q_NETWORK_EXPORT QDebug operator<< (QDebug debug, const QHttpHeaderRangeSet &ranges)
Q_NETWORK_EXPORT friend bool comparesEqual (const QHttpHeaderRangeSet &lhs, const QHttpHeaderRangeSet &rhs)
Q_NETWORK_EXPORT friend size_t qHash (const QHttpHeaderRangeSet &key, size_t seed)
 \qhash{QHttpHeaderRangeSet}
size_t qHash (const QHttpHeaderRangeSet &key) noexcept

Detailed Description

QHttpHeaderRangeSet represents the byte ranges of an HTTP {Range} header.

Since
6.12 \inmodule QtNetwork \preliminary \compares equality

QHttpHeaderRangeSet holds a sequence of QHttpHeaderRangeSpec objects, as they appear in such a header, which RFC 9110 calls a {range-set}.

The ranges are kept in the order in which they were given, because that is the order in which a server is asked to send them. The class does not interpret them: neither overlapping nor invalid ranges are rejected or merged.

Each range is a byte range, as defined in \l{https://datatracker.ietf.org/doc/html/rfc9110#section-14.1.1}{RFC 9110 Section 14.1.1}: \list

  • If the start is specified but the end is not (e.g., "bytes=500-"), the QHttpHeaderRangeSpec will have {start=500} and {end=std::nullopt}.
  • If the end is specified but the start is not (e.g., "bytes=-500"), the QHttpHeaderRangeSpec will have {start=std::nullopt} and {end=500}, representing the last 500 bytes.
  • If both are specified (e.g., "bytes=0-499"), the QHttpHeaderRangeSpec will have {start=0} and {end=499}. \endlist
See also
QHttpHeaderRangeSpec, QHttpHeaders::rangeValues(), QHttpHeaders::setRangeValues()

Definition at line 65 of file qhttpheaders.h.

Constructor & Destructor Documentation

◆ QHttpHeaderRangeSet() [1/5]

QHttpHeaderRangeSet::QHttpHeaderRangeSet ( )
default

Constructs a QHttpHeaderRangeSet object with no ranges.

◆ QHttpHeaderRangeSet() [2/5]

QHttpHeaderRangeSet::QHttpHeaderRangeSet ( const QHttpHeaderRangeSet & other)
default

Creates a copy of other.

◆ QHttpHeaderRangeSet() [3/5]

QHttpHeaderRangeSet::QHttpHeaderRangeSet ( QHttpHeaderRangeSet && other)
default

Move-constructs the object from other, which is left with no ranges.

◆ QHttpHeaderRangeSet() [4/5]

QHttpHeaderRangeSet::QHttpHeaderRangeSet ( QSpan< const QHttpHeaderRangeSpec > r)

Constructs a QHttpHeaderRangeSet object holding r, in the given order.

See also
setRanges()

Definition at line 252 of file qhttpheaders.cpp.

◆ QHttpHeaderRangeSet() [5/5]

Q_IMPLICIT QHttpHeaderRangeSet::QHttpHeaderRangeSet ( std::initializer_list< QHttpHeaderRangeSpec > r)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Constructs a QHttpHeaderRangeSet object holding the ranges in r, in the given order.

Definition at line 74 of file qhttpheaders.h.

◆ ~QHttpHeaderRangeSet()

QHttpHeaderRangeSet::~QHttpHeaderRangeSet ( )
default

Destroys the object.

Member Function Documentation

◆ operator=()

QHttpHeaderRangeSet & QHttpHeaderRangeSet::operator= ( const QHttpHeaderRangeSet & other)
default

Assigns the contents of other and returns a reference to this object.

Move-assigns other to this object and returns a reference to this object.

other is left with no ranges.

◆ ranges()

QSpan< const QHttpHeaderRangeSpec > QHttpHeaderRangeSet::ranges ( ) const
noexcept

Returns a view of the ranges held by this object.

The returned view is valid until this object is modified or destroyed.

See also
setRanges()

Definition at line 308 of file qhttpheaders.cpp.

◆ setRanges()

void QHttpHeaderRangeSet::setRanges ( QSpan< const QHttpHeaderRangeSpec > r)

Sets the ranges held by this object to r.

Preserves the order of r.

See also
ranges()

Definition at line 318 of file qhttpheaders.cpp.

◆ swap()

void QHttpHeaderRangeSet::swap ( QHttpHeaderRangeSet & other)
inlinenoexcept

\memberswap{ranges object}

Definition at line 80 of file qhttpheaders.h.

◆ comparesEqual

Q_NETWORK_EXPORT friend bool comparesEqual ( const QHttpHeaderRangeSet & lhs,
const QHttpHeaderRangeSet & rhs )
friend

Definition at line 347 of file qhttpheaders.cpp.

◆ operator<<

Q_NETWORK_EXPORT QDebug operator<< ( QDebug debug,
const QHttpHeaderRangeSet & ranges )
friend
Since
6.12

Writes ranges to the stream debug.

Definition at line 2292 of file qhttpheaders.cpp.

◆ qHash [1/2]

size_t qHash ( const QHttpHeaderRangeSet & key)
friend

Definition at line 103 of file qhttpheaders.h.

◆ qHash [2/2]

Q_NETWORK_EXPORT friend size_t qHash ( const QHttpHeaderRangeSet & key,
size_t seed )
friend

\qhash{QHttpHeaderRangeSet}

Definition at line 359 of file qhttpheaders.cpp.


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