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 : sipalloweventsheader.h
17 * Interface : SDK API, SIP Codec API
25 #ifndef CSIPALLOWEVENTSHEADER_H
26 #define CSIPALLOWEVENTSHEADER_H
30 #include "sipheaderbase.h"
31 #include "_sipcodecdefs.h"
38 * Class provides functions for setting and getting parameters in
39 * SIP "Allow-Events" header.
43 class CSIPAllowEventsHeader : public CSIPHeaderBase
45 public: // Constructors and destructor
48 * Constructs a CSIPAllowEventsHeader from textual representation
49 * of the header's value part.
50 * @param aValue a value part of a "Allow-Events"-header
51 * @return An array containing one to many instances of
52 * CSIPAllowEventsHeader
54 IMPORT_C static RPointerArray<CSIPAllowEventsHeader>
55 DecodeL(const TDesC8& aValue);
58 * Creates a new instance of CSIPAllowEventsHeader
59 * @param aEventPackage a Event-Package value
60 * @return a new instance of CSIPAllowEventsHeader
62 IMPORT_C static CSIPAllowEventsHeader*
63 NewL(const TDesC8& aEventPackage);
66 * Creates a new instance of CSIPAllowEventsHeader and
67 * puts it to CleanupStack
68 * @param aEventPackage a Event-Package value
69 * @return a new instance of CSIPAllowEventsHeader
71 IMPORT_C static CSIPAllowEventsHeader* NewLC(const TDesC8& aEventPackage);
74 * Destructor. deletes the resources of CSIPAllowEventsHeader.
76 IMPORT_C ~CSIPAllowEventsHeader();
78 public: // New functions
81 * Gets the Event-Package parameter from the "Allow-Events" header
82 * @return the Event-Package parameter
84 IMPORT_C const TDesC8& EventPackage() const;
87 * Sets the Event-Package parameter in the "Allow-Events" header;
88 * @param aEventPackage a Event-Package parameter to set
90 IMPORT_C void SetEventPackageL(const TDesC8& aEventPackage);
93 * Sets the event templates overwriting all the existing ones.
94 * @param aEventTemplates
96 IMPORT_C void SetEventTemplatesL(const MDesC8Array& aEventTemplates);
99 * Gets the event templates.
100 * @return a reference to the currently set event templates.
103 IMPORT_C const MDesC8Array& EventTemplates() const;
106 * Constructs an instance of a CSIPAllowEventsHeader from a RReadStream
107 * @param aReadStream a stream containing the value of the
108 * externalized object (header name not included).
111 IMPORT_C static CSIPHeaderBase*
112 InternalizeValueL(RReadStream& aReadStream);
115 public: // From CSIPHeaderBase
118 * From CSIPHeaderBase CloneL
120 IMPORT_C CSIPHeaderBase* CloneL() const;
123 * From CSIPHeaderBase Name
125 IMPORT_C RStringF Name() const;
128 * From CSIPHeaderBase ToTextValueL
130 IMPORT_C HBufC8* ToTextValueL() const;
133 public: // New functions, for internal use
135 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
137 public: // From CSIPHeaderBase, for internal use
142 TBool MoreThanOneAllowed() const;
147 TBool HasCompactName() const;
152 RStringF CompactName() const;
157 TPreferredPlace PreferredPlaceInMessage() const;
159 private: // From CSIPHeaderBase
161 void ExternalizeValueL(RWriteStream& aWriteStream) const;
163 private: // Contructors
165 CSIPAllowEventsHeader();
167 void ConstructL(const TDesC8& aEventPackage);
168 void ConstructL (const CSIPAllowEventsHeader& aSIPAllowEventsHeader);
170 private: // New functions
172 void DoInternalizeValueL(RReadStream& aReadStream);
173 void ParseL(const TDesC8& aValue);
174 void CheckTemplateL(const TDesC8& aParam) const;
175 // Needed for cleanup of a RPointerArray<HBufC8>:
176 static void ResetAndDestroy(TAny* anArray);
180 HBufC8* iEventPackage;
181 CDesC8ArraySeg* iEventTemplates;
183 private: // For testing purposes
185 UNIT_TEST(CSIPAllowEventsHeaderTest)
188 #endif // CSIPALLOWEVENTSHEADER_H