2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Name : SdpBandwidthField.h
17 * Interface : SDK API, SDP Codec API
24 #ifndef CSDPBANDWIDTHFIELD_H
25 #define CSDPBANDWIDTHFIELD_H
29 #include <stringpool.h>
31 // FORWARD DECLARATIONS
40 * This class encapsulates the bandwidth field of
41 * the Session Description Protocol.
43 * The normative reference for correct formatting and values is
44 * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in
45 * member documentation. The implementation supports this normative
46 * reference, but does not enforce it fully.
50 class CSdpBandwidthField : public CBase
52 public:// Constructors and destructor
54 * Constructs a new bandwidth field.
56 * @param aText A string containing a correctly
57 * formatted field value terminated by a CRLF.
58 * @return a new instance.
60 IMPORT_C static CSdpBandwidthField* DecodeL(const TDesC8& aText);
63 * Constructs a new bandwidth field and adds the pointer to the
66 * @param aText A string containing a correctly
67 * formatted field value terminated by a CRLF.
68 * @return a new instance.
70 IMPORT_C static CSdpBandwidthField* DecodeLC(const TDesC8& aText);
73 * Constructs a new bandwidth field.
75 * @param aModifier Bandwidth modifier.
76 * @param aValue Bandwidth value.
77 * @return a new instance.
79 IMPORT_C static CSdpBandwidthField* NewL(RStringF aModifier,
83 * Constructs a new bandwidth field and adds the pointer to the
86 * @param aModifier Bandwidth modifier.
87 * @param aValue Bandwidth value.
88 * @return a new instance.
90 IMPORT_C static CSdpBandwidthField* NewLC(RStringF aModifier,
95 * Deletes the resources held by the instance.
97 IMPORT_C ~CSdpBandwidthField();
99 public: // New functions
101 * Outputs the field formatted according to SDP syntax and including
102 * the terminating CRLF.
104 * @param aStream Stream used for output. On return
105 * the stream includes correctly formatted bandwidth field.
107 IMPORT_C void EncodeL(RWriteStream& aStream) const;
110 * Creates a new instance that is equal to the target.
112 * @return a new instance.
114 IMPORT_C CSdpBandwidthField * CloneL() const;
117 * Compares this instance to another for equality.
119 * @param aObj The instance to compare to.
120 * @return ETrue if equal, EFalse if not.
122 IMPORT_C TBool operator == (const CSdpBandwidthField& aObj) const;
125 * Gets the bandwidth modifier.
127 * @return The modifier that can be pre-defined in the
128 * SDP string table or defined by the user.
130 IMPORT_C RStringF Modifier() const;
133 * Sets the bandwidth modifier.
135 * @param aModifier A valid bandwidth modifier name.
137 IMPORT_C void SetModifier(RStringF aModifier);
140 * Gets the bandwidth value.
144 IMPORT_C TUint32 Value() const;
147 * Sets the bandwidth value.
149 * @param aValue The Value.
151 IMPORT_C void SetValue(TUint32 aValue);
155 * Externalize the instance in a memory optimized format.
157 * @param aStream The stream used for externalization.
159 void ExternalizeL(RWriteStream& aStream) const;
162 * Create a new instance from value created with ExternalizeL().
164 * @param aStream The stream used for internalization.
165 * @return The new instance.
167 static CSdpBandwidthField* InternalizeL(RReadStream& aStream);
170 CSdpBandwidthField();
171 void ConstructL(const TDesC8& aText);
172 void ConstructL(RStringF aModifier, TUint32 aValue);
173 void ConstructL(const TDesC8& aModifier, TUint32 aValue);
176 * Copies given modifier to iModifier. If aModifier is none of
177 * predefined ones, new modifier is added to stringPool.
179 * @param aModifier Given modifier
181 void CopyModifierL(const TDesC8& aModifier);
186 RStringPool iStringPool;
189 #endif // CSDPBANDWIDTHFIELD_H