![]() |
Qt 6.x
The Qt SDK
|
The QMediaTimeRange class represents a set of zero or more disjoint time intervals. More...
#include <qmediatimerange.h>
Classes | |
class | Interval |
The QMediaTimeRange::Interval class represents a time interval with integer precision. More... | |
Public Member Functions | |
QMediaTimeRange () | |
Constructs an empty time range. | |
QMediaTimeRange (qint64 start, qint64 end) | |
Constructs a time range that contains an initial interval from start to end inclusive. | |
QMediaTimeRange (const Interval &) | |
Constructs a time range that contains an initial interval, interval. | |
QMediaTimeRange (const QMediaTimeRange &range) noexcept | |
Constructs a time range by copying another time range. | |
~QMediaTimeRange () | |
Destructor. | |
QMediaTimeRange & | operator= (const QMediaTimeRange &) noexcept |
Takes a copy of the other time range and returns itself. | |
QMediaTimeRange (QMediaTimeRange &&other) noexcept=default | |
Constructs a time range by moving from other. | |
void | swap (QMediaTimeRange &other) noexcept |
Swaps the current instance with the other. | |
void | detach () |
QMediaTimeRange & | operator= (const Interval &) |
Sets the time range to a single continuous interval, interval. | |
qint64 | earliestTime () const |
Returns the earliest time within the time range. | |
qint64 | latestTime () const |
Returns the latest time within the time range. | |
QList< QMediaTimeRange::Interval > | intervals () const |
Returns the list of intervals covered by this time range. | |
bool | isEmpty () const |
Returns true if there are no intervals within the time range. | |
bool | isContinuous () const |
Returns true if the time range consists of a continuous interval. | |
bool | contains (qint64 time) const |
Returns true if the specified time lies within the time range. | |
void | addInterval (qint64 start, qint64 end) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Adds the interval specified by start and end to the time range. | |
void | addInterval (const Interval &interval) |
Adds the specified interval to the time range. | |
void | addTimeRange (const QMediaTimeRange &) |
Adds each of the intervals in range to this time range. | |
void | removeInterval (qint64 start, qint64 end) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Removes the interval specified by start and end from the time range. | |
void | removeInterval (const Interval &interval) |
Removes the specified interval from the time range. | |
void | removeTimeRange (const QMediaTimeRange &) |
Removes each of the intervals in range from this time range. | |
QMediaTimeRange & | operator+= (const QMediaTimeRange &) |
Adds each interval in other to the time range and returns the result. | |
QMediaTimeRange & | operator+= (const Interval &) |
Adds the specified interval to the time range and returns the result. | |
QMediaTimeRange & | operator-= (const QMediaTimeRange &) |
Removes each interval in other from the time range and returns the result. | |
QMediaTimeRange & | operator-= (const Interval &) |
Removes the specified interval from the time range and returns the result. | |
void | clear () |
Removes all intervals from the time range. | |
Friends | |
bool | operator== (const QMediaTimeRange &lhs, const QMediaTimeRange &rhs) |
Returns true if all intervals in lhs are present in rhs. | |
bool | operator!= (const QMediaTimeRange &lhs, const QMediaTimeRange &rhs) |
Returns true if one or more intervals in lhs are not present in rhs. | |
Related Symbols | |
(Note that these are not member symbols.) | |
QMediaTimeRange | operator+ (const QMediaTimeRange &r1, const QMediaTimeRange &r2) |
Returns a time range containing the union between r1 and r2. | |
QMediaTimeRange | operator- (const QMediaTimeRange &r1, const QMediaTimeRange &r2) |
Returns a time range containing r2 subtracted from r1. | |
The QMediaTimeRange class represents a set of zero or more disjoint time intervals.
\inmodule QtMultimedia
\reentrant
The earliestTime(), latestTime(), intervals() and isEmpty() methods are used to get information about the current time range.
The addInterval(), removeInterval() and clear() methods are used to modify the current time range.
When adding or removing intervals from the time range, existing intervals within the range may be expanded, trimmed, deleted, merged or split to ensure that all intervals within the time range remain distinct and disjoint. As a consequence, all intervals added or removed from a time range must be \l{QMediaTimeRange::Interval::isNormal()}{normal}.
Definition at line 19 of file qmediatimerange.h.
QMediaTimeRange::QMediaTimeRange | ( | ) |
Constructs an empty time range.
Definition at line 219 of file qmediatimerange.cpp.
Constructs a time range that contains an initial interval from start to end inclusive.
If the interval is not \l{QMediaTimeRange::Interval::isNormal()}{normal}, the resulting time range will be empty.
Definition at line 234 of file qmediatimerange.cpp.
QMediaTimeRange::QMediaTimeRange | ( | const Interval & | interval | ) |
Constructs a time range that contains an initial interval, interval.
If interval is not \l{QMediaTimeRange::Interval::isNormal()}{normal}, the resulting time range will be empty.
Definition at line 247 of file qmediatimerange.cpp.
|
defaultnoexcept |
Constructs a time range by copying another time range.
|
default |
Destructor.
|
defaultnoexcept |
Constructs a time range by moving from other.
Adds the specified interval to the time range.
Adding intervals which are not \l{QMediaTimeRange::Interval::isNormal()}{normal} is invalid, and will be ignored.
If the specified interval is adjacent to, or overlaps existing intervals within the time range, these intervals will be merged.
This operation takes linear time.
Definition at line 352 of file qmediatimerange.cpp.
References QMediaTimeRangePrivate::addInterval(), and detach().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Adds the interval specified by start and end to the time range.
Definition at line 333 of file qmediatimerange.cpp.
References QMediaTimeRangePrivate::addInterval(), and detach().
Referenced by AVFMediaPlayer::availablePlaybackRanges(), and operator+=().
void QMediaTimeRange::addTimeRange | ( | const QMediaTimeRange & | range | ) |
Adds each of the intervals in range to this time range.
Equivalent to calling addInterval() for each interval in range.
Definition at line 363 of file qmediatimerange.cpp.
References QMediaTimeRangePrivate::addInterval(), detach(), i, and intervals().
Referenced by operator+=().
void QMediaTimeRange::clear | ( | ) |
Removes all intervals from the time range.
Definition at line 465 of file qmediatimerange.cpp.
References QList< T >::clear(), detach(), and QMediaTimeRangePrivate::intervals.
bool QMediaTimeRange::contains | ( | qint64 | time | ) | const |
Returns true if the specified time lies within the time range.
Definition at line 517 of file qmediatimerange.cpp.
References QListSpecialMethodsBase< T >::contains(), i, QMediaTimeRangePrivate::intervals, intervals(), QList< T >::size(), and time.
void QMediaTimeRange::detach | ( | ) |
Definition at line 474 of file qmediatimerange.cpp.
References QExplicitlySharedDataPointer< T >::detach().
Referenced by addInterval(), addInterval(), addTimeRange(), clear(), removeInterval(), removeInterval(), and removeTimeRange().
qint64 QMediaTimeRange::earliestTime | ( | ) | const |
Returns the earliest time within the time range.
For empty time ranges, this value is equal to zero.
Definition at line 302 of file qmediatimerange.cpp.
References QMediaTimeRangePrivate::intervals, and QList< T >::isEmpty().
QList< QMediaTimeRange::Interval > QMediaTimeRange::intervals | ( | ) | const |
Returns the list of intervals covered by this time range.
Definition at line 484 of file qmediatimerange.cpp.
References QMediaTimeRangePrivate::intervals.
Referenced by addTimeRange(), contains(), and removeTimeRange().
bool QMediaTimeRange::isContinuous | ( | ) | const |
Returns true if the time range consists of a continuous interval.
That is, there is one or fewer disjoint intervals within the time range.
Definition at line 507 of file qmediatimerange.cpp.
References QMediaTimeRangePrivate::intervals, and QList< T >::size().
bool QMediaTimeRange::isEmpty | ( | ) | const |
Returns true if there are no intervals within the time range.
Definition at line 496 of file qmediatimerange.cpp.
References QMediaTimeRangePrivate::intervals, and QList< T >::isEmpty().
Referenced by AVFMediaPlayer::availablePlaybackRanges().
qint64 QMediaTimeRange::latestTime | ( | ) | const |
Returns the latest time within the time range.
For empty time ranges, this value is equal to zero.
Definition at line 317 of file qmediatimerange.cpp.
References QList< T >::end(), QMediaTimeRangePrivate::intervals, QList< T >::isEmpty(), and QList< T >::size().
QMediaTimeRange & QMediaTimeRange::operator+= | ( | const Interval & | interval | ) |
Adds the specified interval to the time range and returns the result.
Definition at line 434 of file qmediatimerange.cpp.
References addInterval().
QMediaTimeRange & QMediaTimeRange::operator+= | ( | const QMediaTimeRange & | other | ) |
Adds each interval in other to the time range and returns the result.
Definition at line 425 of file qmediatimerange.cpp.
References addTimeRange(), and other().
QMediaTimeRange & QMediaTimeRange::operator-= | ( | const Interval & | interval | ) |
Removes the specified interval from the time range and returns the result.
Definition at line 452 of file qmediatimerange.cpp.
References removeInterval().
QMediaTimeRange & QMediaTimeRange::operator-= | ( | const QMediaTimeRange & | other | ) |
Removes each interval in other from the time range and returns the result.
Definition at line 443 of file qmediatimerange.cpp.
References other(), and removeTimeRange().
QMediaTimeRange & QMediaTimeRange::operator= | ( | const Interval & | interval | ) |
Sets the time range to a single continuous interval, interval.
Definition at line 289 of file qmediatimerange.cpp.
|
defaultnoexcept |
Takes a copy of the other time range and returns itself.
Removes the specified interval from the time range.
Removing intervals which are not \l{QMediaTimeRange::Interval::isNormal()}{normal} is invalid, and will be ignored.
Intervals within the time range will be trimmed, split or deleted such that no intervals within the time range include any part of the target interval.
This operation takes linear time.
Definition at line 402 of file qmediatimerange.cpp.
References detach(), and QMediaTimeRangePrivate::removeInterval().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Removes the interval specified by start and end from the time range.
Definition at line 380 of file qmediatimerange.cpp.
References detach(), and QMediaTimeRangePrivate::removeInterval().
Referenced by operator-=().
void QMediaTimeRange::removeTimeRange | ( | const QMediaTimeRange & | range | ) |
Removes each of the intervals in range from this time range.
Equivalent to calling removeInterval() for each interval in range.
Definition at line 413 of file qmediatimerange.cpp.
References detach(), i, intervals(), and QMediaTimeRangePrivate::removeInterval().
Referenced by operator-=().
|
inlinenoexcept |
Swaps the current instance with the other.
Definition at line 73 of file qmediatimerange.h.
|
friend |
Returns true if one or more intervals in lhs are not present in rhs.
Definition at line 105 of file qmediatimerange.h.
|
related |
Returns a time range containing the union between r1 and r2.
Definition at line 117 of file qmediatimerange.h.
|
related |
Returns a time range containing r2 subtracted from r1.
Definition at line 119 of file qmediatimerange.h.
|
friend |
Returns true if all intervals in lhs are present in rhs.
Definition at line 103 of file qmediatimerange.h.