2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Name : SdpTypedTime.h
17 * Interface : SDK API, SDP Codec API
24 #ifndef TSDPTYPEDTIME_H
25 #define TSDPTYPEDTIME_H
30 // FORWARD DECLARATIONS
39 * This class implements the typed time element of the Session
40 * Description Protocol.
42 * The normative reference for correct formatting and values is
43 * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in
44 * member documentation. The implementation supports this normative
45 * reference, but does not enforce it fully.
56 ETimeUnitDays, /** d */
57 ETimeUnitHours, /** h */
58 ETimeUnitMinutes, /** m */
59 ETimeUnitSeconds, /** s */
63 public: // Constructors and destructor
65 * Constructs a typed time equal to zero and with no time unit set.
67 IMPORT_C TSdpTypedTime();
70 * Constructs a typed time equal to specified value and time unit.
72 * @param aValue Time value.
73 * @param aUnit Time unit.
75 IMPORT_C TSdpTypedTime(TInt64 aValue, TUnit aUnit);
77 public: // New functions
79 * Compares this instance to another for equality.
81 * @param aObj Another instance to compare with.
82 * @return ETrue if equal, EFalse if not.
84 IMPORT_C TBool operator == (const TSdpTypedTime& aObj) const;
87 * Sets the typed time value.
89 * @param aValue Time value.
90 * @param aUnit Time unit.
92 IMPORT_C void SetValue(TInt64 aValue, TUnit aUnit);
97 * Externalizes the object to stream
99 * @param aStream Stream where the object's state will be stored
101 void ExternalizeL(RWriteStream& aStream) const;
104 * Creates object from the stream data
106 * @param aStream Stream where the object's state will be read
107 * @return Initialized object
109 static TSdpTypedTime InternalizeL(RReadStream& aStream);
112 * Output the field formatted according to SDP syntax and including
113 * the terminating CRLF.
115 * @param aStream Stream used for output.
117 void EncodeL(RWriteStream& aStream) const;
120 * Construct a new origin field.
122 * @param aText A string containing a correctly formatted field value
123 * terminated by a CRLF.
124 * @return The new instance.
126 static TSdpTypedTime DecodeL(const TDesC8& aText);
142 #endif // TSDPTYPEDTIME_H