1.1 --- a/epoc32/include/sdprepeatfield.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/sdprepeatfield.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,211 @@
1.4 -sdprepeatfield.h
1.5 +/*
1.6 +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* 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
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +* Name : SdpRepeatField.h
1.20 +* Part of : SDP Codec
1.21 +* Interface : SDK API, SDP Codec API
1.22 +* Version : 1.0
1.23 +*
1.24 +*/
1.25 +
1.26 +
1.27 +
1.28 +#ifndef CSDPREPEATFIELD_H
1.29 +#define CSDPREPEATFIELD_H
1.30 +
1.31 +// INCLUDES
1.32 +#include <e32base.h>
1.33 +#include <stringpool.h>
1.34 +#include "_sdpdefs.h"
1.35 +#include <sdptypedtime.h>
1.36 +
1.37 +// FORWARD DECLARATIONS
1.38 +class RReadStream;
1.39 +class RWriteStream;
1.40 +
1.41 +// CLASS DECLARATION
1.42 +/**
1.43 + * @publishedAll
1.44 + * @released
1.45 + *
1.46 + * This class encapsulates the repeat times field of the
1.47 + * Session Description Protocol.
1.48 + *
1.49 + * The normative reference for correct formatting and values is
1.50 + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in
1.51 + * member documentation. The implementation supports this normative
1.52 + * reference, but does not enforce it fully.
1.53 + *
1.54 + * @lib sdpcodec.lib
1.55 + */
1.56 +class CSdpRepeatField : public CBase
1.57 + {
1.58 + public: // Constructors and destructor
1.59 + /**
1.60 + * Constructs a new repeat times field.
1.61 + *
1.62 + * @param aText A string containing a correctly
1.63 + * formatted field value terminated by a CRLF.
1.64 + * @return a new instance.
1.65 + */
1.66 + IMPORT_C static CSdpRepeatField* DecodeL(const TDesC8& aText);
1.67 +
1.68 + /**
1.69 + * Constructs a new repeat times field and adds the pointer to the
1.70 + * cleanup stack.
1.71 + *
1.72 + * @param aText A string containing a correctly
1.73 + * formatted field value terminated by a CRLF.
1.74 + * @return a new instance.
1.75 + */
1.76 + IMPORT_C static CSdpRepeatField* DecodeLC(const TDesC8& aText);
1.77 +
1.78 + /**
1.79 + * Constructs a new repeat times field.
1.80 + *
1.81 + * @param aRepeatInterval Repeat interval value
1.82 + * greater than zero.
1.83 + * @param aActiveDuration Active duration.
1.84 + * @param aOffsets At least one time offset.
1.85 + * @return a new instance.
1.86 + */
1.87 + IMPORT_C static CSdpRepeatField* NewL(
1.88 + const TSdpTypedTime aRepeatInterval,
1.89 + const TSdpTypedTime aActiveDuration,
1.90 + const RArray<TSdpTypedTime>& aOffsets);
1.91 +
1.92 + /**
1.93 + * Constructs a new repeat times field and adds the pointer to the
1.94 + * cleanup stack.
1.95 + *
1.96 + * @param aRepeatInterval Repeat interval value
1.97 + * greater than zero.
1.98 + * @param aActiveDuration Active duration.
1.99 + * @param aOffsets At least one time offset.
1.100 + * @return a new instance.
1.101 + */
1.102 + IMPORT_C static CSdpRepeatField* NewLC(
1.103 + const TSdpTypedTime aRepeatInterval,
1.104 + const TSdpTypedTime aActiveDuration,
1.105 + const RArray<TSdpTypedTime>& aOffsets);
1.106 +
1.107 + /**
1.108 + * Deletes the resources held by the instance.
1.109 + */
1.110 + IMPORT_C ~CSdpRepeatField();
1.111 +
1.112 + public: // New functions
1.113 + /**
1.114 + * Outputs the field formatted according to SDP syntax and including
1.115 + * the terminating CRLF.
1.116 + *
1.117 + * @param aStream Stream used for output. On return
1.118 + * the stream includes correctly formatted repeat field.
1.119 + */
1.120 + IMPORT_C void EncodeL(RWriteStream& aStream) const;
1.121 +
1.122 + /**
1.123 + * Creates a new instance that is equal to the target.
1.124 + *
1.125 + * @return a new instance.
1.126 + */
1.127 + IMPORT_C CSdpRepeatField * CloneL() const;
1.128 +
1.129 + /**
1.130 + * Compares this instance to another for equality.
1.131 + *
1.132 + * @param aObj The instance to compare to.
1.133 + * @return ETrue if equal, EFalse if not.
1.134 + */
1.135 + IMPORT_C TBool operator == (const CSdpRepeatField & aObj) const;
1.136 +
1.137 + /**
1.138 + * Gets the repeat interval.
1.139 + *
1.140 + * @return The repeat interval.
1.141 + */
1.142 + IMPORT_C const TSdpTypedTime RepeatInterval() const;
1.143 +
1.144 + /**
1.145 + * Sets the repeat interval.
1.146 + *
1.147 + * @param aValue Repeat interval value greater than zero.
1.148 + * @leave KErrSdpCodecRepeatField if aValue is not positive integer
1.149 + * value.
1.150 + */
1.151 + IMPORT_C void SetRepeatIntervalL(const TSdpTypedTime aValue);
1.152 +
1.153 + /**
1.154 + * Gets the active duration..
1.155 + *
1.156 + * @return The active duration.
1.157 + */
1.158 + IMPORT_C const TSdpTypedTime ActiveDuration() const;
1.159 +
1.160 + /**
1.161 + * Sets the active duration.
1.162 + *
1.163 + * @param Active duration.
1.164 + */
1.165 + IMPORT_C void SetActiveDuration(const TSdpTypedTime aValue);
1.166 +
1.167 + /**
1.168 + * Gets the array of time offsets.
1.169 + * This array is used directly for element insertion and removal.
1.170 + *
1.171 + * @return The offsets.
1.172 + */
1.173 + IMPORT_C const RArray<TSdpTypedTime>& TimeOffsets() const;
1.174 +
1.175 + /**
1.176 + * Sets the time offsets.
1.177 + *
1.178 + * @param aOffsets At least one time offset.
1.179 + */
1.180 + IMPORT_C void SetTimeOffsetsL(const RArray<TSdpTypedTime>& aValue);
1.181 +
1.182 + public:
1.183 + /**
1.184 + * Externalizes the object to stream
1.185 + *
1.186 + * @param aStream Stream where the object's state will be stored
1.187 + */
1.188 + void ExternalizeL(RWriteStream& aStream) const;
1.189 +
1.190 + /**
1.191 + * Creates object from the stream data
1.192 + *
1.193 + * @param aStream Stream where the object's state will be read
1.194 + * @return Initialized object
1.195 + */
1.196 + static CSdpRepeatField* InternalizeL(RReadStream& aStream);
1.197 +
1.198 + private:
1.199 + CSdpRepeatField(const TSdpTypedTime aRepeatInterval,
1.200 + const TSdpTypedTime aActiveDuration);
1.201 + CSdpRepeatField();
1.202 + void ConstructL(const TDesC8& aText);
1.203 + void ConstructL(const RArray<TSdpTypedTime>& aOffsets);
1.204 +
1.205 +
1.206 + private: // Data
1.207 + RStringPool iPool;
1.208 + TSdpTypedTime iRepeatInterval;
1.209 + TSdpTypedTime iActiveDuration;
1.210 + RArray<TSdpTypedTime> iTimeOffsets;
1.211 +
1.212 + __DECLARE_TEST;
1.213 + };
1.214 +
1.215 +#endif // CSDPREPEATFIELD_H