|
1 /* |
|
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: smiltime declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef SMILTIME_H |
|
21 #define SMILTIME_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <e32math.h> |
|
26 #include <e32std.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class TInstanceTime; |
|
30 class CSmilObject; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Time class. Special time values INDEFINITE, UNRESOLVED and UNKNOWN are also possible. |
|
36 * Includes basic math operators. |
|
37 */ |
|
38 class TSmilTime |
|
39 { |
|
40 public: // Constructors and destructor |
|
41 |
|
42 enum { |
|
43 // for style properties |
|
44 KUnspecified = KMaxTInt, |
|
45 // for calculated values |
|
46 KUnresolved = KMaxTInt, |
|
47 |
|
48 KIndefinite = KMaxTInt - 1, |
|
49 KMedia = KMaxTInt - 2 |
|
50 }; |
|
51 |
|
52 /** |
|
53 * C++ default constructor. |
|
54 */ |
|
55 IMPORT_C TSmilTime(); |
|
56 |
|
57 /** |
|
58 * C++ constructor with initialisation. |
|
59 */ |
|
60 IMPORT_C TSmilTime( TInt aValue ); |
|
61 |
|
62 IMPORT_C TSmilTime ( const TDesC& aValue ); |
|
63 |
|
64 public: // New functions |
|
65 |
|
66 /** |
|
67 * Converts from global to local time |
|
68 */ |
|
69 IMPORT_C static TSmilTime ToLocal( CSmilObject* aObject, TSmilTime aTime ); |
|
70 |
|
71 /** |
|
72 * Multiply operator (indef*def=indef, unres*def=unres) |
|
73 */ |
|
74 IMPORT_C TSmilTime operator*( const TSmilTime& aA ) const; |
|
75 |
|
76 /** |
|
77 * Multiply operator (indef*def=indef, unres*def=unres) |
|
78 */ |
|
79 IMPORT_C TSmilTime operator*( const TReal32 aValue ) const; |
|
80 |
|
81 /** |
|
82 * Substract operator (indef-def=indef, unres-def=unres, def-indef=indef,...) |
|
83 */ |
|
84 IMPORT_C TSmilTime operator-( const TSmilTime& aA ) const; |
|
85 |
|
86 /** |
|
87 * Sum operator (indef+def=indef, unres+def=unres) |
|
88 */ |
|
89 IMPORT_C TSmilTime operator+( const TSmilTime& aA ) const; |
|
90 |
|
91 /** |
|
92 * Comparison operator (unres>indef>def) |
|
93 */ |
|
94 IMPORT_C TBool operator>( const TSmilTime& aA ) const; |
|
95 |
|
96 /** |
|
97 * Comparison operator (def<indef<unres) |
|
98 */ |
|
99 IMPORT_C TBool operator<( const TSmilTime& aA ) const; |
|
100 |
|
101 /** |
|
102 * Assignment operator |
|
103 */ |
|
104 IMPORT_C TSmilTime& operator=( const TInt aValue ); |
|
105 |
|
106 /** |
|
107 * Assignment operator |
|
108 */ |
|
109 IMPORT_C TSmilTime& operator=( const TSmilTime& aTime ); |
|
110 |
|
111 /** |
|
112 * Comparison operator (indef!=unres) |
|
113 */ |
|
114 IMPORT_C TBool operator==( const TSmilTime& aTime ) const; |
|
115 |
|
116 /** |
|
117 * Comparison operator (indef!=unres) |
|
118 */ |
|
119 IMPORT_C TBool operator!=( const TSmilTime& aTime ) const; |
|
120 |
|
121 /** |
|
122 * Comparison operator |
|
123 */ |
|
124 IMPORT_C TBool operator>=( const TSmilTime& aTime ) const; |
|
125 |
|
126 /** |
|
127 * Comparison operator |
|
128 */ |
|
129 IMPORT_C TBool operator<=( const TSmilTime& aTime ) const; |
|
130 |
|
131 /** |
|
132 * Increment operator (indef++ == indef) |
|
133 */ |
|
134 IMPORT_C const TSmilTime& operator++( TInt /*aX*/ ); |
|
135 |
|
136 TBool IsFinite() const { return iValue < KIndefinite; } |
|
137 TBool IsUnresolved() const { return iValue == KUnresolved; } |
|
138 TBool IsUnspecified() const { return iValue == KUnspecified; } |
|
139 TBool IsIndefinite() const { return iValue == KIndefinite; } |
|
140 TBool IsMedia() const { return iValue == KMedia; } |
|
141 TInt Value() const { return iValue; } |
|
142 |
|
143 |
|
144 /** |
|
145 * Converts (finite) time value to microseconds |
|
146 */ |
|
147 IMPORT_C TTimeIntervalMicroSeconds ToMicroSeconds() const; |
|
148 /** |
|
149 * Creates time value from a microsecond value |
|
150 */ |
|
151 IMPORT_C static TSmilTime FromMicroSeconds(TTimeIntervalMicroSeconds aMicro); |
|
152 /** |
|
153 * Creates time value from an integer value |
|
154 */ |
|
155 IMPORT_C static TSmilTime FromMicroSeconds(TInt aMicro); |
|
156 |
|
157 public: // Functions from base classes |
|
158 |
|
159 /** |
|
160 * From ?base_class ?member_description. |
|
161 * @param ?arg1 ?description |
|
162 * @return ?description |
|
163 */ |
|
164 // ?type ?member_function( ?type ?arg1 ); |
|
165 |
|
166 protected: // New functions |
|
167 |
|
168 /** |
|
169 * ?member_description. |
|
170 * @param ?arg1 ?description |
|
171 * @return ?description |
|
172 */ |
|
173 |
|
174 protected: // Functions from base classes |
|
175 |
|
176 /** |
|
177 * From ?base_class ?member_description |
|
178 */ |
|
179 //?type ?member_function(); |
|
180 |
|
181 private: // Data |
|
182 TInt iValue; |
|
183 }; |
|
184 |
|
185 #endif // ?INCLUDE_H |
|
186 |
|
187 // End of File |