epoc32/include/mw/sipeventheader.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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        : 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 
    33 // FORWARD DECLARATIONS
    34 class CSIPEventHeaderParams;
    35 
    36 // CLASS DECLARATION
    37 /**
    38 * @publishedAll
    39 * @released
    40 *
    41 * Class provides functions for setting and getting parameters in 
    42 * SIP "Event" header.
    43 *
    44 *  @lib sipcodec.lib
    45 */
    46 class CSIPEventHeader : public CSIPParameterHeaderBase
    47 	{
    48 	public:	// Constructors and destructor
    49 	
    50 		/**
    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
    55 		*/
    56 		IMPORT_C static CSIPEventHeader* DecodeL(const TDesC8& aValue);
    57 
    58 		/**
    59 		* Creates a new instance of CSIPEventHeader
    60 		* @param aEventPackage a Event-Package value
    61 		* @return a new instance of CSIPEventHeader
    62 		*/
    63 		IMPORT_C static CSIPEventHeader* NewL(const TDesC8& aEventPackage);
    64 
    65 		/**
    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
    69 		*/
    70 
    71 		IMPORT_C static CSIPEventHeader* NewLC(const TDesC8& aEventPackage);
    72 
    73 		/**
    74 		* Destructor, deletes the resources of CSIPEventHeader.
    75 		*/
    76 		IMPORT_C ~CSIPEventHeader();
    77 
    78 
    79 	public:	// New functions
    80 
    81 		/**
    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
    85 		*/
    86 		IMPORT_C TBool operator==(const CSIPEventHeader& aHeader) const;
    87 
    88 		/**
    89 		* Gets the Event-Package parameter from the "Event" header
    90 		* @return the Event-Package parameter
    91 		*/
    92 		IMPORT_C const TDesC8& EventPackage() const;
    93 
    94 		/**
    95 		* Sets the Event-Package parameter in the "Event" header; 
    96 		* @param aEventPackage a Event-Package parameter to set
    97 		*/
    98 		IMPORT_C void SetEventPackageL(const TDesC8& aEventPackage);
    99 
   100 		/**
   101 		* Sets the event templates overwriting all the existing ones.
   102 		* @param aEventTemplates an array of event templates
   103 		*/
   104 		IMPORT_C void SetEventTemplatesL(const MDesC8Array& aEventTemplates);
   105 
   106 		/**
   107 		* Gets the event templates.
   108 		* @return a reference to the currently set event templates.
   109 		*/
   110 		IMPORT_C const MDesC8Array& EventTemplates() const;
   111 	
   112 		/**
   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 
   117 		*/
   118 		IMPORT_C static CSIPHeaderBase* 
   119 			InternalizeValueL(RReadStream& aReadStream);
   120 
   121 
   122 	public: // From CSIPHeaderBase
   123 
   124 		/**
   125 		* From CSIPHeaderBase CloneL
   126 		*/
   127 		IMPORT_C CSIPHeaderBase* CloneL() const;
   128 
   129 		/**
   130 		* From CSIPHeaderBase Name
   131 		*/
   132 		IMPORT_C RStringF Name() const;
   133 
   134 
   135 	public: // From CSIPHeaderBase, for internal use
   136 
   137         /**
   138         * @internalComponent
   139         */
   140 		TBool HasCompactName() const;
   141 		
   142         /**
   143         * @internalComponent
   144         */		
   145 		RStringF CompactName() const;
   146 		
   147         /**
   148         * @internalComponent
   149         */		
   150 		TPreferredPlace PreferredPlaceInMessage() const;
   151 
   152 	public: // New functions, for internal use
   153 
   154 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
   155 
   156 	private: // From CSIPHeaderBase
   157 
   158 		void ExternalizeValueL(RWriteStream& aWriteStream) const;
   159 
   160 	private: // From CSIPParameterHeaderBase
   161 
   162 		HBufC8* ToTextMandatoryPartLC() const;
   163 		void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
   164 		const CSIPParamContainerBase& Params() const;
   165 		CSIPParamContainerBase& Params();
   166 
   167 	private: // Constructors
   168 
   169 		CSIPEventHeader();
   170 		void ConstructL();
   171 		void ConstructL(const TDesC8& aEventPackage);
   172 		void ConstructL(const CSIPEventHeader& aSIPEventHeader);
   173 
   174 	private: // New functions
   175 
   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);
   180 
   181 	private: // Data
   182 
   183 		HBufC8* iEventPackage;
   184 		CSIPEventHeaderParams* iParams;
   185 		CDesC8ArraySeg* iEventTemplates;
   186 
   187 	private: // For testing purposes
   188 #ifdef CPPUNIT_TEST	
   189 		friend class CSIPEventHeaderTest;
   190 #endif
   191 	};
   192 
   193 #endif // CSIPEVENTHEADER_H
   194 
   195 // End of File