realtimenetprots/sipfw/SIP/Codec/api/sipacceptencodingheader.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        : sipacceptencodingheader.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 CSIPACCEPTENCODINGHEADER_H
       
    26 #define CSIPACCEPTENCODINGHEADER_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-Encoding" header.
       
    41 *
       
    42 *  @lib sipcodec.lib
       
    43 */
       
    44 class CSIPAcceptEncodingHeader : public CSIPParameterHeaderBase
       
    45 	{
       
    46 	public:	// Constructors and destructor
       
    47 
       
    48 		/**
       
    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
       
    53 		*         instances
       
    54 		*/
       
    55 		IMPORT_C static RPointerArray<CSIPAcceptEncodingHeader> 
       
    56 			DecodeL(const TDesC8& aValue);
       
    57 
       
    58 		/**
       
    59 		* Creates a new instance of CSIPAcceptEncodingHeader
       
    60 		* @param aCodings a codings to set.
       
    61 		* @return a new instance of CSIPAcceptEncodingHeader
       
    62 		*/
       
    63 		IMPORT_C static CSIPAcceptEncodingHeader* NewL(const TDesC8& aCodings);
       
    64 
       
    65 		/**
       
    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
       
    70 		*/
       
    71 		IMPORT_C static CSIPAcceptEncodingHeader* NewLC(const TDesC8& aCodings);
       
    72 
       
    73 		/**
       
    74 		* Destructor, deletes the resources of CSIPAcceptEncodingHeader.
       
    75 		*/
       
    76 		IMPORT_C ~CSIPAcceptEncodingHeader();
       
    77 
       
    78 	
       
    79 	public:	// New functions  
       
    80 
       
    81 		/**
       
    82 		* Gets the codings from the "Accept-Encoding" header
       
    83 		* @return codings
       
    84 		*/
       
    85 		IMPORT_C const TDesC8& Codings() const;
       
    86 
       
    87 		/**
       
    88 		* Sets the codings in the "Accept-Encoding" header
       
    89 		* @param aCodings the codings
       
    90 		*/
       
    91 		IMPORT_C void SetCodingsL(const TDesC8& aCodings);
       
    92 
       
    93 		/**
       
    94 		* Gets the value of "q"-parameter
       
    95 		* @return the "q"-parameter value
       
    96 		*/
       
    97 		IMPORT_C TReal QParameter() const;
       
    98 
       
    99 		/**
       
   100 		* Sets the "q"-parameter value
       
   101 		* @param aQValue a "q"-parameter value to setī
       
   102 		*/
       
   103 		IMPORT_C void SetQParameterL(TReal aQValue);
       
   104 
       
   105 		/**
       
   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
       
   110 		*/
       
   111 		IMPORT_C static CSIPHeaderBase* 
       
   112 			InternalizeValueL(RReadStream& aReadStream);
       
   113 
       
   114 
       
   115 	public: // From CSIPHeaderBase
       
   116 
       
   117 		/**
       
   118 		* From CSIPHeaderBase CloneL
       
   119 		*/
       
   120 		IMPORT_C CSIPHeaderBase* CloneL() const;
       
   121 
       
   122 		/**
       
   123 		* From CSIPHeaderBase Name
       
   124 		*/
       
   125 		IMPORT_C RStringF Name() const;
       
   126 
       
   127 
       
   128 	public: // From CSIPHeaderBase, for internal use
       
   129 
       
   130         /**
       
   131 		* @internalComponent
       
   132 		*/
       
   133 		TBool MoreThanOneAllowed() const;
       
   134 		
       
   135         /**
       
   136 		* @internalComponent
       
   137 		*/		
       
   138 		TPreferredPlace PreferredPlaceInMessage() const;
       
   139 
       
   140 	public: // New functions, for internal use
       
   141 
       
   142 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
       
   143 
       
   144 	private: // From CSIPHeaderBase
       
   145 
       
   146 		void ExternalizeValueL(RWriteStream& aWriteStream) const;
       
   147 
       
   148 	private: // From CSIPParameterHeaderBase
       
   149 
       
   150 		HBufC8* ToTextMandatoryPartLC() const;
       
   151 		void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
       
   152 		const CSIPParamContainerBase& Params() const;
       
   153 		CSIPParamContainerBase& Params();
       
   154 	
       
   155 	private: // Constructors
       
   156 
       
   157 		CSIPAcceptEncodingHeader();
       
   158 		void ConstructL();
       
   159 		void ConstructL(const TDesC8& aCodings);
       
   160 		void ConstructL(const CSIPAcceptEncodingHeader& aAcceptEncodingHeader);
       
   161 
       
   162 	private: // New functions
       
   163 
       
   164 		void DoInternalizeValueL(RReadStream& aReadStream);
       
   165 
       
   166 	private: // Data
       
   167 
       
   168 		HBufC8* iCodings;
       
   169 		CSIPAcceptHeaderParams* iParams;
       
   170 
       
   171 	private: // For testing purposes
       
   172 #ifdef CPPUNIT_TEST	
       
   173 		friend class CSIPAcceptEncodingHeaderTest;
       
   174 #endif
       
   175 	};
       
   176 
       
   177 #endif // CSIPACCEPTENCODINGHEADER_H
       
   178 
       
   179 // End of File