1 sipcontenttypeheader.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 : 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 #include "_sipcodecdefs.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CSIPContentTypeHeaderParams; |
|
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 "Content-Type" header. |
|
42 * |
|
43 * @lib sipcodec.lib |
|
44 */ |
|
45 class CSIPContentTypeHeader : public CSIPParameterHeaderBase |
|
46 { |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
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 |
|
54 */ |
|
55 IMPORT_C static CSIPContentTypeHeader* DecodeL(const TDesC8& aValue); |
|
56 |
|
57 /** |
|
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 |
|
62 */ |
|
63 IMPORT_C static CSIPContentTypeHeader* |
|
64 NewL(const TDesC8& aMediaType, const TDesC8& aMediaSubtype); |
|
65 |
|
66 /** |
|
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 |
|
72 */ |
|
73 IMPORT_C static CSIPContentTypeHeader* |
|
74 NewLC(const TDesC8& aMediaType, const TDesC8& aMediaSubtype); |
|
75 |
|
76 /** |
|
77 * Destructor, deletes the resources of CSIPContentTypeHeader. |
|
78 */ |
|
79 IMPORT_C ~CSIPContentTypeHeader(); |
|
80 |
|
81 public: // New functions |
|
82 |
|
83 /** |
|
84 * Gets the media type from the "Content-Type" header |
|
85 * @return a media type |
|
86 */ |
|
87 IMPORT_C const TDesC8& MediaType() const; |
|
88 |
|
89 /** |
|
90 * Sets the media type in the "Content-Type" header |
|
91 * @param aMediaType a media type |
|
92 */ |
|
93 IMPORT_C void SetMediaTypeL(const TDesC8& aMediaType); |
|
94 |
|
95 /** |
|
96 * Gets the media subtype from the "Content-Type" header |
|
97 * @return a media subtype |
|
98 */ |
|
99 IMPORT_C const TDesC8& MediaSubtype() const; |
|
100 |
|
101 /** |
|
102 * Sets the media subtype in the "Content-Type" header |
|
103 * @param aMediaSubtype a media subtype |
|
104 */ |
|
105 IMPORT_C void SetMediaSubtypeL(const TDesC8& aMediaSubtype); |
|
106 |
|
107 /** |
|
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 |
|
112 */ |
|
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 HasCompactName() const; |
|
137 |
|
138 /** |
|
139 * @internalComponent |
|
140 */ |
|
141 RStringF CompactName() const; |
|
142 |
|
143 /** |
|
144 * @internalComponent |
|
145 */ |
|
146 TPreferredPlace PreferredPlaceInMessage() const; |
|
147 |
|
148 public: // New functions, for internal use |
|
149 |
|
150 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue); |
|
151 |
|
152 private: // From CSIPHeaderBase |
|
153 |
|
154 void ExternalizeValueL(RWriteStream& aWriteStream) const; |
|
155 |
|
156 private: // CSIPParameterHeaderBase |
|
157 |
|
158 HBufC8* ToTextMandatoryPartLC() const; |
|
159 void ParseMandatoryPartL(const TDesC8& aMandatoryPart); |
|
160 const CSIPParamContainerBase& Params() const; |
|
161 CSIPParamContainerBase& Params(); |
|
162 |
|
163 private: // Constructors |
|
164 |
|
165 CSIPContentTypeHeader(); |
|
166 void ConstructL(); |
|
167 void ConstructL(const TDesC8& aMediaType, const TDesC8& aMediaSubtype); |
|
168 void ConstructL(const CSIPContentTypeHeader& aContentTypeHeader); |
|
169 |
|
170 private: // New functions |
|
171 |
|
172 void DoInternalizeValueL(RReadStream& aReadStream); |
|
173 |
|
174 private: // Data |
|
175 |
|
176 HBufC8* iMediaType; |
|
177 HBufC8* iMediaSubtype; |
|
178 CSIPContentTypeHeaderParams* iParams; |
|
179 |
|
180 private: // For testing purposes |
|
181 |
|
182 UNIT_TEST(CSIPContentTypeHeaderTest) |
|
183 }; |
|
184 |
|
185 #endif // CSIPCONTENTTYPEHEADER_H |
|
186 |
|
187 // End of File |