epoc32/include/mw/sipcontenttypeheader.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100 (2010-03-31)
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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        : sipcontenttypeheader.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 CSIPCONTENTTYPEHEADER_H
    26 #define CSIPCONTENTTYPEHEADER_H
    27 
    28 //  INCLUDES
    29 #include "sipparameterheaderbase.h"
    30 
    31 // FORWARD DECLARATIONS
    32 class CSIPContentTypeHeaderParams;
    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 "Content-Type" header.
    41 *
    42 *  @lib sipcodec.lib
    43 */
    44 class CSIPContentTypeHeader : public CSIPParameterHeaderBase
    45 	{
    46 	public:	// Constructors and destructor
    47 
    48 		/**
    49 		* Constructs a CSIPContentTypeHeader from textual representation 
    50 		* of the header's value part.
    51 		* @param aValue a value part of a "Content-Type"-header
    52 		* @return a new instance of CSIPContentTypeHeader
    53 		*/
    54 		IMPORT_C static CSIPContentTypeHeader* DecodeL(const TDesC8& aValue);
    55 
    56 		/**
    57 		* Creates a new instance of CSIPContentTypeHeader
    58 		* @param aMediaType a media type to set. For example "application"
    59 		* @param aMediaSubtype a media subtype to set. For example "sdp"
    60 		* @return a new instance of CSIPContentTypeHeader
    61 		*/
    62 		IMPORT_C static CSIPContentTypeHeader* 
    63 			NewL(const TDesC8& aMediaType, const TDesC8& aMediaSubtype);
    64 
    65 		/**
    66 		* Creates a new instance of CSIPContentTypeHeader 
    67 		* and puts it onto the cleanup stack
    68 		* @param aMediaType a media type to set. For example "application"
    69 		* @param aMediaSubtype a media subtype to set. For example "sdp"
    70 		* @return a new instance of CSIPContentTypeHeader
    71 		*/
    72 		IMPORT_C static CSIPContentTypeHeader* 
    73 			NewLC(const TDesC8& aMediaType, const TDesC8& aMediaSubtype);
    74 
    75 		/**
    76 		* Destructor, deletes the resources of CSIPContentTypeHeader.
    77 		*/
    78 		IMPORT_C ~CSIPContentTypeHeader();
    79 
    80 	public: // New functions
    81 
    82 		/**
    83 		* Gets the media type from the "Content-Type" header
    84 		* @return a media type
    85 		*/
    86 		IMPORT_C const TDesC8& MediaType() const;
    87 
    88 		/**
    89 		* Sets the media type in the "Content-Type" header
    90 		* @param aMediaType a media type
    91 		*/
    92 		IMPORT_C void SetMediaTypeL(const TDesC8& aMediaType);
    93 
    94 		/**
    95 		* Gets the media subtype from the "Content-Type" header
    96 		* @return a media subtype
    97 		*/
    98 		IMPORT_C const TDesC8& MediaSubtype() const;
    99 
   100 		/**
   101 		* Sets the media subtype in the "Content-Type" header
   102 		* @param aMediaSubtype a media subtype
   103 		*/
   104 		IMPORT_C void SetMediaSubtypeL(const TDesC8& aMediaSubtype);
   105 
   106 		/**
   107 		* Constructs an instance of a CSIPContentTypeHeader from a RReadStream
   108 		* @param aReadStream a stream containing the value of the
   109 		*        externalized header object (header name not included).
   110 		* @return an instance of a CSIPContentTypeHeader
   111 		*/
   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 HasCompactName() const;
   136 		
   137         /**
   138         * @internalComponent
   139         */		
   140 		RStringF CompactName() const;
   141 		
   142         /**
   143         * @internalComponent
   144         */		
   145 		TPreferredPlace PreferredPlaceInMessage() const;
   146 
   147 	public: // New functions, for internal use
   148 
   149 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
   150 
   151 	private: // From CSIPHeaderBase
   152 
   153 		void ExternalizeValueL(RWriteStream& aWriteStream) const;
   154 
   155 	private: // CSIPParameterHeaderBase
   156 
   157 		HBufC8* ToTextMandatoryPartLC() const;
   158 		void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
   159 		const CSIPParamContainerBase& Params() const;
   160 		CSIPParamContainerBase& Params();
   161 
   162 	private: // Constructors
   163 
   164 		CSIPContentTypeHeader();
   165 		void ConstructL();
   166 		void ConstructL(const TDesC8& aMediaType, const TDesC8& aMediaSubtype);
   167 		void ConstructL(const CSIPContentTypeHeader& aContentTypeHeader);
   168 
   169 	private: // New functions
   170 
   171 		void DoInternalizeValueL(RReadStream& aReadStream);
   172 
   173 	private: // Data
   174 
   175 		HBufC8* iMediaType;
   176 		HBufC8* iMediaSubtype;
   177 		CSIPContentTypeHeaderParams* iParams;
   178 
   179 	private: // For testing purposes
   180 #ifdef CPPUNIT_TEST	
   181 		friend class CSIPContentTypeHeaderTest;
   182 #endif
   183 	};
   184 
   185 #endif // CSIPCONTENTTYPEHEADER_H
   186 
   187 // End of File