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 "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".
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"
37 * Class provides functions for setting and getting parameters in
38 * SIP "Allow-Events" header.
42 class CSIPAllowEventsHeader : public CSIPHeaderBase
44 public: // Constructors and destructor
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
53 IMPORT_C static RPointerArray<CSIPAllowEventsHeader>
54 DecodeL(const TDesC8& aValue);
57 * Creates a new instance of CSIPAllowEventsHeader
58 * @param aEventPackage a Event-Package value
59 * @return a new instance of CSIPAllowEventsHeader
61 IMPORT_C static CSIPAllowEventsHeader*
62 NewL(const TDesC8& aEventPackage);
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
70 IMPORT_C static CSIPAllowEventsHeader* NewLC(const TDesC8& aEventPackage);
73 * Destructor. deletes the resources of CSIPAllowEventsHeader.
75 IMPORT_C ~CSIPAllowEventsHeader();
77 public: // New functions
80 * Gets the Event-Package parameter from the "Allow-Events" header
81 * @return the Event-Package parameter
83 IMPORT_C const TDesC8& EventPackage() const;
86 * Sets the Event-Package parameter in the "Allow-Events" header;
87 * @param aEventPackage a Event-Package parameter to set
89 IMPORT_C void SetEventPackageL(const TDesC8& aEventPackage);
92 * Sets the event templates overwriting all the existing ones.
93 * @param aEventTemplates
95 IMPORT_C void SetEventTemplatesL(const MDesC8Array& aEventTemplates);
98 * Gets the event templates.
99 * @return a reference to the currently set event templates.
102 IMPORT_C const MDesC8Array& EventTemplates() const;
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).
110 IMPORT_C static CSIPHeaderBase*
111 InternalizeValueL(RReadStream& aReadStream);
114 public: // From CSIPHeaderBase
117 * From CSIPHeaderBase CloneL
119 IMPORT_C CSIPHeaderBase* CloneL() const;
122 * From CSIPHeaderBase Name
124 IMPORT_C RStringF Name() const;
127 * From CSIPHeaderBase ToTextValueL
129 IMPORT_C HBufC8* ToTextValueL() const;
132 public: // New functions, for internal use
134 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
136 public: // From CSIPHeaderBase, for internal use
141 TBool MoreThanOneAllowed() const;
146 TBool HasCompactName() const;
151 RStringF CompactName() const;
156 TPreferredPlace PreferredPlaceInMessage() const;
158 private: // From CSIPHeaderBase
160 void ExternalizeValueL(RWriteStream& aWriteStream) const;
162 private: // Contructors
164 CSIPAllowEventsHeader();
166 void ConstructL(const TDesC8& aEventPackage);
167 void ConstructL (const CSIPAllowEventsHeader& aSIPAllowEventsHeader);
169 private: // New functions
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);
179 HBufC8* iEventPackage;
180 CDesC8ArraySeg* iEventTemplates;
182 private: // For testing purposes
184 friend class CSIPAllowEventsHeaderTest;
188 #endif // CSIPALLOWEVENTSHEADER_H