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