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