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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Name : SdpRepeatField.h
17 * Interface : SDK API, SDP Codec API
24 #ifndef CSDPREPEATFIELD_H
25 #define CSDPREPEATFIELD_H
29 #include <stringpool.h>
31 #include <sdptypedtime.h>
33 // FORWARD DECLARATIONS
42 * This class encapsulates the repeat times field of the
43 * Session Description Protocol.
45 * The normative reference for correct formatting and values is
46 * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in
47 * member documentation. The implementation supports this normative
48 * reference, but does not enforce it fully.
52 class CSdpRepeatField : public CBase
54 public: // Constructors and destructor
56 * Constructs a new repeat times field.
58 * @param aText A string containing a correctly
59 * formatted field value terminated by a CRLF.
60 * @return a new instance.
62 IMPORT_C static CSdpRepeatField* DecodeL(const TDesC8& aText);
65 * Constructs a new repeat times field and adds the pointer to the
68 * @param aText A string containing a correctly
69 * formatted field value terminated by a CRLF.
70 * @return a new instance.
72 IMPORT_C static CSdpRepeatField* DecodeLC(const TDesC8& aText);
75 * Constructs a new repeat times field.
77 * @param aRepeatInterval Repeat interval value
79 * @param aActiveDuration Active duration.
80 * @param aOffsets At least one time offset.
81 * @return a new instance.
83 IMPORT_C static CSdpRepeatField* NewL(
84 const TSdpTypedTime aRepeatInterval,
85 const TSdpTypedTime aActiveDuration,
86 const RArray<TSdpTypedTime>& aOffsets);
89 * Constructs a new repeat times field and adds the pointer to the
92 * @param aRepeatInterval Repeat interval value
94 * @param aActiveDuration Active duration.
95 * @param aOffsets At least one time offset.
96 * @return a new instance.
98 IMPORT_C static CSdpRepeatField* NewLC(
99 const TSdpTypedTime aRepeatInterval,
100 const TSdpTypedTime aActiveDuration,
101 const RArray<TSdpTypedTime>& aOffsets);
104 * Deletes the resources held by the instance.
106 IMPORT_C ~CSdpRepeatField();
108 public: // New functions
110 * Outputs the field formatted according to SDP syntax and including
111 * the terminating CRLF.
113 * @param aStream Stream used for output. On return
114 * the stream includes correctly formatted repeat field.
116 IMPORT_C void EncodeL(RWriteStream& aStream) const;
119 * Creates a new instance that is equal to the target.
121 * @return a new instance.
123 IMPORT_C CSdpRepeatField * CloneL() const;
126 * Compares this instance to another for equality.
128 * @param aObj The instance to compare to.
129 * @return ETrue if equal, EFalse if not.
131 IMPORT_C TBool operator == (const CSdpRepeatField & aObj) const;
134 * Gets the repeat interval.
136 * @return The repeat interval.
138 IMPORT_C const TSdpTypedTime RepeatInterval() const;
141 * Sets the repeat interval.
143 * @param aValue Repeat interval value greater than zero.
144 * @leave KErrSdpCodecRepeatField if aValue is not positive integer
147 IMPORT_C void SetRepeatIntervalL(const TSdpTypedTime aValue);
150 * Gets the active duration..
152 * @return The active duration.
154 IMPORT_C const TSdpTypedTime ActiveDuration() const;
157 * Sets the active duration.
159 * @param Active duration.
161 IMPORT_C void SetActiveDuration(const TSdpTypedTime aValue);
164 * Gets the array of time offsets.
165 * This array is used directly for element insertion and removal.
167 * @return The offsets.
169 IMPORT_C const RArray<TSdpTypedTime>& TimeOffsets() const;
172 * Sets the time offsets.
174 * @param aOffsets At least one time offset.
176 IMPORT_C void SetTimeOffsetsL(const RArray<TSdpTypedTime>& aValue);
180 * Externalizes the object to stream
182 * @param aStream Stream where the object's state will be stored
184 void ExternalizeL(RWriteStream& aStream) const;
187 * Creates object from the stream data
189 * @param aStream Stream where the object's state will be read
190 * @return Initialized object
192 static CSdpRepeatField* InternalizeL(RReadStream& aStream);
195 CSdpRepeatField(const TSdpTypedTime aRepeatInterval,
196 const TSdpTypedTime aActiveDuration);
198 void ConstructL(const TDesC8& aText);
199 void ConstructL(const RArray<TSdpTypedTime>& aOffsets);
204 TSdpTypedTime iRepeatInterval;
205 TSdpTypedTime iActiveDuration;
206 RArray<TSdpTypedTime> iTimeOffsets;
211 #endif // CSDPREPEATFIELD_H