1.1 --- a/epoc32/include/sipacceptheader.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/sipacceptheader.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,207 @@
1.4 -sipacceptheader.h
1.5 +/*
1.6 +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* 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.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +* Name : sipacceptheader.h
1.20 +* Part of : SIP Codec
1.21 +* Interface : SDK API, SIP Codec API
1.22 +* Version : SIP/4.0
1.23 +*
1.24 +*/
1.25 +
1.26 +
1.27 +
1.28 +
1.29 +#ifndef CSIPACCEPTHEADER_H
1.30 +#define CSIPACCEPTHEADER_H
1.31 +
1.32 +// INCLUDES
1.33 +#include "sipparameterheaderbase.h"
1.34 +#include "_sipcodecdefs.h"
1.35 +
1.36 +// FORWARD DECLARATIONS
1.37 +class CSIPAcceptHeaderParams;
1.38 +
1.39 +
1.40 +// CLASS DECLARATION
1.41 +/**
1.42 +* @publishedAll
1.43 +* @released
1.44 +*
1.45 +* Class provides functions for setting and getting media types and
1.46 +* parameters in SIP "Accept" header.
1.47 +*
1.48 +* @lib sipcodec.lib
1.49 +*/
1.50 +class CSIPAcceptHeader : public CSIPParameterHeaderBase
1.51 + {
1.52 + public: // Constructors and destructor
1.53 +
1.54 + /**
1.55 + * Constructs a CSIPAcceptHeader from textual representation
1.56 + * of the header's value part.
1.57 + * An empty Accept-header can be created using this function
1.58 + * by passing a KNullDesC8 as a parameter.
1.59 + * @param aValue a value part of a "Accept"-header
1.60 + * @return an array containing one to many instances of CSIPAcceptHeader.
1.61 + */
1.62 + IMPORT_C static RPointerArray<CSIPAcceptHeader>
1.63 + DecodeL(const TDesC8& aValue);
1.64 +
1.65 + /**
1.66 + * Creates a new instance of CSIPAcceptHeader
1.67 + * @param aMediaType a media type to set. For example "application"
1.68 + * @param aMediaSubtype a media subtype to set. For example "sdp"
1.69 + * @return a new instance of CSIPAcceptHeader
1.70 + */
1.71 + IMPORT_C static CSIPAcceptHeader* NewL(const TDesC8& aMediaType,
1.72 + const TDesC8& aMediaSubtype);
1.73 +
1.74 + /**
1.75 + * Creates a new instance of CSIPAcceptHeader and puts it into
1.76 + * the cleanup stack
1.77 + * @param aMediaType a media type to set. For example "application"
1.78 + * @param aMediaSubtype a media subtype to set. For example "sdp"
1.79 + * @return a new instance of CSIPAcceptHeader
1.80 + */
1.81 + IMPORT_C static CSIPAcceptHeader* NewLC(const TDesC8& aMediaType,
1.82 + const TDesC8& aMediaSubtype);
1.83 +
1.84 + /**
1.85 + * Destructor, deletes the resources of CSIPAcceptHeader.
1.86 + */
1.87 + IMPORT_C ~CSIPAcceptHeader();
1.88 +
1.89 +
1.90 + public: // New functions
1.91 +
1.92 + /**
1.93 + * Check if the header is empty. If so,
1.94 + * the other getters will not return a meaningful value.
1.95 + * @return ETrue if empty, EFalse otherwise.
1.96 + */
1.97 + IMPORT_C TBool IsEmpty() const;
1.98 +
1.99 + /**
1.100 + * Gets the media type from the "Accept" header
1.101 + * @return a media type
1.102 + */
1.103 + IMPORT_C const TDesC8& MediaType() const;
1.104 +
1.105 + /**
1.106 + * Sets the media type in the "Accept" header
1.107 + * @pre IsEmpty() == EFalse
1.108 + * @param aMediaType a media type
1.109 + */
1.110 + IMPORT_C void SetMediaTypeL(const TDesC8& aMediaType);
1.111 +
1.112 + /**
1.113 + * Gets the media subtype from the "Accept" header
1.114 + * @return a media subtype
1.115 + */
1.116 + IMPORT_C const TDesC8& MediaSubtype() const;
1.117 + /**
1.118 + * Sets the media subtype in the "Accept" header
1.119 + * @pre IsEmpty() == EFalse
1.120 + * @param aMediaSubtype a media subtype
1.121 + */
1.122 + IMPORT_C void SetMediaSubtypeL(const TDesC8& aMediaSubtype);
1.123 +
1.124 + /**
1.125 + * Gets the value of "q"-parameter
1.126 + * @return the "q"-parameter value
1.127 + */
1.128 + IMPORT_C TReal QParameter() const;
1.129 +
1.130 + /**
1.131 + * Sets the "q"-parameter value
1.132 + * @param aQValue a "q"-parameter value to set
1.133 + */
1.134 + IMPORT_C void SetQParameterL(TReal aQValue);
1.135 +
1.136 + /**
1.137 + * Constructs an instance of a CSIPAcceptHeader from a RReadStream
1.138 + * @param aReadStream a stream containing the value of the
1.139 + * externalized header object (header name not included).
1.140 + * @return An instance of a CSIPAcceptHeader
1.141 + */
1.142 + IMPORT_C static CSIPHeaderBase*
1.143 + InternalizeValueL(RReadStream& aReadStream);
1.144 +
1.145 +
1.146 + public: // From CSIPHeaderBase
1.147 +
1.148 + /**
1.149 + * From CSIPHeaderBase CloneL
1.150 + */
1.151 + IMPORT_C CSIPHeaderBase* CloneL() const;
1.152 +
1.153 + /**
1.154 + * From CSIPHeaderBase Name
1.155 + */
1.156 + IMPORT_C RStringF Name() const;
1.157 +
1.158 +
1.159 + public: // From CSIPHeaderBase, for internal use
1.160 +
1.161 + /**
1.162 + * @internalComponent
1.163 + */
1.164 + TBool MoreThanOneAllowed() const;
1.165 +
1.166 + /**
1.167 + * @internalComponent
1.168 + */
1.169 + TPreferredPlace PreferredPlaceInMessage() const;
1.170 +
1.171 + public: // New functions, for internal use
1.172 +
1.173 + static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
1.174 +
1.175 + private: // From CSIPHeaderBase
1.176 +
1.177 + void ExternalizeValueL(RWriteStream& aWriteStream) const;
1.178 +
1.179 + private: // From CSIPParameterHeaderBase
1.180 +
1.181 + HBufC8* ToTextMandatoryPartLC() const;
1.182 + void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
1.183 + const CSIPParamContainerBase& Params() const;
1.184 + CSIPParamContainerBase& Params();
1.185 +
1.186 + private: // Constructors
1.187 +
1.188 + CSIPAcceptHeader(TBool aEmpty=EFalse);
1.189 + void ConstructL();
1.190 + void ConstructL(const TDesC8& aMediaType, const TDesC8& aMediaSubtype);
1.191 + void ConstructL(const CSIPAcceptHeader& aAcceptHeader);
1.192 +
1.193 + private: // New functions
1.194 +
1.195 + void DoInternalizeValueL(RReadStream& aReadStream);
1.196 +
1.197 + private: // Data
1.198 +
1.199 + TBool iEmpty;
1.200 + HBufC8* iMediaType;
1.201 + HBufC8* iMediaSubtype;
1.202 + CSIPAcceptHeaderParams* iParams;
1.203 +
1.204 + private: // For testing purposes
1.205 +
1.206 + UNIT_TEST(CSIPAcceptHeaderTest)
1.207 + };
1.208 +
1.209 +#endif // CSIPACCEPTHEADER_H
1.210 +
1.211 +// End of File