epoc32/include/mw/sipalloweventsheader.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/sipalloweventsheader.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     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        : sipalloweventsheader.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 CSIPALLOWEVENTSHEADER_H
    26 #define CSIPALLOWEVENTSHEADER_H
    27 
    28 //  INCLUDES
    29 #include <badesca.h>
    30 #include "sipheaderbase.h"
    31 #include "_sipcodecdefs.h"
    32 
    33 // CLASS DECLARATION
    34 /**
    35 * @publishedAll
    36 * @released
    37 *
    38 * Class provides functions for setting and getting parameters in 
    39 * SIP "Allow-Events" header.
    40 *
    41 *  @lib sipcodec.lib
    42 */
    43 class CSIPAllowEventsHeader : public CSIPHeaderBase
    44 	{
    45 	public: // Constructors and destructor
    46 	
    47 		/**
    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  
    53 		*/
    54 		IMPORT_C static RPointerArray<CSIPAllowEventsHeader> 
    55 			DecodeL(const TDesC8& aValue);
    56 
    57 		/**
    58 		* Creates a new instance of CSIPAllowEventsHeader
    59 		* @param aEventPackage a Event-Package value
    60 		* @return a new instance of CSIPAllowEventsHeader
    61 		*/
    62 		IMPORT_C static CSIPAllowEventsHeader* 
    63 			NewL(const TDesC8& aEventPackage);
    64 
    65 		/**
    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
    70 		*/
    71 		IMPORT_C static CSIPAllowEventsHeader* NewLC(const TDesC8& aEventPackage);
    72 
    73 		/**
    74 		* Destructor. deletes the resources of CSIPAllowEventsHeader.
    75 		*/
    76 		IMPORT_C ~CSIPAllowEventsHeader();
    77 
    78 	public: // New functions
    79 
    80 		/**
    81 		* Gets the Event-Package parameter from the "Allow-Events" header
    82 		* @return the Event-Package parameter
    83 		*/
    84 		IMPORT_C const TDesC8& EventPackage() const;
    85 
    86 		/**
    87 		* Sets the Event-Package parameter in the "Allow-Events" header; 
    88 		* @param aEventPackage a Event-Package parameter to set
    89 		*/
    90 		IMPORT_C void SetEventPackageL(const TDesC8& aEventPackage);
    91 
    92 		/**
    93 		* Sets the event templates overwriting all the existing ones.
    94 		* @param aEventTemplates
    95 		*/
    96 		IMPORT_C void SetEventTemplatesL(const MDesC8Array& aEventTemplates);
    97 	
    98 		/**
    99 		* Gets the event templates.
   100 		* @return a reference to the currently set event templates.
   101 		*/
   102 
   103 		IMPORT_C const MDesC8Array& EventTemplates() const;
   104 
   105 		/**
   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). 
   109 		*/
   110 
   111 		IMPORT_C static CSIPHeaderBase* 
   112 			InternalizeValueL(RReadStream& aReadStream);
   113 
   114 
   115 	public: // From CSIPHeaderBase
   116 
   117 		/**
   118 		* From CSIPHeaderBase CloneL
   119 		*/
   120 		IMPORT_C CSIPHeaderBase* CloneL() const;
   121 
   122 		/**
   123 		* From CSIPHeaderBase Name
   124 		*/
   125 		IMPORT_C RStringF Name() const;
   126 
   127 		/**
   128 		* From CSIPHeaderBase ToTextValueL
   129 		*/
   130 		IMPORT_C HBufC8* ToTextValueL() const;
   131 
   132 
   133 	public: // New functions, for internal use
   134 
   135 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
   136 
   137 	public: // From CSIPHeaderBase, for internal use 
   138 
   139         /**
   140         * @internalComponent
   141         */	
   142 		TBool MoreThanOneAllowed() const;
   143 		
   144         /**
   145         * @internalComponent
   146         */		
   147 		TBool HasCompactName() const;
   148 		
   149         /**
   150         * @internalComponent
   151         */		
   152 		RStringF CompactName() const;
   153 		
   154         /**
   155         * @internalComponent
   156         */		
   157 		TPreferredPlace PreferredPlaceInMessage() const;
   158 
   159 	private: // From CSIPHeaderBase
   160 
   161 		void ExternalizeValueL(RWriteStream& aWriteStream) const;
   162 
   163 	private: // Contructors
   164 
   165 		CSIPAllowEventsHeader();
   166 		void ConstructL();
   167 		void ConstructL(const TDesC8& aEventPackage);
   168 		void ConstructL (const CSIPAllowEventsHeader& aSIPAllowEventsHeader);
   169 
   170 	private: // New functions
   171 
   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);
   177 
   178 	private: // Data
   179 
   180 		HBufC8* iEventPackage;
   181 		CDesC8ArraySeg* iEventTemplates;
   182 
   183 	private: // For testing purposes
   184 	
   185 		UNIT_TEST(CSIPAllowEventsHeaderTest)
   186 	};
   187 
   188 #endif // CSIPALLOWEVENTSHEADER_H
   189 
   190 // End of File