OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 } | 73 } |
74 | 74 |
75 const SMILTime& time() const { return m_time; } | 75 const SMILTime& time() const { return m_time; } |
76 bool originIsScript() const { return m_origin == ScriptOrigin; } | 76 bool originIsScript() const { return m_origin == ScriptOrigin; } |
77 | 77 |
78 private: | 78 private: |
79 SMILTime m_time; | 79 SMILTime m_time; |
80 Origin m_origin; | 80 Origin m_origin; |
81 }; | 81 }; |
82 | 82 |
83 struct SMILInterval { | |
84 SMILInterval() { } | |
85 SMILInterval(const SMILTime& begin, const SMILTime& end) : begin(begin), end (end) { } | |
86 | |
87 SMILTime begin; | |
88 SMILTime end; | |
89 }; | |
90 | |
83 inline bool operator==(const SMILTime& a, const SMILTime& b) { return a.isFinite () && a.value() == b.value(); } | 91 inline bool operator==(const SMILTime& a, const SMILTime& b) { return a.isFinite () && a.value() == b.value(); } |
84 inline bool operator!(const SMILTime& a) { return !a.isFinite() || !a.value(); } | 92 inline bool operator!(const SMILTime& a) { return !a.isFinite() || !a.value(); } |
85 inline bool operator!=(const SMILTime& a, const SMILTime& b) { return !operator= =(a, b); } | 93 inline bool operator!=(const SMILTime& a, const SMILTime& b) { return !operator= =(a, b); } |
86 inline bool operator>(const SMILTime& a, const SMILTime& b) { return a.value() > b.value(); } | 94 inline bool operator>(const SMILTime& a, const SMILTime& b) { return a.value() > b.value(); } |
87 inline bool operator<(const SMILTime& a, const SMILTime& b) { return a.value() < b.value(); } | 95 inline bool operator<(const SMILTime& a, const SMILTime& b) { return a.value() < b.value(); } |
88 inline bool operator>=(const SMILTime& a, const SMILTime& b) { return a.value() > b.value() || operator==(a, b); } | 96 inline bool operator>=(const SMILTime& a, const SMILTime& b) { return a.value() > b.value() || operator==(a, b); } |
89 inline bool operator<=(const SMILTime& a, const SMILTime& b) { return a.value() < b.value() || operator==(a, b); } | 97 inline bool operator<=(const SMILTime& a, const SMILTime& b) { return a.value() < b.value() || operator==(a, b); } |
90 inline bool operator<(const SMILTimeWithOrigin& a, const SMILTimeWithOrigin& b) { return a.time() < b.time(); } | 98 inline bool operator<(const SMILTimeWithOrigin& a, const SMILTimeWithOrigin& b) { return a.time() < b.time(); } |
91 | 99 |
92 SMILTime operator+(const SMILTime&, const SMILTime&); | 100 SMILTime operator+(const SMILTime&, const SMILTime&); |
93 SMILTime operator-(const SMILTime&, const SMILTime&); | 101 SMILTime operator-(const SMILTime&, const SMILTime&); |
94 // So multiplying times does not make too much sense but SMIL defines it for dur ation * repeatCount | 102 // So multiplying times does not make too much sense but SMIL defines it for dur ation * repeatCount |
95 SMILTime operator*(const SMILTime&, const SMILTime&); | 103 SMILTime operator*(const SMILTime&, const SMILTime&); |
96 | 104 |
105 inline bool operator!=(const SMILInterval& a, const SMILInterval& b) | |
106 { | |
107 // Compare the "raw" values since the operator!= for SMILTime always return | |
pdr.
2014/05/28 21:56:24
Please file a bug about this. This is crazy:
inlin
fs
2014/05/30 08:02:47
I'm not sure it's 100% crazy (maybe 84% crazy) - a
| |
108 // true for non-finite times. | |
109 return a.begin.value() != b.begin.value() || a.end.value() != b.end.value(); | |
110 } | |
111 | |
97 } | 112 } |
98 | 113 |
99 #endif // SMILTime_h | 114 #endif // SMILTime_h |
OLD | NEW |