epoc32/include/mw/sdpbandwidthfield.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          : SdpBandwidthField.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 CSDPBANDWIDTHFIELD_H
williamr@2
    25
#define CSDPBANDWIDTHFIELD_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
williamr@2
    35
// CLASS DECLARATION
williamr@2
    36
/**
williamr@2
    37
 *  @publishedAll
williamr@2
    38
 *  @released
williamr@2
    39
 *
williamr@2
    40
 *	This class encapsulates the bandwidth field of 
williamr@2
    41
 *  the Session Description Protocol.
williamr@2
    42
 * 
williamr@2
    43
 *	The normative reference for correct formatting and values is
williamr@2
    44
 *	draft-ietf-mmusic-sdp-new-14 unless specified otherwise in
williamr@2
    45
 *  member documentation. The implementation supports this normative
williamr@2
    46
 *  reference, but does not enforce it fully. 
williamr@2
    47
 *
williamr@2
    48
 *  @lib sdpcodec.lib
williamr@2
    49
 */
williamr@2
    50
class CSdpBandwidthField : public CBase
williamr@2
    51
	{
williamr@2
    52
	public:// Constructors and destructor
williamr@2
    53
       /**
williamr@2
    54
         *	Constructs a new bandwidth field.
williamr@2
    55
		 *	
williamr@2
    56
         *	@param aText A string containing a correctly 
williamr@2
    57
         *         formatted field value terminated by a CRLF.
williamr@2
    58
         *	@return a new instance.
williamr@2
    59
         */
williamr@2
    60
		IMPORT_C static CSdpBandwidthField* DecodeL(const TDesC8& aText);
williamr@2
    61
williamr@2
    62
         /**
williamr@2
    63
         *	Constructs a new bandwidth field and adds the pointer to the 
williamr@2
    64
         *  cleanup stack.
williamr@2
    65
		 *	
williamr@2
    66
         *	@param aText A string containing a correctly 
williamr@2
    67
         *         formatted field value terminated by a CRLF.
williamr@2
    68
         *	@return a new instance.
williamr@2
    69
         */
williamr@2
    70
		IMPORT_C static CSdpBandwidthField* DecodeLC(const TDesC8& aText);
williamr@2
    71
williamr@2
    72
        /**
williamr@2
    73
         *	Constructs a new bandwidth field.
williamr@2
    74
		 *
williamr@2
    75
         *	@param aModifier Bandwidth modifier.
williamr@2
    76
		 *  @param aValue Bandwidth value.
williamr@2
    77
         *	@return a new instance.
williamr@2
    78
		 */
williamr@2
    79
		IMPORT_C static CSdpBandwidthField* NewL(RStringF aModifier,
williamr@2
    80
												 TUint32 aValue);
williamr@2
    81
williamr@2
    82
        /**
williamr@2
    83
         *	Constructs a new bandwidth field and adds the pointer to the 
williamr@2
    84
         *  cleanup stack.
williamr@2
    85
		 *
williamr@2
    86
         *	@param aModifier Bandwidth modifier.
williamr@2
    87
		 *  @param aValue Bandwidth value.
williamr@2
    88
         *	@return a new instance.
williamr@2
    89
		 */
williamr@2
    90
		IMPORT_C static CSdpBandwidthField* NewLC(RStringF aModifier,
williamr@2
    91
												  TUint32 aValue);
williamr@2
    92
williamr@2
    93
 
williamr@2
    94
        /**
williamr@2
    95
		 *	Deletes the resources held by the instance.
williamr@2
    96
		 */
williamr@2
    97
		IMPORT_C ~CSdpBandwidthField();
williamr@2
    98
williamr@2
    99
    public: // New functions
williamr@2
   100
		/**
williamr@2
   101
		 *	Outputs the field formatted according to SDP syntax and including
williamr@2
   102
		 *  the terminating CRLF.
williamr@2
   103
		 * 
williamr@2
   104
		 *	@param aStream Stream used for output. On return 
williamr@2
   105
         *         the stream includes correctly formatted bandwidth field.
williamr@2
   106
		 */
williamr@2
   107
		IMPORT_C void EncodeL(RWriteStream& aStream) const;
williamr@2
   108
williamr@2
   109
		/**
williamr@2
   110
		 *	Creates a new instance that is equal to the target.
williamr@2
   111
		 *
williamr@2
   112
		 *	@return a new instance.
williamr@2
   113
		 */
williamr@2
   114
		IMPORT_C CSdpBandwidthField * CloneL() const;
williamr@2
   115
williamr@2
   116
		/**	
williamr@2
   117
		 *	Compares this instance to another for equality.
williamr@2
   118
		 *
williamr@2
   119
		 *	@param aObj The instance to compare to.
williamr@2
   120
		 *	@return ETrue if equal, EFalse if not.
williamr@2
   121
		 */
williamr@2
   122
		IMPORT_C TBool operator == (const CSdpBandwidthField& aObj) const;
williamr@2
   123
williamr@2
   124
		/**
williamr@2
   125
		 *	Gets the bandwidth modifier.
williamr@2
   126
		 *
williamr@2
   127
		 *	@return The modifier that can be pre-defined in the 
williamr@2
   128
		 *          SDP string table or defined by the user.
williamr@2
   129
		 */
williamr@2
   130
		IMPORT_C RStringF Modifier() const;
williamr@2
   131
williamr@2
   132
		/**
williamr@2
   133
		 *	Sets the bandwidth modifier.
williamr@2
   134
		 *
williamr@2
   135
         *	@param aModifier A valid bandwidth modifier name.
williamr@2
   136
		 */
williamr@2
   137
		IMPORT_C void SetModifier(RStringF aModifier);
williamr@2
   138
williamr@2
   139
		/**
williamr@2
   140
		 *	Gets the bandwidth value.
williamr@2
   141
		 *
williamr@2
   142
		 *	@return The value.
williamr@2
   143
		 */
williamr@2
   144
		IMPORT_C TUint32 Value() const;
williamr@2
   145
williamr@2
   146
		/**
williamr@2
   147
		 *	Sets the bandwidth value.
williamr@2
   148
		 *
williamr@2
   149
		 *	@param aValue The Value.
williamr@2
   150
		 */
williamr@2
   151
		IMPORT_C void SetValue(TUint32 aValue);
williamr@2
   152
williamr@2
   153
    public:
williamr@2
   154
		/**
williamr@2
   155
		 *	Externalize the instance in a memory optimized format.
williamr@2
   156
		 *
williamr@2
   157
		 *	@param aStream The stream used for externalization.
williamr@2
   158
		 */
williamr@2
   159
		void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   160
williamr@2
   161
		/**
williamr@2
   162
		 *	Create a new instance from value created with ExternalizeL().
williamr@2
   163
		 *
williamr@2
   164
		 *	@param aStream The stream used for internalization.
williamr@2
   165
		 *	@return	The new instance.
williamr@2
   166
		 */
williamr@2
   167
        static CSdpBandwidthField* InternalizeL(RReadStream& aStream);
williamr@2
   168
williamr@2
   169
    private:
williamr@2
   170
        CSdpBandwidthField();
williamr@2
   171
		void ConstructL(const TDesC8& aText);
williamr@2
   172
		void ConstructL(RStringF aModifier, TUint32 aValue);
williamr@2
   173
		void ConstructL(const TDesC8& aModifier, TUint32 aValue);
williamr@2
   174
williamr@2
   175
        /**
williamr@2
   176
         *  Copies given modifier to iModifier. If aModifier is none of 
williamr@2
   177
         *  predefined ones, new modifier is added to stringPool.
williamr@2
   178
         *
williamr@2
   179
         *  @param aModifier Given modifier
williamr@2
   180
         */
williamr@2
   181
        void CopyModifierL(const TDesC8& aModifier);
williamr@2
   182
williamr@2
   183
    private: // Data
williamr@2
   184
		RStringF iModifier;
williamr@2
   185
        TUint32 iValue;
williamr@2
   186
        RStringPool iStringPool;
williamr@2
   187
	};
williamr@2
   188
williamr@2
   189
#endif // CSDPBANDWIDTHFIELD_H