1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/sdpbandwidthfield.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,190 @@
1.4 +/*
1.5 +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* 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
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* Name : SdpBandwidthField.h
1.19 +* Part of : SDP Codec
1.20 +* Interface : SDK API, SDP Codec API
1.21 +* Version : 1.0
1.22 +*
1.23 +*/
1.24 +
1.25 +
1.26 +
1.27 +#ifndef CSDPBANDWIDTHFIELD_H
1.28 +#define CSDPBANDWIDTHFIELD_H
1.29 +
1.30 +// INCLUDES
1.31 +#include <e32base.h>
1.32 +#include <stringpool.h>
1.33 +#include "_sdpdefs.h"
1.34 +
1.35 +// FORWARD DECLARATIONS
1.36 +class RReadStream;
1.37 +class RWriteStream;
1.38 +
1.39 +// CLASS DECLARATION
1.40 +/**
1.41 + * @publishedAll
1.42 + * @released
1.43 + *
1.44 + * This class encapsulates the bandwidth field of
1.45 + * the Session Description Protocol.
1.46 + *
1.47 + * The normative reference for correct formatting and values is
1.48 + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in
1.49 + * member documentation. The implementation supports this normative
1.50 + * reference, but does not enforce it fully.
1.51 + *
1.52 + * @lib sdpcodec.lib
1.53 + */
1.54 +class CSdpBandwidthField : public CBase
1.55 + {
1.56 + public:// Constructors and destructor
1.57 + /**
1.58 + * Constructs a new bandwidth field.
1.59 + *
1.60 + * @param aText A string containing a correctly
1.61 + * formatted field value terminated by a CRLF.
1.62 + * @return a new instance.
1.63 + */
1.64 + IMPORT_C static CSdpBandwidthField* DecodeL(const TDesC8& aText);
1.65 +
1.66 + /**
1.67 + * Constructs a new bandwidth field and adds the pointer to the
1.68 + * cleanup stack.
1.69 + *
1.70 + * @param aText A string containing a correctly
1.71 + * formatted field value terminated by a CRLF.
1.72 + * @return a new instance.
1.73 + */
1.74 + IMPORT_C static CSdpBandwidthField* DecodeLC(const TDesC8& aText);
1.75 +
1.76 + /**
1.77 + * Constructs a new bandwidth field.
1.78 + *
1.79 + * @param aModifier Bandwidth modifier.
1.80 + * @param aValue Bandwidth value.
1.81 + * @return a new instance.
1.82 + */
1.83 + IMPORT_C static CSdpBandwidthField* NewL(RStringF aModifier,
1.84 + TUint32 aValue);
1.85 +
1.86 + /**
1.87 + * Constructs a new bandwidth field and adds the pointer to the
1.88 + * cleanup stack.
1.89 + *
1.90 + * @param aModifier Bandwidth modifier.
1.91 + * @param aValue Bandwidth value.
1.92 + * @return a new instance.
1.93 + */
1.94 + IMPORT_C static CSdpBandwidthField* NewLC(RStringF aModifier,
1.95 + TUint32 aValue);
1.96 +
1.97 +
1.98 + /**
1.99 + * Deletes the resources held by the instance.
1.100 + */
1.101 + IMPORT_C ~CSdpBandwidthField();
1.102 +
1.103 + public: // New functions
1.104 + /**
1.105 + * Outputs the field formatted according to SDP syntax and including
1.106 + * the terminating CRLF.
1.107 + *
1.108 + * @param aStream Stream used for output. On return
1.109 + * the stream includes correctly formatted bandwidth field.
1.110 + */
1.111 + IMPORT_C void EncodeL(RWriteStream& aStream) const;
1.112 +
1.113 + /**
1.114 + * Creates a new instance that is equal to the target.
1.115 + *
1.116 + * @return a new instance.
1.117 + */
1.118 + IMPORT_C CSdpBandwidthField * CloneL() const;
1.119 +
1.120 + /**
1.121 + * Compares this instance to another for equality.
1.122 + *
1.123 + * @param aObj The instance to compare to.
1.124 + * @return ETrue if equal, EFalse if not.
1.125 + */
1.126 + IMPORT_C TBool operator == (const CSdpBandwidthField& aObj) const;
1.127 +
1.128 + /**
1.129 + * Gets the bandwidth modifier.
1.130 + *
1.131 + * @return The modifier that can be pre-defined in the
1.132 + * SDP string table or defined by the user.
1.133 + */
1.134 + IMPORT_C RStringF Modifier() const;
1.135 +
1.136 + /**
1.137 + * Sets the bandwidth modifier.
1.138 + *
1.139 + * @param aModifier A valid bandwidth modifier name.
1.140 + */
1.141 + IMPORT_C void SetModifier(RStringF aModifier);
1.142 +
1.143 + /**
1.144 + * Gets the bandwidth value.
1.145 + *
1.146 + * @return The value.
1.147 + */
1.148 + IMPORT_C TUint32 Value() const;
1.149 +
1.150 + /**
1.151 + * Sets the bandwidth value.
1.152 + *
1.153 + * @param aValue The Value.
1.154 + */
1.155 + IMPORT_C void SetValue(TUint32 aValue);
1.156 +
1.157 + public:
1.158 + /**
1.159 + * Externalize the instance in a memory optimized format.
1.160 + *
1.161 + * @param aStream The stream used for externalization.
1.162 + */
1.163 + void ExternalizeL(RWriteStream& aStream) const;
1.164 +
1.165 + /**
1.166 + * Create a new instance from value created with ExternalizeL().
1.167 + *
1.168 + * @param aStream The stream used for internalization.
1.169 + * @return The new instance.
1.170 + */
1.171 + static CSdpBandwidthField* InternalizeL(RReadStream& aStream);
1.172 +
1.173 + private:
1.174 + CSdpBandwidthField();
1.175 + void ConstructL(const TDesC8& aText);
1.176 + void ConstructL(RStringF aModifier, TUint32 aValue);
1.177 + void ConstructL(const TDesC8& aModifier, TUint32 aValue);
1.178 +
1.179 + /**
1.180 + * Copies given modifier to iModifier. If aModifier is none of
1.181 + * predefined ones, new modifier is added to stringPool.
1.182 + *
1.183 + * @param aModifier Given modifier
1.184 + */
1.185 + void CopyModifierL(const TDesC8& aModifier);
1.186 +
1.187 + private: // Data
1.188 + RStringF iModifier;
1.189 + TUint32 iValue;
1.190 + RStringPool iStringPool;
1.191 + };
1.192 +
1.193 +#endif // CSDPBANDWIDTHFIELD_H