epoc32/include/sipacceptlanguageheader.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 sipacceptlanguageheader.h
     1 /*
       
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * 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
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Name        : sipacceptlanguageheader.h
       
    16 * Part of     : SIP Codec
       
    17 * Interface   : SDK API, SIP Codec API
       
    18 * Version     : SIP/4.0 
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef CSIPACCEPTLANGUAGEHEADER_H
       
    26 #define CSIPACCEPTLANGUAGEHEADER_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include "sipparameterheaderbase.h"
       
    30 #include "_sipcodecdefs.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CSIPAcceptHeaderParams;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 /**
       
    37 * @publishedAll
       
    38 * @released
       
    39 *
       
    40 * Class provides functions for setting and getting media types and
       
    41 * parameters in SIP "Accept-Language" header.
       
    42 *
       
    43 * @lib sipcodec.lib
       
    44 */
       
    45 class CSIPAcceptLanguageHeader : public CSIPParameterHeaderBase
       
    46 	{
       
    47 	public: // Constructors and destructor
       
    48 
       
    49 		/**
       
    50 		* Constructs a CSIPAcceptLanguageHeader from textual representation 
       
    51 		* of the header's value part.
       
    52 		* @param aValue a value part of a "Accept-Language"-header
       
    53 		* @return an array containing one to many instances of 
       
    54 		* 		   CSIPAcceptLanguageHeader. 
       
    55 		*/
       
    56 		IMPORT_C static RPointerArray<CSIPAcceptLanguageHeader> 
       
    57 			DecodeL(const TDesC8& aValue);
       
    58 
       
    59 		/**
       
    60 		* Creates a new instance of CSIPAcceptLanguageHeader
       
    61 		* @param aLanguageRange a language-range to set
       
    62 		* @return a new instance of CSIPAcceptLanguageHeader
       
    63 		*/
       
    64 		IMPORT_C static CSIPAcceptLanguageHeader* 
       
    65 			NewL(const TDesC8& aLanguageRange);
       
    66 
       
    67 		/**
       
    68 		* Creates a new instance of CSIPAcceptLanguageHeader and puts it onto
       
    69 		* the cleanup stack
       
    70 		* @param aLanguageRange a language-range to set
       
    71 		* @return a new instance of CSIPAcceptLanguageHeader
       
    72 		*/
       
    73 		IMPORT_C static CSIPAcceptLanguageHeader* 
       
    74 			NewLC(const TDesC8& aLanguageRange);
       
    75 
       
    76 		/**
       
    77 		* Destructor, deletes the resources of CSIPAcceptLanguageHeader.
       
    78 		*/
       
    79 		IMPORT_C ~CSIPAcceptLanguageHeader();
       
    80 
       
    81 
       
    82 	public: // New functions
       
    83 
       
    84 		/**
       
    85 		* Gets the language-range from the "Accept-Language" header
       
    86 		* @return a language-range
       
    87 		*/
       
    88 		IMPORT_C const TDesC8& LanguageRange() const;
       
    89 
       
    90 		/**
       
    91 		* Sets the language-range in the "Accept-Language" header
       
    92 		* @param aLanguageRange a language-range
       
    93 		*/
       
    94 		IMPORT_C void SetLanguageRangeL(const TDesC8& aLanguageRange);
       
    95 
       
    96 		/**
       
    97 		* Gets the value of "q"-parameter
       
    98 		* @return the "q"-parameter value
       
    99 		*/
       
   100 		IMPORT_C TReal QParameter() const;
       
   101 
       
   102 		/**
       
   103 		* Sets the "q"-parameter value
       
   104 		* @param aQValue a "q"-parameter value to set
       
   105 		*/
       
   106 		IMPORT_C void SetQParameterL(TReal aQValue);
       
   107 
       
   108 		/**
       
   109 		* Constructs an instance of a CSIPAcceptLanguageHeader from a RReadStream
       
   110 		* @param aReadStream a stream containing the value of the
       
   111 		*        externalized header object (header name not included).
       
   112 		* @return an instance of a CSIPAcceptLanguageHeader
       
   113 		*/
       
   114 		IMPORT_C static CSIPHeaderBase* 
       
   115 			InternalizeValueL(RReadStream& aReadStream);
       
   116 
       
   117 
       
   118 	public: // From CSIPHeaderBase
       
   119 
       
   120 		/**
       
   121 		* From CSIPHeaderBase CloneL
       
   122 		*/
       
   123 		IMPORT_C CSIPHeaderBase* CloneL() const;
       
   124 		
       
   125 		/**
       
   126 		* From CSIPHeaderBase Name
       
   127 		*/
       
   128 		IMPORT_C RStringF Name() const;
       
   129 
       
   130 
       
   131 	public: // From CSIPHeaderBase, for internal use
       
   132 
       
   133         /**
       
   134         * @internalComponent
       
   135         */
       
   136 		TBool MoreThanOneAllowed() const;
       
   137 		
       
   138         /**
       
   139         * @internalComponent
       
   140         */
       
   141 		TPreferredPlace PreferredPlaceInMessage() const;
       
   142 
       
   143 	public: // New functions, for internal use
       
   144 
       
   145 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
       
   146 
       
   147 	private: // From CSIPHeaderBase
       
   148 
       
   149 		void ExternalizeValueL(RWriteStream& aWriteStream) const;
       
   150 
       
   151 	private: // From CSIPParameterHeaderBase
       
   152 
       
   153 		HBufC8* ToTextMandatoryPartLC() const;
       
   154 		void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
       
   155 		const CSIPParamContainerBase& Params() const;
       
   156 		CSIPParamContainerBase& Params();
       
   157 
       
   158 	private: // New functions
       
   159 
       
   160 		CSIPAcceptLanguageHeader();
       
   161 		void ConstructL();
       
   162 		void ConstructL(const TDesC8& aLanguageRange);
       
   163 		void ConstructL(const CSIPAcceptLanguageHeader& aAcceptLanguageHeader);
       
   164 		void DoInternalizeValueL(RReadStream& aReadStream);
       
   165 
       
   166 	private: // Data
       
   167 
       
   168 		HBufC8* iLanguageRange;
       
   169 		CSIPAcceptHeaderParams* iParams;
       
   170 
       
   171 	private: // For testing purposes
       
   172 	
       
   173 		UNIT_TEST(CSIPAcceptLanguageHeaderTest)
       
   174 	};
       
   175 
       
   176 #endif // CSIPACCEPTLANGUAGEHEADER_H
       
   177 
       
   178 // End of File