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 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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Name : sipcontenttypeheader.h
17 * Interface : SDK API, SIP Codec API
25 #ifndef CSIPCONTENTTYPEHEADER_H
26 #define CSIPCONTENTTYPEHEADER_H
29 #include "sipparameterheaderbase.h"
30 #include "_sipcodecdefs.h"
32 // FORWARD DECLARATIONS
33 class CSIPContentTypeHeaderParams;
40 * Class provides functions for setting and getting media types and
41 * parameters in SIP "Content-Type" header.
45 class CSIPContentTypeHeader : public CSIPParameterHeaderBase
47 public: // Constructors and destructor
50 * Constructs a CSIPContentTypeHeader from textual representation
51 * of the header's value part.
52 * @param aValue a value part of a "Content-Type"-header
53 * @return a new instance of CSIPContentTypeHeader
55 IMPORT_C static CSIPContentTypeHeader* DecodeL(const TDesC8& aValue);
58 * Creates a new instance of CSIPContentTypeHeader
59 * @param aMediaType a media type to set. For example "application"
60 * @param aMediaSubtype a media subtype to set. For example "sdp"
61 * @return a new instance of CSIPContentTypeHeader
63 IMPORT_C static CSIPContentTypeHeader*
64 NewL(const TDesC8& aMediaType, const TDesC8& aMediaSubtype);
67 * Creates a new instance of CSIPContentTypeHeader
68 * and puts it onto the cleanup stack
69 * @param aMediaType a media type to set. For example "application"
70 * @param aMediaSubtype a media subtype to set. For example "sdp"
71 * @return a new instance of CSIPContentTypeHeader
73 IMPORT_C static CSIPContentTypeHeader*
74 NewLC(const TDesC8& aMediaType, const TDesC8& aMediaSubtype);
77 * Destructor, deletes the resources of CSIPContentTypeHeader.
79 IMPORT_C ~CSIPContentTypeHeader();
81 public: // New functions
84 * Gets the media type from the "Content-Type" header
85 * @return a media type
87 IMPORT_C const TDesC8& MediaType() const;
90 * Sets the media type in the "Content-Type" header
91 * @param aMediaType a media type
93 IMPORT_C void SetMediaTypeL(const TDesC8& aMediaType);
96 * Gets the media subtype from the "Content-Type" header
97 * @return a media subtype
99 IMPORT_C const TDesC8& MediaSubtype() const;
102 * Sets the media subtype in the "Content-Type" header
103 * @param aMediaSubtype a media subtype
105 IMPORT_C void SetMediaSubtypeL(const TDesC8& aMediaSubtype);
108 * Constructs an instance of a CSIPContentTypeHeader 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 CSIPContentTypeHeader
114 IMPORT_C static CSIPHeaderBase*
115 InternalizeValueL(RReadStream& aReadStream);
118 public: // From CSIPHeaderBase
121 * From CSIPHeaderBase CloneL
123 IMPORT_C CSIPHeaderBase* CloneL() const;
126 * From CSIPHeaderBase Name
128 IMPORT_C RStringF Name() const;
131 public: // From CSIPHeaderBase, for internal use
136 TBool HasCompactName() const;
141 RStringF CompactName() const;
146 TPreferredPlace PreferredPlaceInMessage() const;
148 public: // New functions, for internal use
150 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
152 private: // From CSIPHeaderBase
154 void ExternalizeValueL(RWriteStream& aWriteStream) const;
156 private: // CSIPParameterHeaderBase
158 HBufC8* ToTextMandatoryPartLC() const;
159 void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
160 const CSIPParamContainerBase& Params() const;
161 CSIPParamContainerBase& Params();
163 private: // Constructors
165 CSIPContentTypeHeader();
167 void ConstructL(const TDesC8& aMediaType, const TDesC8& aMediaSubtype);
168 void ConstructL(const CSIPContentTypeHeader& aContentTypeHeader);
170 private: // New functions
172 void DoInternalizeValueL(RReadStream& aReadStream);
177 HBufC8* iMediaSubtype;
178 CSIPContentTypeHeaderParams* iParams;
180 private: // For testing purposes
182 UNIT_TEST(CSIPContentTypeHeaderTest)
185 #endif // CSIPCONTENTTYPEHEADER_H