epoc32/include/sipheaderbase.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 sipheaderbase.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        : sipheaderbase.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 CSIPHEADERBASE_H
       
    26 #define CSIPHEADERBASE_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include <e32base.h>
       
    30 #include <s32mem.h>
       
    31 #include <stringpool.h>
       
    32 #include "_sipcodecdefs.h"
       
    33 
       
    34 // CLASS DECLARATION
       
    35 /**
       
    36 * @publishedAll
       
    37 * @released
       
    38 *
       
    39 * Class provides a generic interface for all the SIP headers.
       
    40 *
       
    41 *  @lib sipcodec.lib
       
    42 */
       
    43 class CSIPHeaderBase : public CBase
       
    44 	{
       
    45 	public: // Constructors and destructors
       
    46 
       
    47 		/**
       
    48 		* Destructor, deletes the resources of CSIPHeaderBase.
       
    49 		*/
       
    50 		IMPORT_C virtual ~CSIPHeaderBase();
       
    51 
       
    52 	
       
    53 	public: // New functions
       
    54 	
       
    55 		/**
       
    56 		* Creates a deep-copy of this CSIPHeaderBase object. 
       
    57 		* The function has to be implemented in each of the sub-classes.
       
    58 		* @return the deep-copied object, the ownership is transferred.
       
    59 		*/
       
    60 		IMPORT_C virtual CSIPHeaderBase* CloneL() const = 0;
       
    61 
       
    62 		/**
       
    63 		* Gets the full name of the header
       
    64 		* The function is implemented in each of the sub-classes.
       
    65 		* @return the full name of the header for example "From"
       
    66 		*/
       
    67 		IMPORT_C virtual RStringF Name() const = 0;
       
    68 
       
    69 		/**
       
    70 		* Encodes the header (name and value) into its textual representation.
       
    71 		* @return a textual representation of the complete header,
       
    72 		*         the ownership is transferred
       
    73 		*/
       
    74 		IMPORT_C HBufC8* ToTextL() const;
       
    75 
       
    76 		/**
       
    77 		* Encodes the header (name and value) into its textual representation
       
    78 		* and pushes it to the CleanupStack.
       
    79 		* @return a textual representation of the complete header,
       
    80 		*         the ownership is transferred
       
    81 		*/
       
    82 		IMPORT_C HBufC8* ToTextLC() const;
       
    83 
       
    84 		/**
       
    85 		* Encodes the header's value into its textual representation.
       
    86 		* @return a textual representation of the header's value,
       
    87 		*         the ownership is transferred
       
    88 		*/
       
    89 		IMPORT_C virtual HBufC8* ToTextValueL() const = 0;
       
    90 
       
    91 		/**
       
    92 		* Encodes the header's value into its textual representation
       
    93 		* and pushes it to the CleanupStack.
       
    94 		* @return a textual representation of the header's value,
       
    95 		*         the ownership is transferred
       
    96 		*/
       
    97 		IMPORT_C HBufC8* ToTextValueLC() const;
       
    98 
       
    99 		/**
       
   100 		* Writes the object to a RWriteStream
       
   101 		* @param aWriteStream a stream where the object is to be externalized
       
   102 		* @param aAddName if ETrue the name of the header is 
       
   103 		*        also written to the stream
       
   104 		*/
       
   105 		IMPORT_C void ExternalizeL(RWriteStream& aWriteStream,
       
   106                                    TBool aAddName=ETrue) const;
       
   107 
       
   108 		/**
       
   109 		* Checks, if the header supports serialization.
       
   110 		* In practice all the headers part of the API support it.
       
   111 		* @return ETrue, if the header supports serialization, 
       
   112 		*         otherwise EFalse
       
   113 		*/
       
   114 		IMPORT_C virtual TBool ExternalizeSupported() const;
       
   115 
       
   116 		/**
       
   117 		* Can be used when a RPointerArray<CSIPHeaderBase> needs to be pushed
       
   118 		* to the CleanupStack for ResetAndDestroy.
       
   119 		* @param aArray an array of CSIPHeaderBase pointers, 
       
   120 		*        the ownership of the array is transferred
       
   121 		*/
       
   122 		IMPORT_C static void PushLC(RPointerArray<CSIPHeaderBase>* aArray);
       
   123 
       
   124 
       
   125 	public: // For internal use
       
   126 
       
   127         /**
       
   128         * @internalComponent
       
   129         */
       
   130 		enum TPreferredPlace
       
   131 			{
       
   132 			ETop,
       
   133 			EMiddleTop,
       
   134 			EMiddle,
       
   135 			EMiddleBottom,
       
   136 			EBottom
       
   137 			};
       
   138 
       
   139         /**
       
   140         * @internalComponent
       
   141         */	
       
   142 		TSglQueLink iLink;
       
   143 
       
   144         /**
       
   145         * @internalComponent
       
   146         */
       
   147 		virtual TBool EncodeMultipleToOneLine() const;
       
   148 		
       
   149         /**
       
   150         * @internalComponent
       
   151         */		
       
   152 		virtual TBool MoreThanOneAllowed() const;
       
   153 		
       
   154         /**
       
   155         * @internalComponent
       
   156         */		
       
   157 		virtual TBool IsExtensionHeader() const;
       
   158 		
       
   159         /**
       
   160         * @internalComponent
       
   161         */		
       
   162 		virtual TBool HasCompactName() const;
       
   163 		
       
   164         /**
       
   165         * @internalComponent
       
   166         */		
       
   167 		virtual RStringF CompactName() const;
       
   168 		
       
   169         /**
       
   170         * @internalComponent
       
   171         */		
       
   172 		virtual TPreferredPlace PreferredPlaceInMessage() const = 0;
       
   173 
       
   174 	protected: // Constructors
       
   175 
       
   176 		CSIPHeaderBase();
       
   177 
       
   178 	protected: // New functions
       
   179 
       
   180 		void ExternalizeNameL(RWriteStream& aWriteStream) const;
       
   181 		
       
   182         /**
       
   183         * @internalComponent
       
   184         */		
       
   185 		virtual void ExternalizeValueL(RWriteStream& aWriteStream) const;
       
   186 		
       
   187 		// Needed for cleanup of a RPointerArray<CSIPHeaderBase>:
       
   188 		static void ResetAndDestroy(TAny* anArray);
       
   189 	};
       
   190 
       
   191 #endif // CSIPHEADERBASE_H
       
   192 
       
   193 // End of File