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