2 * Copyright (c) 2004-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 : sipacceptencodingheader.h
17 * Interface : SDK API, SIP Codec API
25 #ifndef CSIPACCEPTENCODINGHEADER_H
26 #define CSIPACCEPTENCODINGHEADER_H
29 #include "sipparameterheaderbase.h"
31 // FORWARD DECLARATIONS
32 class CSIPAcceptHeaderParams;
39 * Class provides functions for setting and getting media types and
40 * parameters in SIP "Accept-Encoding" header.
44 class CSIPAcceptEncodingHeader : public CSIPParameterHeaderBase
46 public: // Constructors and destructor
49 * Constructs a CSIPAcceptEncodingHeader from textual representation
50 * of the header's value part.
51 * @param aValue a value part of a "Accept-Encoding"-header
52 * @return An array containing one to many CSIPAcceptEncodingHeader
55 IMPORT_C static RPointerArray<CSIPAcceptEncodingHeader>
56 DecodeL(const TDesC8& aValue);
59 * Creates a new instance of CSIPAcceptEncodingHeader
60 * @param aCodings a codings to set.
61 * @return a new instance of CSIPAcceptEncodingHeader
63 IMPORT_C static CSIPAcceptEncodingHeader* NewL(const TDesC8& aCodings);
66 * Creates a new instance of CSIPAcceptEncodingHeader
67 * and puts it onto the cleanup stack
68 * @param aCodings a codings to set.
69 * @return a new instance of CSIPAcceptEncodingHeader
71 IMPORT_C static CSIPAcceptEncodingHeader* NewLC(const TDesC8& aCodings);
74 * Destructor, deletes the resources of CSIPAcceptEncodingHeader.
76 IMPORT_C ~CSIPAcceptEncodingHeader();
79 public: // New functions
82 * Gets the codings from the "Accept-Encoding" header
85 IMPORT_C const TDesC8& Codings() const;
88 * Sets the codings in the "Accept-Encoding" header
89 * @param aCodings the codings
91 IMPORT_C void SetCodingsL(const TDesC8& aCodings);
94 * Gets the value of "q"-parameter
95 * @return the "q"-parameter value
97 IMPORT_C TReal QParameter() const;
100 * Sets the "q"-parameter value
101 * @param aQValue a "q"-parameter value to setī
103 IMPORT_C void SetQParameterL(TReal aQValue);
106 * Constructs an instance of a CSIPAcceptEncodingHeader from a RReadStream
107 * @param aReadStream a stream containing the value of the
108 * externalized header object (header name not included).
109 * @return An instance of a CSIPAcceptEncodingHeader
111 IMPORT_C static CSIPHeaderBase*
112 InternalizeValueL(RReadStream& aReadStream);
115 public: // From CSIPHeaderBase
118 * From CSIPHeaderBase CloneL
120 IMPORT_C CSIPHeaderBase* CloneL() const;
123 * From CSIPHeaderBase Name
125 IMPORT_C RStringF Name() const;
128 public: // From CSIPHeaderBase, for internal use
133 TBool MoreThanOneAllowed() const;
138 TPreferredPlace PreferredPlaceInMessage() const;
140 public: // New functions, for internal use
142 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
144 private: // From CSIPHeaderBase
146 void ExternalizeValueL(RWriteStream& aWriteStream) const;
148 private: // From CSIPParameterHeaderBase
150 HBufC8* ToTextMandatoryPartLC() const;
151 void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
152 const CSIPParamContainerBase& Params() const;
153 CSIPParamContainerBase& Params();
155 private: // Constructors
157 CSIPAcceptEncodingHeader();
159 void ConstructL(const TDesC8& aCodings);
160 void ConstructL(const CSIPAcceptEncodingHeader& aAcceptEncodingHeader);
162 private: // New functions
164 void DoInternalizeValueL(RReadStream& aReadStream);
169 CSIPAcceptHeaderParams* iParams;
171 private: // For testing purposes
173 friend class CSIPAcceptEncodingHeaderTest;
177 #endif // CSIPACCEPTENCODINGHEADER_H