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