epoc32/include/sdpfmtattributefield.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     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
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:
williamr@2
    15
* Name          : SdpFmtAttributeField.h
williamr@2
    16
* Part of       : SDP Codec
williamr@2
    17
* Interface     : SDK API, SDP Codec API
williamr@2
    18
* Version       : 1.0
williamr@2
    19
*
williamr@2
    20
*/
williamr@2
    21
williamr@2
    22
williamr@2
    23
williamr@2
    24
#ifndef CSDPFMTATTRIBUTEFIELD_H
williamr@2
    25
#define CSDPFMTATTRIBUTEFIELD_H
williamr@2
    26
williamr@2
    27
//  INCLUDES
williamr@2
    28
#include <e32base.h>
williamr@2
    29
#include <stringpool.h>
williamr@2
    30
#include "_sdpdefs.h"
williamr@2
    31
williamr@2
    32
// FORWARD DECLARATIONS
williamr@2
    33
class RReadStream;
williamr@2
    34
class RWriteStream;
williamr@2
    35
class CSdpAttributeField;
williamr@2
    36
class TSdpRtpmapValue;
williamr@2
    37
williamr@2
    38
// CLASS DECLARATION
williamr@2
    39
/**
williamr@2
    40
 *  @publishedAll
williamr@2
    41
 *  @released
williamr@2
    42
 *
williamr@2
    43
 *	This class encapsulates the attribute field of the Session Description
williamr@2
    44
 *  Protocol for media format/payload type level attributes. Media and session
williamr@2
    45
 *  level attributes are supported by the CSdpAttributeField class. 
williamr@2
    46
 *
williamr@2
    47
 *	The normative reference for correct formatting and values is
williamr@2
    48
 *	draft-ietf-mmusic-sdp-new-14 unless specified otherwise in
williamr@2
    49
 *  member documentation. The implementation supports this normative
williamr@2
    50
 *  reference, but does not enforce it fully. 
williamr@2
    51
 *
williamr@2
    52
 *  @lib sdpcodec.lib
williamr@2
    53
 */
williamr@2
    54
class CSdpFmtAttributeField : public CBase
williamr@2
    55
	{
williamr@2
    56
    public: // Constructors and destructor
williamr@2
    57
        /**
williamr@2
    58
         *	Constructs a new media format level attribute field.
williamr@2
    59
		 * 
williamr@2
    60
		 *	@param aText A string containing a correctly 
williamr@2
    61
         *         formatted field value terminated by a CRLF.
williamr@2
    62
         *  @return a new instance.
williamr@2
    63
         */
williamr@2
    64
		IMPORT_C static CSdpFmtAttributeField* DecodeL( const TDesC8& aText );
williamr@2
    65
williamr@2
    66
        /**
williamr@2
    67
         *	Constructs a new media format level attribute field  and adds the 
williamr@2
    68
         *  pointer to the cleanup stack.
williamr@2
    69
		 *			 
williamr@2
    70
         *	@param aText A string containing a correctly 
williamr@2
    71
         *         formatted field value terminated by a CRLF.
williamr@2
    72
         *	@return a new instance.
williamr@2
    73
         */
williamr@2
    74
		IMPORT_C static CSdpFmtAttributeField* DecodeLC( const TDesC8& aText);
williamr@2
    75
williamr@2
    76
        /**
williamr@2
    77
         *	Constructs a new media level format attribute field.
williamr@2
    78
		 *
williamr@2
    79
         *	@param aAttribute The attribute name. It can be a pre-defined
williamr@2
    80
         *         name in the SDP string pool or defined by the client.
williamr@2
    81
         *	@param aFormat A valid format/payload identifier 
williamr@2
    82
         *         used in the format list of the media description.
williamr@2
    83
         *	@param aValue A valid attribute value or an empty 
williamr@2
    84
         *         descriptor to omit the value part.
williamr@2
    85
         *	@return a new instance.
williamr@2
    86
		 */
williamr@2
    87
		IMPORT_C static CSdpFmtAttributeField* NewL(
williamr@2
    88
            RStringF aAttribute, const TDesC8& aFormat, const TDesC8& aValue );
williamr@2
    89
williamr@2
    90
        /**
williamr@2
    91
         *	Constructs a new media format level attribute field and adds the 
williamr@2
    92
         *  pointer to the cleanup stack.
williamr@2
    93
		 *
williamr@2
    94
         *	@param aAttribute The attribute name. It can be a pre-defined 
williamr@2
    95
         *         name in the SDP string pool or defined by the client.
williamr@2
    96
         *	@param aFormat A valid format/payload identifier 
williamr@2
    97
         *         used in the format list of the media description.
williamr@2
    98
         *	@param aValue A valid attribute value or an empty 
williamr@2
    99
         *         descriptor to omit the value part.
williamr@2
   100
         *	@return a new instance.
williamr@2
   101
		 */
williamr@2
   102
		IMPORT_C static CSdpFmtAttributeField* NewLC(
williamr@2
   103
            RStringF aAttribute, const TDesC8& aFormat, const TDesC8& aValue );
williamr@2
   104
williamr@2
   105
		/**
williamr@2
   106
		 *	Deletes the resources held by the instance.
williamr@2
   107
		 */
williamr@2
   108
		IMPORT_C ~CSdpFmtAttributeField();
williamr@2
   109
williamr@2
   110
    public: // New functions
williamr@2
   111
williamr@2
   112
		/**
williamr@2
   113
		 *	Outputs the field formatted according to SDP syntax and including
williamr@2
   114
		 *  the terminating CRLF.
williamr@2
   115
		 * 
williamr@2
   116
		 *	@param aStream Stream used for output. On return 
williamr@2
   117
         *         the stream includes correctly formatted attribute field.
williamr@2
   118
		 */
williamr@2
   119
		IMPORT_C void EncodeL( RWriteStream& aStream ) const;
williamr@2
   120
williamr@2
   121
		/**
williamr@2
   122
		 *	Creates a new instance that is equal to the target.
williamr@2
   123
		 *
williamr@2
   124
		 *	@return a new instance.
williamr@2
   125
		 */
williamr@2
   126
		IMPORT_C CSdpFmtAttributeField * CloneL() const;
williamr@2
   127
williamr@2
   128
		/**	
williamr@2
   129
		 *	Compares this instance to another for equality. 
williamr@2
   130
		 *
williamr@2
   131
		 *	@param aObj The instance to compare to.
williamr@2
   132
		 *	@return ETrue if equal, EFalse if not.
williamr@2
   133
		 */
williamr@2
   134
		IMPORT_C TBool operator== ( const CSdpFmtAttributeField& aObj ) const;
williamr@2
   135
williamr@2
   136
		/**
williamr@2
   137
		 *	Gets the attribute.
williamr@2
   138
		 *	
williamr@2
   139
		 *	@return	The attribute name. The name can be pre-defined 
williamr@2
   140
         *          name in the SDP string table or defined by the client.
williamr@2
   141
         */
williamr@2
   142
		IMPORT_C RStringF Attribute() const;
williamr@2
   143
williamr@2
   144
		/**
williamr@2
   145
		 *	Gets the format.
williamr@2
   146
		 *	
williamr@2
   147
		 *	@return	The format.
williamr@2
   148
		 */
williamr@2
   149
		IMPORT_C const TDesC8& Format() const;
williamr@2
   150
williamr@2
   151
		/**
williamr@2
   152
		 *	Gets the attribute value.
williamr@2
   153
		 *	
williamr@2
   154
		 *	@return The value  or an empty descriptor if there is no value part.
williamr@2
   155
		 */
williamr@2
   156
		IMPORT_C const TDesC8& Value() const;
williamr@2
   157
williamr@2
   158
		/**
williamr@2
   159
		 *	Sets the attribute, format/payload type and attribute value.
williamr@2
   160
		 *
williamr@2
   161
         *	@param aAttribute A valid attribute name. It can be a 
williamr@2
   162
         *         pre-defined name in the SDP string pool or defined by 
williamr@2
   163
         *         the client.
williamr@2
   164
         *	@param aFormat A valid format/payload identifier 
williamr@2
   165
         *         used in the formatlist of the media description.
williamr@2
   166
         *	@param aValue A valid attribute value or an empty 
williamr@2
   167
         *         descriptor to omit the value part.
williamr@2
   168
         *  @leave KErrSdpCodecMediaAttributeField if aAttribute is not rtpmap
williamr@2
   169
         *         or fmtp attribute.
williamr@2
   170
		 */
williamr@2
   171
		IMPORT_C void SetL(
williamr@2
   172
            RStringF aAttribute, const TDesC8& aFormat, const TDesC8& aValue );
williamr@2
   173
williamr@2
   174
    public: // Internal to codec
williamr@2
   175
williamr@2
   176
        /**
williamr@2
   177
         *  Externalizes the object to stream
williamr@2
   178
         *
williamr@2
   179
         *  @param aStream Stream where the object's state will be stored
williamr@2
   180
         */
williamr@2
   181
		void ExternalizeL( RWriteStream& aStream ) const;
williamr@2
   182
williamr@2
   183
        /**
williamr@2
   184
         *  Creates object from the stream data
williamr@2
   185
         *
williamr@2
   186
         *  @param aStream Stream where the object's state will be read        
williamr@2
   187
         *  @return Initialized object
williamr@2
   188
         */
williamr@2
   189
		static CSdpFmtAttributeField* InternalizeL( RReadStream& aStream );
williamr@2
   190
williamr@2
   191
        /**
williamr@2
   192
         *  Returns attribute field
williamr@2
   193
         *
williamr@2
   194
         *  @return Attribute field
williamr@2
   195
         */
williamr@2
   196
        const CSdpAttributeField* AttributeField() const;
williamr@2
   197
williamr@2
   198
    private: // New methods
williamr@2
   199
williamr@2
   200
        /**
williamr@2
   201
         *  Creates object from the stream data.
williamr@2
   202
         *	Does the "2nd phase construction" of internalization.
williamr@2
   203
         *
williamr@2
   204
         *  @param aStream Stream where the object's state will be read
williamr@2
   205
         */
williamr@2
   206
        void DoInternalizeL( RReadStream& aStream );
williamr@2
   207
williamr@2
   208
        /**
williamr@2
   209
         *  Formats value parameters
williamr@2
   210
         *
williamr@2
   211
         *  @param aField Attribute field object
williamr@2
   212
         */
williamr@2
   213
        void FormatValueParamsL( CSdpAttributeField* aField );
williamr@2
   214
williamr@2
   215
    private: // Construction and destruction
williamr@2
   216
        
williamr@2
   217
        /**
williamr@2
   218
         *  Constructor
williamr@2
   219
         */
williamr@2
   220
        CSdpFmtAttributeField();
williamr@2
   221
williamr@2
   222
        /**
williamr@2
   223
         *  Second phase construction
williamr@2
   224
         *         
williamr@2
   225
         *  @param aText A string containing a correctly formatted field value
williamr@2
   226
		 *         terminated by a CRLF.
williamr@2
   227
         */
williamr@2
   228
        void ConstructL( const TDesC8& aText );
williamr@2
   229
williamr@2
   230
        /**
williamr@2
   231
         *  Second phase construction
williamr@2
   232
         *
williamr@2
   233
         *	@param aAttribute The attribute from the pre-defined SDP string 
williamr@2
   234
		 *         table or defined by the user
williamr@2
   235
         *	@param aFormat A valid format/payload identifier used in the format
williamr@2
   236
		 *         list of the media description.
williamr@2
   237
         *	@param aValue A valid attribute value or an empty descriptor
williamr@2
   238
		 *         to omit the value part.         
williamr@2
   239
		 */
williamr@2
   240
		void ConstructL(
williamr@2
   241
            RStringF aAttribute, const TDesC8& aFormat, const TDesC8& aValue );    
williamr@2
   242
williamr@2
   243
        
williamr@2
   244
        /**
williamr@2
   245
         *  Decode format parameter from string
williamr@2
   246
         *
williamr@2
   247
         *	@param aText A text includeing format parameter.
williamr@2
   248
		 */
williamr@2
   249
        void DecodeFormatL(const TDesC8& aText);
williamr@2
   250
        
williamr@2
   251
        __DECLARE_TEST;
williamr@2
   252
williamr@2
   253
    private:
williamr@2
   254
williamr@2
   255
        RStringPool iPool;
williamr@2
   256
        CSdpAttributeField* iAttributeField;       
williamr@2
   257
		/** Pointer to the format part*/
williamr@2
   258
		TPtrC8 iFormat;
williamr@2
   259
        /** Pointer to the format parameters*/
williamr@2
   260
		TPtrC8 iValuePart;
williamr@2
   261
	};
williamr@2
   262
williamr@2
   263
#endif // CSDPFMTATTRIBUTEFIELD_H