|
1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * Name : SdpTypedTime.h |
|
16 * Part of : Local SDP Codec |
|
17 * Interface : SDK API, Local SDP Codec API |
|
18 * Version : 1.0 |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 #ifndef TSDPTYPEDTIME_H |
|
25 #define TSDPTYPEDTIME_H |
|
26 |
|
27 // INCLUDES |
|
28 #include <e32std.h> |
|
29 #include "_sdpdefs.h" |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class RReadStream; |
|
33 class RWriteStream; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 /** |
|
37 * @publishedAll |
|
38 * @released |
|
39 * |
|
40 * This class implements the typed time element of the Session |
|
41 * Description Protocol. |
|
42 * |
|
43 * The normative reference for correct formatting and values is |
|
44 * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in |
|
45 * member documentation. The implementation supports this normative |
|
46 * reference, but does not enforce it fully. |
|
47 * |
|
48 * @lib localsdpcodec.lib |
|
49 */ |
|
50 class TSdpTypedTime |
|
51 { |
|
52 public: // enums |
|
53 |
|
54 /** Time units. */ |
|
55 enum TUnit |
|
56 { |
|
57 ETimeUnitDays, /** d */ |
|
58 ETimeUnitHours, /** h */ |
|
59 ETimeUnitMinutes, /** m */ |
|
60 ETimeUnitSeconds, /** s */ |
|
61 ETimeUnitNone, |
|
62 }; |
|
63 |
|
64 public: // Constructors and destructor |
|
65 /** |
|
66 * Constructs a typed time equal to zero and with no time unit set. |
|
67 */ |
|
68 IMPORT_C TSdpTypedTime(); |
|
69 |
|
70 /** |
|
71 * Constructs a typed time equal to specified value and time unit. |
|
72 * |
|
73 * @param aValue Time value. |
|
74 * @param aUnit Time unit. |
|
75 */ |
|
76 IMPORT_C TSdpTypedTime(TInt64 aValue, TUnit aUnit); |
|
77 |
|
78 public: // New functions |
|
79 /** |
|
80 * Compares this instance to another for equality. |
|
81 * |
|
82 * @param aObj Another instance to compare with. |
|
83 * @return ETrue if equal, EFalse if not. |
|
84 */ |
|
85 IMPORT_C TBool operator == (const TSdpTypedTime& aObj) const; |
|
86 |
|
87 /** |
|
88 * Sets the typed time value. |
|
89 * |
|
90 * @param aValue Time value. |
|
91 * @param aUnit Time unit. |
|
92 */ |
|
93 IMPORT_C void SetValue(TInt64 aValue, TUnit aUnit); |
|
94 |
|
95 public: |
|
96 |
|
97 /** |
|
98 * Externalizes the object to stream |
|
99 * |
|
100 * @param aStream Stream where the object's state will be stored |
|
101 */ |
|
102 void ExternalizeL(RWriteStream& aStream) const; |
|
103 |
|
104 /** |
|
105 * Creates object from the stream data |
|
106 * |
|
107 * @param aStream Stream where the object's state will be read |
|
108 * @return Initialized object |
|
109 */ |
|
110 static TSdpTypedTime InternalizeL(RReadStream& aStream); |
|
111 |
|
112 /** |
|
113 * Output the field formatted according to SDP syntax and including |
|
114 * the terminating CRLF. |
|
115 * |
|
116 * @param aStream Stream used for output. |
|
117 */ |
|
118 void EncodeL(RWriteStream& aStream) const; |
|
119 |
|
120 /** |
|
121 * Construct a new origin field. |
|
122 * |
|
123 * @param aText A string containing a correctly formatted field value |
|
124 * terminated by a CRLF. |
|
125 * @return The new instance. |
|
126 */ |
|
127 static TSdpTypedTime DecodeL(const TDesC8& aText); |
|
128 |
|
129 public: // Data |
|
130 |
|
131 /** |
|
132 * @internalComponent |
|
133 */ |
|
134 TInt64 iValue; |
|
135 |
|
136 /** |
|
137 * @internalComponent |
|
138 */ |
|
139 TInt iUnit; |
|
140 |
|
141 }; |
|
142 |
|
143 #endif // TSDPTYPEDTIME_H |