|
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 : sipalloweventsheader.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 CSIPALLOWEVENTSHEADER_H |
|
26 #define CSIPALLOWEVENTSHEADER_H |
|
27 |
|
28 // INCLUDES |
|
29 #include <badesca.h> |
|
30 #include "sipheaderbase.h" |
|
31 |
|
32 // CLASS DECLARATION |
|
33 /** |
|
34 * @publishedAll |
|
35 * @released |
|
36 * |
|
37 * Class provides functions for setting and getting parameters in |
|
38 * SIP "Allow-Events" header. |
|
39 * |
|
40 * @lib sipcodec.lib |
|
41 */ |
|
42 class CSIPAllowEventsHeader : public CSIPHeaderBase |
|
43 { |
|
44 public: // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * Constructs a CSIPAllowEventsHeader from textual representation |
|
48 * of the header's value part. |
|
49 * @param aValue a value part of a "Allow-Events"-header |
|
50 * @return An array containing one to many instances of |
|
51 * CSIPAllowEventsHeader |
|
52 */ |
|
53 IMPORT_C static RPointerArray<CSIPAllowEventsHeader> |
|
54 DecodeL(const TDesC8& aValue); |
|
55 |
|
56 /** |
|
57 * Creates a new instance of CSIPAllowEventsHeader |
|
58 * @param aEventPackage a Event-Package value |
|
59 * @return a new instance of CSIPAllowEventsHeader |
|
60 */ |
|
61 IMPORT_C static CSIPAllowEventsHeader* |
|
62 NewL(const TDesC8& aEventPackage); |
|
63 |
|
64 /** |
|
65 * Creates a new instance of CSIPAllowEventsHeader and |
|
66 * puts it to CleanupStack |
|
67 * @param aEventPackage a Event-Package value |
|
68 * @return a new instance of CSIPAllowEventsHeader |
|
69 */ |
|
70 IMPORT_C static CSIPAllowEventsHeader* NewLC(const TDesC8& aEventPackage); |
|
71 |
|
72 /** |
|
73 * Destructor. deletes the resources of CSIPAllowEventsHeader. |
|
74 */ |
|
75 IMPORT_C ~CSIPAllowEventsHeader(); |
|
76 |
|
77 public: // New functions |
|
78 |
|
79 /** |
|
80 * Gets the Event-Package parameter from the "Allow-Events" header |
|
81 * @return the Event-Package parameter |
|
82 */ |
|
83 IMPORT_C const TDesC8& EventPackage() const; |
|
84 |
|
85 /** |
|
86 * Sets the Event-Package parameter in the "Allow-Events" header; |
|
87 * @param aEventPackage a Event-Package parameter to set |
|
88 */ |
|
89 IMPORT_C void SetEventPackageL(const TDesC8& aEventPackage); |
|
90 |
|
91 /** |
|
92 * Sets the event templates overwriting all the existing ones. |
|
93 * @param aEventTemplates |
|
94 */ |
|
95 IMPORT_C void SetEventTemplatesL(const MDesC8Array& aEventTemplates); |
|
96 |
|
97 /** |
|
98 * Gets the event templates. |
|
99 * @return a reference to the currently set event templates. |
|
100 */ |
|
101 |
|
102 IMPORT_C const MDesC8Array& EventTemplates() const; |
|
103 |
|
104 /** |
|
105 * Constructs an instance of a CSIPAllowEventsHeader from a RReadStream |
|
106 * @param aReadStream a stream containing the value of the |
|
107 * externalized object (header name not included). |
|
108 */ |
|
109 |
|
110 IMPORT_C static CSIPHeaderBase* |
|
111 InternalizeValueL(RReadStream& aReadStream); |
|
112 |
|
113 |
|
114 public: // From CSIPHeaderBase |
|
115 |
|
116 /** |
|
117 * From CSIPHeaderBase CloneL |
|
118 */ |
|
119 IMPORT_C CSIPHeaderBase* CloneL() const; |
|
120 |
|
121 /** |
|
122 * From CSIPHeaderBase Name |
|
123 */ |
|
124 IMPORT_C RStringF Name() const; |
|
125 |
|
126 /** |
|
127 * From CSIPHeaderBase ToTextValueL |
|
128 */ |
|
129 IMPORT_C HBufC8* ToTextValueL() const; |
|
130 |
|
131 |
|
132 public: // New functions, for internal use |
|
133 |
|
134 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue); |
|
135 |
|
136 public: // From CSIPHeaderBase, for internal use |
|
137 |
|
138 /** |
|
139 * @internalComponent |
|
140 */ |
|
141 TBool MoreThanOneAllowed() const; |
|
142 |
|
143 /** |
|
144 * @internalComponent |
|
145 */ |
|
146 TBool HasCompactName() const; |
|
147 |
|
148 /** |
|
149 * @internalComponent |
|
150 */ |
|
151 RStringF CompactName() const; |
|
152 |
|
153 /** |
|
154 * @internalComponent |
|
155 */ |
|
156 TPreferredPlace PreferredPlaceInMessage() const; |
|
157 |
|
158 private: // From CSIPHeaderBase |
|
159 |
|
160 void ExternalizeValueL(RWriteStream& aWriteStream) const; |
|
161 |
|
162 private: // Contructors |
|
163 |
|
164 CSIPAllowEventsHeader(); |
|
165 void ConstructL(); |
|
166 void ConstructL(const TDesC8& aEventPackage); |
|
167 void ConstructL (const CSIPAllowEventsHeader& aSIPAllowEventsHeader); |
|
168 |
|
169 private: // New functions |
|
170 |
|
171 void DoInternalizeValueL(RReadStream& aReadStream); |
|
172 void ParseL(const TDesC8& aValue); |
|
173 void CheckTemplateL(const TDesC8& aParam) const; |
|
174 // Needed for cleanup of a RPointerArray<HBufC8>: |
|
175 static void ResetAndDestroy(TAny* anArray); |
|
176 |
|
177 private: // Data |
|
178 |
|
179 HBufC8* iEventPackage; |
|
180 CDesC8ArraySeg* iEventTemplates; |
|
181 |
|
182 private: // For testing purposes |
|
183 #ifdef CPPUNIT_TEST |
|
184 friend class CSIPAllowEventsHeaderTest; |
|
185 #endif |
|
186 }; |
|
187 |
|
188 #endif // CSIPALLOWEVENTSHEADER_H |
|
189 |
|
190 // End of File |