CopperSpice API  1.9.1
QMediaTimeRange Class Reference

The QMediaTimeRange class represents a set of zero or more disjoint time intervals. More...

Public Methods

 QMediaTimeRange ()
 
 QMediaTimeRange (const QMediaTimeInterval &interval)
 
 QMediaTimeRange (const QMediaTimeRange &other)
 
 QMediaTimeRange (qint64 start, qint64 end)
 
 ~QMediaTimeRange ()
 
void addInterval (const QMediaTimeInterval &interval)
 
void addInterval (qint64 start, qint64 end)
 
void addTimeRange (const QMediaTimeRange &range)
 
void clear ()
 
bool contains (qint64 time) const
 
qint64 earliestTime () const
 
QList< QMediaTimeIntervalintervals () const
 
bool isContinuous () const
 
bool isEmpty () const
 
qint64 latestTime () const
 
QMediaTimeRange & operator+= (const QMediaTimeInterval &interval)
 
QMediaTimeRange & operator+= (const QMediaTimeRange &other)
 
QMediaTimeRange & operator-= (const QMediaTimeInterval &interval)
 
QMediaTimeRange & operator-= (const QMediaTimeRange &other)
 
QMediaTimeRange & operator= (const QMediaTimeInterval &interval)
 
QMediaTimeRange & operator= (const QMediaTimeRange &other)
 
void removeInterval (const QMediaTimeInterval &interval)
 
void removeInterval (qint64 start, qint64 end)
 
void removeTimeRange (const QMediaTimeRange &range)
 

Related Functions

These are not member functions

 operator!= (const QMediaTimeInterval &a, const QMediaTimeInterval &b)
 
 operator!= (const QMediaTimeRange &a, const QMediaTimeRange &b)
 
 operator+ (const QMediaTimeRange &r1, const QMediaTimeRange &r2)
 
 operator- (const QMediaTimeRange &r1, const QMediaTimeRange &r2)
 
 operator== (const QMediaTimeInterval &a, const QMediaTimeInterval &b)
 
 operator== (const QMediaTimeRange &a, const QMediaTimeRange &b)
 

Detailed Description

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 QMediaTimeInterval::isNormal().

See also
QMediaTimeInterval

Constructor & Destructor Documentation

QMediaTimeRange::QMediaTimeRange ( )

Constructs an empty time range.

QMediaTimeRange::QMediaTimeRange ( qint64  start,
qint64  end 
)

Constructs a time range that contains an initial interval from start to end inclusive.

If the interval is not QMediaTimeInterval::isNormal(), the resulting time range will be empty.

See also
addInterval()
QMediaTimeRange::QMediaTimeRange ( const QMediaTimeInterval interval)

Constructs a time range containing the initial interval. If interval is not QMediaTimeInterval::isNormal(), the resulting time range will be empty.

See also
addInterval()
QMediaTimeRange::QMediaTimeRange ( const QMediaTimeRange &  other)

Copy constructs a new QMediaTimeRange from other.

QMediaTimeRange::~QMediaTimeRange ( )

Destroys the media time range object.

Method Documentation

void QMediaTimeRange::addInterval ( const QMediaTimeInterval interval)

Adds the specified interval to the time range.

Adding intervals which are not QMediaTimeInterval::isNormal() 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.

See also
removeInterval()
void QMediaTimeRange::addInterval ( qint64  start,
qint64  end 
)

Adds the interval specified by start and end to the time range.

See also
addInterval()
void QMediaTimeRange::addTimeRange ( const QMediaTimeRange &  range)

Adds each of the intervals in the given range to the current QMediaTimeRange. Equivalent to calling addInterval() for each interval.

void QMediaTimeRange::clear ( )

Removes all intervals from the time range.

See also
removeInterval()
bool QMediaTimeRange::contains ( qint64  time) const

Returns true if the specified time lies within the time range.

qint64 QMediaTimeRange::earliestTime ( ) const

Returns the earliest time within the time range. For empty time ranges, this value is equal to zero.

See also
latestTime()
QList< QMediaTimeInterval > QMediaTimeRange::intervals ( ) const

Returns the list of intervals covered by this time range.

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.

bool QMediaTimeRange::isEmpty ( ) const

Returns true if there are no intervals within the time range.

See also
intervals()
qint64 QMediaTimeRange::latestTime ( ) const

Returns the latest time within the time range. For empty time ranges, this value is equal to zero.

See also
earliestTime()
QMediaTimeRange & QMediaTimeRange::operator+= ( const QMediaTimeInterval interval)

Adds the specified interval to the time range and returns the result.

QMediaTimeRange & QMediaTimeRange::operator+= ( const QMediaTimeRange &  other)

Adds each interval in other to the time range and returns the result.

QMediaTimeRange & QMediaTimeRange::operator-= ( const QMediaTimeInterval interval)

Removes the specified interval from the time range and returns the result.

QMediaTimeRange & QMediaTimeRange::operator-= ( const QMediaTimeRange &  other)

Removes each interval in other from the time range and returns the result.

QMediaTimeRange & QMediaTimeRange::operator= ( const QMediaTimeInterval interval)

Sets the time range to a single continuous interval.

QMediaTimeRange & QMediaTimeRange::operator= ( const QMediaTimeRange &  other)

Copy assignsfrom other and returns a reference to this.

void QMediaTimeRange::removeInterval ( const QMediaTimeInterval interval)

Removes the specified interval from the time range. Removing intervals which are not QMediaTimeInterval::isNormal() 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.

See also
addInterval()
void QMediaTimeRange::removeInterval ( qint64  start,
qint64  end 
)

Removes the interval specified by start and end from the time range.

See also
removeInterval()
void QMediaTimeRange::removeTimeRange ( const QMediaTimeRange &  range)

Removes each of the intervals in the given range. Equivalent to calling removeInterval() for each interval.

Friends And Related Function Documentation

operator!= ( const QMediaTimeInterval a,
const QMediaTimeInterval b 
)
related

Returns true if a is not exactly equal to b.

operator!= ( const QMediaTimeRange &  a,
const QMediaTimeRange &  b 
)
related

Returns true if one or more intervals in a are not present in b.

operator+ ( const QMediaTimeRange &  r1,
const QMediaTimeRange &  r2 
)
related

Returns a time range containing the union between r1 and r2.

operator- ( const QMediaTimeRange &  r1,
const QMediaTimeRange &  r2 
)
related

Returns a time range containing r2 subtracted from r1.

operator== ( const QMediaTimeInterval a,
const QMediaTimeInterval b 
)
related

Returns true if a is exactly equal to b.

operator== ( const QMediaTimeRange &  a,
const QMediaTimeRange &  b 
)
related

Returns true if all intervals in a are present in b.