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 : sipacceptlanguageheader.h
17 * Interface : SDK API, SIP Codec API
25 #ifndef CSIPACCEPTLANGUAGEHEADER_H
26 #define CSIPACCEPTLANGUAGEHEADER_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-Language" header.
44 class CSIPAcceptLanguageHeader : public CSIPParameterHeaderBase
46 public: // Constructors and destructor
49 * Constructs a CSIPAcceptLanguageHeader from textual representation
50 * of the header's value part.
51 * @param aValue a value part of a "Accept-Language"-header
52 * @return an array containing one to many instances of
53 * CSIPAcceptLanguageHeader.
55 IMPORT_C static RPointerArray<CSIPAcceptLanguageHeader>
56 DecodeL(const TDesC8& aValue);
59 * Creates a new instance of CSIPAcceptLanguageHeader
60 * @param aLanguageRange a language-range to set
61 * @return a new instance of CSIPAcceptLanguageHeader
63 IMPORT_C static CSIPAcceptLanguageHeader*
64 NewL(const TDesC8& aLanguageRange);
67 * Creates a new instance of CSIPAcceptLanguageHeader and puts it onto
69 * @param aLanguageRange a language-range to set
70 * @return a new instance of CSIPAcceptLanguageHeader
72 IMPORT_C static CSIPAcceptLanguageHeader*
73 NewLC(const TDesC8& aLanguageRange);
76 * Destructor, deletes the resources of CSIPAcceptLanguageHeader.
78 IMPORT_C ~CSIPAcceptLanguageHeader();
81 public: // New functions
84 * Gets the language-range from the "Accept-Language" header
85 * @return a language-range
87 IMPORT_C const TDesC8& LanguageRange() const;
90 * Sets the language-range in the "Accept-Language" header
91 * @param aLanguageRange a language-range
93 IMPORT_C void SetLanguageRangeL(const TDesC8& aLanguageRange);
96 * Gets the value of "q"-parameter
97 * @return the "q"-parameter value
99 IMPORT_C TReal QParameter() const;
102 * Sets the "q"-parameter value
103 * @param aQValue a "q"-parameter value to set
105 IMPORT_C void SetQParameterL(TReal aQValue);
108 * Constructs an instance of a CSIPAcceptLanguageHeader from a RReadStream
109 * @param aReadStream a stream containing the value of the
110 * externalized header object (header name not included).
111 * @return an instance of a CSIPAcceptLanguageHeader
113 IMPORT_C static CSIPHeaderBase*
114 InternalizeValueL(RReadStream& aReadStream);
117 public: // From CSIPHeaderBase
120 * From CSIPHeaderBase CloneL
122 IMPORT_C CSIPHeaderBase* CloneL() const;
125 * From CSIPHeaderBase Name
127 IMPORT_C RStringF Name() const;
130 public: // From CSIPHeaderBase, for internal use
135 TBool MoreThanOneAllowed() const;
140 TPreferredPlace PreferredPlaceInMessage() const;
142 public: // New functions, for internal use
144 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
146 private: // From CSIPHeaderBase
148 void ExternalizeValueL(RWriteStream& aWriteStream) const;
150 private: // From CSIPParameterHeaderBase
152 HBufC8* ToTextMandatoryPartLC() const;
153 void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
154 const CSIPParamContainerBase& Params() const;
155 CSIPParamContainerBase& Params();
157 private: // New functions
159 CSIPAcceptLanguageHeader();
161 void ConstructL(const TDesC8& aLanguageRange);
162 void ConstructL(const CSIPAcceptLanguageHeader& aAcceptLanguageHeader);
163 void DoInternalizeValueL(RReadStream& aReadStream);
167 HBufC8* iLanguageRange;
168 CSIPAcceptHeaderParams* iParams;
170 private: // For testing purposes
172 friend class CSIPAcceptLanguageHeaderTest;
176 #endif // CSIPACCEPTLANGUAGEHEADER_H