src/multimedia/qmediatimerange.h
changeset 0 876b1a06bc25
equal deleted inserted replaced
-1:000000000000 0:876b1a06bc25
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QMEDIATIMERANGE_H
       
    43 #define QMEDIATIMERANGE_H
       
    44 
       
    45 #include <qmobilityglobal.h>
       
    46 #include "qtmedianamespace.h"
       
    47 #include <QtCore/qshareddata.h>
       
    48 
       
    49 QT_BEGIN_NAMESPACE
       
    50 
       
    51 class QMediaTimeRangePrivate;
       
    52 
       
    53 class Q_MULTIMEDIA_EXPORT QMediaTimeInterval
       
    54 {
       
    55 public:
       
    56     QMediaTimeInterval();
       
    57     QMediaTimeInterval(qint64 start, qint64 end);
       
    58     QMediaTimeInterval(const QMediaTimeInterval&);
       
    59 
       
    60     qint64 start() const;
       
    61     qint64 end() const;
       
    62 
       
    63     bool contains(qint64 time) const;
       
    64 
       
    65     bool isNormal() const;
       
    66     QMediaTimeInterval normalized() const;
       
    67     QMediaTimeInterval translated(qint64 offset) const;
       
    68 
       
    69 private:
       
    70     friend class QMediaTimeRangePrivate;
       
    71     friend class QMediaTimeRange;
       
    72 
       
    73     qint64 s;
       
    74     qint64 e;
       
    75 };
       
    76 
       
    77 Q_MULTIMEDIA_EXPORT bool operator==(const QMediaTimeInterval&, const QMediaTimeInterval&);
       
    78 Q_MULTIMEDIA_EXPORT bool operator!=(const QMediaTimeInterval&, const QMediaTimeInterval&);
       
    79 
       
    80 class Q_MULTIMEDIA_EXPORT QMediaTimeRange
       
    81 {
       
    82 public:
       
    83 
       
    84     QMediaTimeRange();
       
    85     QMediaTimeRange(qint64 start, qint64 end);
       
    86     QMediaTimeRange(const QMediaTimeInterval&);
       
    87     QMediaTimeRange(const QMediaTimeRange &range);
       
    88     ~QMediaTimeRange();
       
    89 
       
    90     QMediaTimeRange &operator=(const QMediaTimeRange&);
       
    91     QMediaTimeRange &operator=(const QMediaTimeInterval&);
       
    92 
       
    93     qint64 earliestTime() const;
       
    94     qint64 latestTime() const;
       
    95 
       
    96     QList<QMediaTimeInterval> intervals() const;
       
    97     bool isEmpty() const;
       
    98     bool isContinuous() const;
       
    99 
       
   100     bool contains(qint64 time) const;
       
   101 
       
   102     void addInterval(qint64 start, qint64 end);
       
   103     void addInterval(const QMediaTimeInterval &interval);
       
   104     void addTimeRange(const QMediaTimeRange&);
       
   105 
       
   106     void removeInterval(qint64 start, qint64 end);
       
   107     void removeInterval(const QMediaTimeInterval &interval);
       
   108     void removeTimeRange(const QMediaTimeRange&);
       
   109 
       
   110     QMediaTimeRange& operator+=(const QMediaTimeRange&);
       
   111     QMediaTimeRange& operator+=(const QMediaTimeInterval&);
       
   112     QMediaTimeRange& operator-=(const QMediaTimeRange&);
       
   113     QMediaTimeRange& operator-=(const QMediaTimeInterval&);
       
   114 
       
   115     void clear();
       
   116 
       
   117 private:
       
   118     QSharedDataPointer<QMediaTimeRangePrivate> d;
       
   119 };
       
   120 
       
   121 Q_MULTIMEDIA_EXPORT bool operator==(const QMediaTimeRange&, const QMediaTimeRange&);
       
   122 Q_MULTIMEDIA_EXPORT bool operator!=(const QMediaTimeRange&, const QMediaTimeRange&);
       
   123 Q_MULTIMEDIA_EXPORT QMediaTimeRange operator+(const QMediaTimeRange&, const QMediaTimeRange&);
       
   124 Q_MULTIMEDIA_EXPORT QMediaTimeRange operator-(const QMediaTimeRange&, const QMediaTimeRange&);
       
   125 
       
   126 
       
   127 QT_END_NAMESPACE
       
   128 
       
   129 #endif  // QMEDIATIMERANGE_H