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 : sipeventheader.h
17 * Interface : SDK API, SIP Codec API
25 #ifndef CSIPEVENTHEADER_H
26 #define CSIPEVENTHEADER_H
31 #include "sipparameterheaderbase.h"
33 // FORWARD DECLARATIONS
34 class CSIPEventHeaderParams;
41 * Class provides functions for setting and getting parameters in
46 class CSIPEventHeader : public CSIPParameterHeaderBase
48 public: // Constructors and destructor
51 * Constructs a CSIPEventHeader from textual representation
52 * of the header's value part.
53 * @param aValue a value part of a "Event"-header
54 * @return a new instance of CSIPEventHeader
56 IMPORT_C static CSIPEventHeader* DecodeL(const TDesC8& aValue);
59 * Creates a new instance of CSIPEventHeader
60 * @param aEventPackage a Event-Package value
61 * @return a new instance of CSIPEventHeader
63 IMPORT_C static CSIPEventHeader* NewL(const TDesC8& aEventPackage);
66 * Creates a new instance of CSIPEventHeader and puts it to CleanupStack
67 * @param aEventPackage a Event-Package value
68 * @return a new instance of CSIPEventHeader
71 IMPORT_C static CSIPEventHeader* NewLC(const TDesC8& aEventPackage);
74 * Destructor, deletes the resources of CSIPEventHeader.
76 IMPORT_C ~CSIPEventHeader();
79 public: // New functions
82 * Compares this instance to another CSIPEventHeader instance
83 * @param aHeader a header to compare to
84 * @return ETrue if the objects are equal otherwise EFalse
86 IMPORT_C TBool operator==(const CSIPEventHeader& aHeader) const;
89 * Gets the Event-Package parameter from the "Event" header
90 * @return the Event-Package parameter
92 IMPORT_C const TDesC8& EventPackage() const;
95 * Sets the Event-Package parameter in the "Event" header;
96 * @param aEventPackage a Event-Package parameter to set
98 IMPORT_C void SetEventPackageL(const TDesC8& aEventPackage);
101 * Sets the event templates overwriting all the existing ones.
102 * @param aEventTemplates an array of event templates
104 IMPORT_C void SetEventTemplatesL(const MDesC8Array& aEventTemplates);
107 * Gets the event templates.
108 * @return a reference to the currently set event templates.
110 IMPORT_C const MDesC8Array& EventTemplates() const;
113 * Constructs an instance of a CSIPEventHeader from a RReadStream
114 * @param aReadStream a stream containing the value of the
115 * externalized object (header name not included).
116 * @return an instance of a CSIPEventHeader
118 IMPORT_C static CSIPHeaderBase*
119 InternalizeValueL(RReadStream& aReadStream);
122 public: // From CSIPHeaderBase
125 * From CSIPHeaderBase CloneL
127 IMPORT_C CSIPHeaderBase* CloneL() const;
130 * From CSIPHeaderBase Name
132 IMPORT_C RStringF Name() const;
135 public: // From CSIPHeaderBase, for internal use
140 TBool HasCompactName() const;
145 RStringF CompactName() const;
150 TPreferredPlace PreferredPlaceInMessage() const;
152 public: // New functions, for internal use
154 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
156 private: // From CSIPHeaderBase
158 void ExternalizeValueL(RWriteStream& aWriteStream) const;
160 private: // From CSIPParameterHeaderBase
162 HBufC8* ToTextMandatoryPartLC() const;
163 void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
164 const CSIPParamContainerBase& Params() const;
165 CSIPParamContainerBase& Params();
167 private: // Constructors
171 void ConstructL(const TDesC8& aEventPackage);
172 void ConstructL(const CSIPEventHeader& aSIPEventHeader);
174 private: // New functions
176 void DoInternalizeValueL(RReadStream& aReadStream);
177 void CheckTemplateL(const TDesC8& aParam) const;
178 // Needed for cleanup of a RPointerArray<HBufC8>:
179 static void ResetAndDestroy(TAny* anArray);
183 HBufC8* iEventPackage;
184 CSIPEventHeaderParams* iParams;
185 CDesC8ArraySeg* iEventTemplates;
187 private: // For testing purposes
189 friend class CSIPEventHeaderTest;
193 #endif // CSIPEVENTHEADER_H