epoc32/include/mw/sdpfmtattributefield.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/sdpfmtattributefield.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,263 @@
     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          : SdpFmtAttributeField.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 CSDPFMTATTRIBUTEFIELD_H
    1.28 +#define CSDPFMTATTRIBUTEFIELD_H
    1.29 +
    1.30 +//  INCLUDES
    1.31 +#include <e32base.h>
    1.32 +#include <stringpool.h>
    1.33 +#include "_sdpdefs.h"
    1.34 +
    1.35 +// FORWARD DECLARATIONS
    1.36 +class RReadStream;
    1.37 +class RWriteStream;
    1.38 +class CSdpAttributeField;
    1.39 +class TSdpRtpmapValue;
    1.40 +
    1.41 +// CLASS DECLARATION
    1.42 +/**
    1.43 + *  @publishedAll
    1.44 + *  @released
    1.45 + *
    1.46 + *	This class encapsulates the attribute field of the Session Description
    1.47 + *  Protocol for media format/payload type level attributes. Media and session
    1.48 + *  level attributes are supported by the CSdpAttributeField class. 
    1.49 + *
    1.50 + *	The normative reference for correct formatting and values is
    1.51 + *	draft-ietf-mmusic-sdp-new-14 unless specified otherwise in
    1.52 + *  member documentation. The implementation supports this normative
    1.53 + *  reference, but does not enforce it fully. 
    1.54 + *
    1.55 + *  @lib sdpcodec.lib
    1.56 + */
    1.57 +class CSdpFmtAttributeField : public CBase
    1.58 +	{
    1.59 +    public: // Constructors and destructor
    1.60 +        /**
    1.61 +         *	Constructs a new media format level attribute field.
    1.62 +		 * 
    1.63 +		 *	@param aText A string containing a correctly 
    1.64 +         *         formatted field value terminated by a CRLF.
    1.65 +         *  @return a new instance.
    1.66 +         */
    1.67 +		IMPORT_C static CSdpFmtAttributeField* DecodeL( const TDesC8& aText );
    1.68 +
    1.69 +        /**
    1.70 +         *	Constructs a new media format level attribute field  and adds the 
    1.71 +         *  pointer to the cleanup stack.
    1.72 +		 *			 
    1.73 +         *	@param aText A string containing a correctly 
    1.74 +         *         formatted field value terminated by a CRLF.
    1.75 +         *	@return a new instance.
    1.76 +         */
    1.77 +		IMPORT_C static CSdpFmtAttributeField* DecodeLC( const TDesC8& aText);
    1.78 +
    1.79 +        /**
    1.80 +         *	Constructs a new media level format attribute field.
    1.81 +		 *
    1.82 +         *	@param aAttribute The attribute name. It can be a pre-defined
    1.83 +         *         name in the SDP string pool or defined by the client.
    1.84 +         *	@param aFormat A valid format/payload identifier 
    1.85 +         *         used in the format list of the media description.
    1.86 +         *	@param aValue A valid attribute value or an empty 
    1.87 +         *         descriptor to omit the value part.
    1.88 +         *	@return a new instance.
    1.89 +		 */
    1.90 +		IMPORT_C static CSdpFmtAttributeField* NewL(
    1.91 +            RStringF aAttribute, const TDesC8& aFormat, const TDesC8& aValue );
    1.92 +
    1.93 +        /**
    1.94 +         *	Constructs a new media format level attribute field and adds the 
    1.95 +         *  pointer to the cleanup stack.
    1.96 +		 *
    1.97 +         *	@param aAttribute The attribute name. It can be a pre-defined 
    1.98 +         *         name in the SDP string pool or defined by the client.
    1.99 +         *	@param aFormat A valid format/payload identifier 
   1.100 +         *         used in the format list of the media description.
   1.101 +         *	@param aValue A valid attribute value or an empty 
   1.102 +         *         descriptor to omit the value part.
   1.103 +         *	@return a new instance.
   1.104 +		 */
   1.105 +		IMPORT_C static CSdpFmtAttributeField* NewLC(
   1.106 +            RStringF aAttribute, const TDesC8& aFormat, const TDesC8& aValue );
   1.107 +
   1.108 +		/**
   1.109 +		 *	Deletes the resources held by the instance.
   1.110 +		 */
   1.111 +		IMPORT_C ~CSdpFmtAttributeField();
   1.112 +
   1.113 +    public: // New functions
   1.114 +
   1.115 +		/**
   1.116 +		 *	Outputs the field formatted according to SDP syntax and including
   1.117 +		 *  the terminating CRLF.
   1.118 +		 * 
   1.119 +		 *	@param aStream Stream used for output. On return 
   1.120 +         *         the stream includes correctly formatted attribute field.
   1.121 +		 */
   1.122 +		IMPORT_C void EncodeL( RWriteStream& aStream ) const;
   1.123 +
   1.124 +		/**
   1.125 +		 *	Creates a new instance that is equal to the target.
   1.126 +		 *
   1.127 +		 *	@return a new instance.
   1.128 +		 */
   1.129 +		IMPORT_C CSdpFmtAttributeField * CloneL() const;
   1.130 +
   1.131 +		/**	
   1.132 +		 *	Compares this instance to another for equality. 
   1.133 +		 *
   1.134 +		 *	@param aObj The instance to compare to.
   1.135 +		 *	@return ETrue if equal, EFalse if not.
   1.136 +		 */
   1.137 +		IMPORT_C TBool operator== ( const CSdpFmtAttributeField& aObj ) const;
   1.138 +
   1.139 +		/**
   1.140 +		 *	Gets the attribute.
   1.141 +		 *	
   1.142 +		 *	@return	The attribute name. The name can be pre-defined 
   1.143 +         *          name in the SDP string table or defined by the client.
   1.144 +         */
   1.145 +		IMPORT_C RStringF Attribute() const;
   1.146 +
   1.147 +		/**
   1.148 +		 *	Gets the format.
   1.149 +		 *	
   1.150 +		 *	@return	The format.
   1.151 +		 */
   1.152 +		IMPORT_C const TDesC8& Format() const;
   1.153 +
   1.154 +		/**
   1.155 +		 *	Gets the attribute value.
   1.156 +		 *	
   1.157 +		 *	@return The value  or an empty descriptor if there is no value part.
   1.158 +		 */
   1.159 +		IMPORT_C const TDesC8& Value() const;
   1.160 +
   1.161 +		/**
   1.162 +		 *	Sets the attribute, format/payload type and attribute value.
   1.163 +		 *
   1.164 +         *	@param aAttribute A valid attribute name. It can be a 
   1.165 +         *         pre-defined name in the SDP string pool or defined by 
   1.166 +         *         the client.
   1.167 +         *	@param aFormat A valid format/payload identifier 
   1.168 +         *         used in the formatlist of the media description.
   1.169 +         *	@param aValue A valid attribute value or an empty 
   1.170 +         *         descriptor to omit the value part.
   1.171 +         *  @leave KErrSdpCodecMediaAttributeField if aAttribute is not rtpmap
   1.172 +         *         or fmtp attribute.
   1.173 +		 */
   1.174 +		IMPORT_C void SetL(
   1.175 +            RStringF aAttribute, const TDesC8& aFormat, const TDesC8& aValue );
   1.176 +
   1.177 +    public: // Internal to codec
   1.178 +
   1.179 +        /**
   1.180 +         *  Externalizes the object to stream
   1.181 +         *
   1.182 +         *  @param aStream Stream where the object's state will be stored
   1.183 +         */
   1.184 +		void ExternalizeL( RWriteStream& aStream ) const;
   1.185 +
   1.186 +        /**
   1.187 +         *  Creates object from the stream data
   1.188 +         *
   1.189 +         *  @param aStream Stream where the object's state will be read        
   1.190 +         *  @return Initialized object
   1.191 +         */
   1.192 +		static CSdpFmtAttributeField* InternalizeL( RReadStream& aStream );
   1.193 +
   1.194 +        /**
   1.195 +         *  Returns attribute field
   1.196 +         *
   1.197 +         *  @return Attribute field
   1.198 +         */
   1.199 +        const CSdpAttributeField* AttributeField() const;
   1.200 +
   1.201 +    private: // New methods
   1.202 +
   1.203 +        /**
   1.204 +         *  Creates object from the stream data.
   1.205 +         *	Does the "2nd phase construction" of internalization.
   1.206 +         *
   1.207 +         *  @param aStream Stream where the object's state will be read
   1.208 +         */
   1.209 +        void DoInternalizeL( RReadStream& aStream );
   1.210 +
   1.211 +        /**
   1.212 +         *  Formats value parameters
   1.213 +         *
   1.214 +         *  @param aField Attribute field object
   1.215 +         */
   1.216 +        void FormatValueParamsL( CSdpAttributeField* aField );
   1.217 +
   1.218 +    private: // Construction and destruction
   1.219 +        
   1.220 +        /**
   1.221 +         *  Constructor
   1.222 +         */
   1.223 +        CSdpFmtAttributeField();
   1.224 +
   1.225 +        /**
   1.226 +         *  Second phase construction
   1.227 +         *         
   1.228 +         *  @param aText A string containing a correctly formatted field value
   1.229 +		 *         terminated by a CRLF.
   1.230 +         */
   1.231 +        void ConstructL( const TDesC8& aText );
   1.232 +
   1.233 +        /**
   1.234 +         *  Second phase construction
   1.235 +         *
   1.236 +         *	@param aAttribute The attribute from the pre-defined SDP string 
   1.237 +		 *         table or defined by the user
   1.238 +         *	@param aFormat A valid format/payload identifier used in the format
   1.239 +		 *         list of the media description.
   1.240 +         *	@param aValue A valid attribute value or an empty descriptor
   1.241 +		 *         to omit the value part.         
   1.242 +		 */
   1.243 +		void ConstructL(
   1.244 +            RStringF aAttribute, const TDesC8& aFormat, const TDesC8& aValue );    
   1.245 +
   1.246 +        
   1.247 +        /**
   1.248 +         *  Decode format parameter from string
   1.249 +         *
   1.250 +         *	@param aText A text includeing format parameter.
   1.251 +		 */
   1.252 +        void DecodeFormatL(const TDesC8& aText);
   1.253 +        
   1.254 +        __DECLARE_TEST;
   1.255 +
   1.256 +    private:
   1.257 +
   1.258 +        RStringPool iPool;
   1.259 +        CSdpAttributeField* iAttributeField;       
   1.260 +		/** Pointer to the format part*/
   1.261 +		TPtrC8 iFormat;
   1.262 +        /** Pointer to the format parameters*/
   1.263 +		TPtrC8 iValuePart;
   1.264 +	};
   1.265 +
   1.266 +#endif // CSDPFMTATTRIBUTEFIELD_H