00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef _MP7TIME_HPP_
00037 #define _MP7TIME_HPP_
00038
00049 class MP7Time
00050 {
00051 public:
00053 MP7Time();
00054
00059 bool setTimePoint(uint value, uint ticksPerSecond = 1);
00060
00064 bool setTimePoint(const QString &mp7Value);
00065
00070 bool setTimePoint(const MP7Time &otherTime);
00071
00079 bool moveTimePoint(int value, uint ticksPerSecond);
00080
00084 bool setDuration(uint value, uint ticks);
00085
00089 bool setDuration(const QString &mp7Value);
00090
00095 bool setDuration(const MP7Time &duration);
00096
00104 bool setDurationFromEnd(const MP7Time &end);
00105
00112 bool addDuration(const MP7Time &otherTime);
00113
00119 QString timePointPretty(bool forceSubSec = false) const;
00120
00122 QString durationPretty() const;
00123
00130 MP7Time endTimePoint() const;
00131
00140 QString endTimePointPretty(bool forceSubSec = false) const;
00141
00143 QString toString() const;
00144
00146 QString timePointMP7() const;
00147
00152 QString durationMP7() const;
00153
00157 double timeToSec() const;
00158
00162 int timeToMSec() const;
00163
00165 int durationToMSec() const;
00166
00168 double durationToSec() const;
00169
00173 bool timePointIsValid() const;
00174
00176 bool durationIsNull() const;
00177
00190 int compareTimePoint(const MP7Time &other) const;
00191
00195 bool contains(const MP7Time &time) const;
00196
00197 private:
00199 void reset();
00200
00202 void resetTimePoint();
00203
00205 void resetDuration();
00206
00208 struct timepoint {
00209 QString date;
00210 bool hasTime;
00211 uint sec;
00212 uint num;
00213 uint denom;
00214 QString tz;
00215 } tpoint;
00216
00218 struct duration {
00219 char sign;
00220 uint days;
00221 uint sec;
00222 uint num;
00223 uint denom;
00224 QString tz;
00225 int units;
00226 } duration;
00227
00229 static uint commonMultiple(uint op1, uint op2);
00230 };
00231
00232 #endif