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