QHttpHeaderRangeSet Class
QHttpHeaderRangeSet represents the byte ranges of an HTTP Range header. More...
| Header: | #include <QHttpHeaderRangeSet> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Network)target_link_libraries(mytarget PRIVATE Qt6::Network) |
| qmake: | QT += network |
| Since: | Qt 6.12 |
| Status: | Technology preview |
This class is in technology preview and is subject to change.
QHttpHeaderRangeSet Comparisons
| Category | Comparable Types |
|---|---|
| equality | QHttpHeaderRangeSet |
Public Functions
| QHttpHeaderRangeSet() | |
| QHttpHeaderRangeSet(QSpan<const QHttpHeaderRangeSpec> r) | |
| QHttpHeaderRangeSet(std::initializer_list<QHttpHeaderRangeSpec> r) | |
| QHttpHeaderRangeSet(const QHttpHeaderRangeSet &other) | |
| QHttpHeaderRangeSet(QHttpHeaderRangeSet &&other) | |
| ~QHttpHeaderRangeSet() | |
| QSpan<const QHttpHeaderRangeSpec> | ranges() const |
| void | setRanges(QSpan<const QHttpHeaderRangeSpec> r) |
| void | swap(QHttpHeaderRangeSet &other) |
| QHttpHeaderRangeSet & | operator=(QHttpHeaderRangeSet &&other) |
| QHttpHeaderRangeSet & | operator=(const QHttpHeaderRangeSet &other) |
Related Non-Members
| size_t | qHash(const QHttpHeaderRangeSet &key, size_t seed) |
| bool | operator!=(const QHttpHeaderRangeSet &lhs, const QHttpHeaderRangeSet &rhs) |
(since 6.12) QDebug | operator<<(QDebug debug, const QHttpHeaderRangeSet &ranges) |
| bool | operator==(const QHttpHeaderRangeSet &lhs, const QHttpHeaderRangeSet &rhs) |
Detailed Description
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 RFC 9110 Section 14.1.1:
- If the start is specified but the end is not (e.g., "bytes=500-"), the QHttpHeaderRangeSpec will have
start=500andend=std::nullopt. - If the end is specified but the start is not (e.g., "bytes=-500"), the QHttpHeaderRangeSpec will have
start=std::nulloptandend=500, representing the last 500 bytes. - If both are specified (e.g., "bytes=0-499"), the QHttpHeaderRangeSpec will have
start=0andend=499.
See also QHttpHeaderRangeSpec, QHttpHeaders::rangeValues(), and QHttpHeaders::setRangeValues().
Member Function Documentation
QHttpHeaderRangeSet::QHttpHeaderRangeSet()
Constructs a QHttpHeaderRangeSet object with no ranges.
QHttpHeaderRangeSet::QHttpHeaderRangeSet(QSpan<const QHttpHeaderRangeSpec> r)
Constructs a QHttpHeaderRangeSet object holding r, in the given order.
See also setRanges().
QHttpHeaderRangeSet::QHttpHeaderRangeSet(std::initializer_list<QHttpHeaderRangeSpec> r)
Constructs a QHttpHeaderRangeSet object holding the ranges in r, in the given order.
This is an overloaded function.
QHttpHeaderRangeSet::QHttpHeaderRangeSet(const QHttpHeaderRangeSet &other)
Creates a copy of other.
[constexpr noexcept default] QHttpHeaderRangeSet::QHttpHeaderRangeSet(QHttpHeaderRangeSet &&other)
Move-constructs the object from other, which is left with no ranges.
[noexcept] QHttpHeaderRangeSet::~QHttpHeaderRangeSet()
Destroys the object.
[noexcept] QSpan<const QHttpHeaderRangeSpec> QHttpHeaderRangeSet::ranges() const
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().
void QHttpHeaderRangeSet::setRanges(QSpan<const QHttpHeaderRangeSpec> r)
Sets the ranges held by this object to r. Preserves the order of r.
See also ranges().
[noexcept] void QHttpHeaderRangeSet::swap(QHttpHeaderRangeSet &other)
Swaps this ranges object with other. This operation is very fast and never fails.
[noexcept] QHttpHeaderRangeSet &QHttpHeaderRangeSet::operator=(QHttpHeaderRangeSet &&other)
Move-assigns other to this object and returns a reference to this object. other is left with no ranges.
QHttpHeaderRangeSet &QHttpHeaderRangeSet::operator=(const QHttpHeaderRangeSet &other)
Assigns the contents of other and returns a reference to this object.
Related Non-Members
[noexcept] size_t qHash(const QHttpHeaderRangeSet &key, size_t seed)
Returns the hash value for key, using seed to seed the calculation.
[noexcept] bool operator!=(const QHttpHeaderRangeSet &lhs, const QHttpHeaderRangeSet &rhs)
Returns whether lhs and rhs hold different ranges, or hold them in a different order.
See also operator==().
[since 6.12] QDebug operator<<(QDebug debug, const QHttpHeaderRangeSet &ranges)
Writes ranges to the stream debug.
This function was introduced in Qt 6.12.
[noexcept] bool operator==(const QHttpHeaderRangeSet &lhs, const QHttpHeaderRangeSet &rhs)
Returns whether lhs and rhs hold the same ranges in the same order.
Like for other sequence containers, the ranges are compared element by element, so objects that denote the same set of bytes, but hold different ranges, or hold them in a different order, do not compare equal.
See also operator!=().
© 2026 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.