realtimenetprots/sipfw/SIP/Codec/api/sipacceptlanguageheader.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     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 "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".
       
     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 
       
    31 // FORWARD DECLARATIONS
       
    32 class CSIPAcceptHeaderParams;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 /**
       
    36 * @publishedAll
       
    37 * @released
       
    38 *
       
    39 * Class provides functions for setting and getting media types and
       
    40 * parameters in SIP "Accept-Language" header.
       
    41 *
       
    42 * @lib sipcodec.lib
       
    43 */
       
    44 class CSIPAcceptLanguageHeader : public CSIPParameterHeaderBase
       
    45 	{
       
    46 	public: // Constructors and destructor
       
    47 
       
    48 		/**
       
    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. 
       
    54 		*/
       
    55 		IMPORT_C static RPointerArray<CSIPAcceptLanguageHeader> 
       
    56 			DecodeL(const TDesC8& aValue);
       
    57 
       
    58 		/**
       
    59 		* Creates a new instance of CSIPAcceptLanguageHeader
       
    60 		* @param aLanguageRange a language-range to set
       
    61 		* @return a new instance of CSIPAcceptLanguageHeader
       
    62 		*/
       
    63 		IMPORT_C static CSIPAcceptLanguageHeader* 
       
    64 			NewL(const TDesC8& aLanguageRange);
       
    65 
       
    66 		/**
       
    67 		* Creates a new instance of CSIPAcceptLanguageHeader and puts it onto
       
    68 		* the cleanup stack
       
    69 		* @param aLanguageRange a language-range to set
       
    70 		* @return a new instance of CSIPAcceptLanguageHeader
       
    71 		*/
       
    72 		IMPORT_C static CSIPAcceptLanguageHeader* 
       
    73 			NewLC(const TDesC8& aLanguageRange);
       
    74 
       
    75 		/**
       
    76 		* Destructor, deletes the resources of CSIPAcceptLanguageHeader.
       
    77 		*/
       
    78 		IMPORT_C ~CSIPAcceptLanguageHeader();
       
    79 
       
    80 
       
    81 	public: // New functions
       
    82 
       
    83 		/**
       
    84 		* Gets the language-range from the "Accept-Language" header
       
    85 		* @return a language-range
       
    86 		*/
       
    87 		IMPORT_C const TDesC8& LanguageRange() const;
       
    88 
       
    89 		/**
       
    90 		* Sets the language-range in the "Accept-Language" header
       
    91 		* @param aLanguageRange a language-range
       
    92 		*/
       
    93 		IMPORT_C void SetLanguageRangeL(const TDesC8& aLanguageRange);
       
    94 
       
    95 		/**
       
    96 		* Gets the value of "q"-parameter
       
    97 		* @return the "q"-parameter value
       
    98 		*/
       
    99 		IMPORT_C TReal QParameter() const;
       
   100 
       
   101 		/**
       
   102 		* Sets the "q"-parameter value
       
   103 		* @param aQValue a "q"-parameter value to set
       
   104 		*/
       
   105 		IMPORT_C void SetQParameterL(TReal aQValue);
       
   106 
       
   107 		/**
       
   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
       
   112 		*/
       
   113 		IMPORT_C static CSIPHeaderBase* 
       
   114 			InternalizeValueL(RReadStream& aReadStream);
       
   115 
       
   116 
       
   117 	public: // From CSIPHeaderBase
       
   118 
       
   119 		/**
       
   120 		* From CSIPHeaderBase CloneL
       
   121 		*/
       
   122 		IMPORT_C CSIPHeaderBase* CloneL() const;
       
   123 		
       
   124 		/**
       
   125 		* From CSIPHeaderBase Name
       
   126 		*/
       
   127 		IMPORT_C RStringF Name() const;
       
   128 
       
   129 
       
   130 	public: // From CSIPHeaderBase, for internal use
       
   131 
       
   132         /**
       
   133         * @internalComponent
       
   134         */
       
   135 		TBool MoreThanOneAllowed() const;
       
   136 		
       
   137         /**
       
   138         * @internalComponent
       
   139         */
       
   140 		TPreferredPlace PreferredPlaceInMessage() const;
       
   141 
       
   142 	public: // New functions, for internal use
       
   143 
       
   144 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
       
   145 
       
   146 	private: // From CSIPHeaderBase
       
   147 
       
   148 		void ExternalizeValueL(RWriteStream& aWriteStream) const;
       
   149 
       
   150 	private: // From CSIPParameterHeaderBase
       
   151 
       
   152 		HBufC8* ToTextMandatoryPartLC() const;
       
   153 		void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
       
   154 		const CSIPParamContainerBase& Params() const;
       
   155 		CSIPParamContainerBase& Params();
       
   156 
       
   157 	private: // New functions
       
   158 
       
   159 		CSIPAcceptLanguageHeader();
       
   160 		void ConstructL();
       
   161 		void ConstructL(const TDesC8& aLanguageRange);
       
   162 		void ConstructL(const CSIPAcceptLanguageHeader& aAcceptLanguageHeader);
       
   163 		void DoInternalizeValueL(RReadStream& aReadStream);
       
   164 
       
   165 	private: // Data
       
   166 
       
   167 		HBufC8* iLanguageRange;
       
   168 		CSIPAcceptHeaderParams* iParams;
       
   169 
       
   170 	private: // For testing purposes
       
   171 #ifdef CPPUNIT_TEST	
       
   172 		friend class CSIPAcceptLanguageHeaderTest;
       
   173 #endif
       
   174 	};
       
   175 
       
   176 #endif // CSIPACCEPTLANGUAGEHEADER_H
       
   177 
       
   178 // End of File