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