epoc32/include/sipcontactheader.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     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        : sipcontactheader.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 CSIPCONTACTHEADER_H
    26 #define CSIPCONTACTHEADER_H
    27 
    28 //  INCLUDES
    29 #include "sipparameterheaderbase.h"
    30 #include "_sipcodecdefs.h"
    31 
    32 // FORWARD DECLARATIONS
    33 class CSIPAddress;
    34 class CSIPContactHeaderParams;
    35 
    36 // CLASS DECLARATION
    37 /**
    38 * @publishedAll
    39 * @released
    40 *
    41 * Class provides functions for setting and getting SIP "Contact"
    42 * header fields.
    43 *
    44 *  @lib sipcodec.lib
    45 */
    46 class CSIPContactHeader : public CSIPParameterHeaderBase
    47 	{
    48 	public: // Constructors and destructor
    49 
    50 		/**
    51 		* Constructs a CSIPContactHeader from textual representation 
    52 		* of the header's value part.
    53 		* Note that "Contact: *" can be only created using this function.
    54 		* @param aValue a value part of a "Contact"-header
    55 		* @return an array containing 1..n instances of CSIPContactHeader
    56 		*/
    57 		IMPORT_C static RPointerArray<CSIPContactHeader> 
    58 			DecodeL(const TDesC8& aValue);
    59 
    60 		/**
    61 		* Creates a new instance of CSIPContactHeader
    62 		* @pre aSIPAddress != 0
    63 		* @param aSIPAddress a name-address, the ownership is transferred 
    64 		* @return a new instance of CSIPContactHeader
    65 		*/
    66 		IMPORT_C static CSIPContactHeader* NewL(CSIPAddress* aSIPAddress);
    67 
    68 		/**
    69 		* Creates a new instance of CSIPContactHeader and puts it to CleanupStack
    70 		* @pre aSIPAddress != 0
    71 		* @param aSIPAddress a name-address, the ownership is transferred 
    72 		* @return a new instance of CSIPContactHeader
    73 		*/
    74 		IMPORT_C static CSIPContactHeader* NewLC(CSIPAddress* aSIPAddress);
    75 
    76 		/**
    77 		* Destructor, deletes the resources of CSIPContactHeader.
    78 		*/
    79 		IMPORT_C ~CSIPContactHeader();
    80 
    81 	
    82 	public: // New functions
    83 
    84 		/**
    85 		* Compares this object to another instance of CSIPContactHeader
    86 		* @param aHeader a CSIPContactHeader header to compare to
    87 		* @return ETrue if the objects are equal otherwise EFalse
    88 		*/
    89 		IMPORT_C TBool operator==(const CSIPContactHeader& aHeader) const;
    90 
    91 		/**
    92 		* Checks if the address is set to a STAR ("*")
    93 		* @return ETrue, if the address is a "*" otherwise EFalse
    94 		*/
    95 		IMPORT_C TBool Star() const;
    96 
    97 		/**
    98 		* Gets the value of the "expires"-parameter
    99 		* @return the "expires"-parameter, or 
   100 		*         KErrNotFound if the parameter is not present.
   101 		*/
   102 		IMPORT_C TInt ExpiresParameter() const;
   103 
   104 		/**
   105 		* Sets the "expires"-parameter
   106 		* @pre aExpiresParam >= 0
   107 		* @param aExpiresParam a "expires"-parameter value to set
   108 		*/
   109 		IMPORT_C void SetExpiresParameterL(TInt aExpiresParam);
   110 
   111 		/**
   112 		* Gets the value of "q"-parameter
   113 		* @pre Star() == EFalse
   114 		* @return the "q"-parameter value, 
   115 		*         or zero if the parameter is not present.
   116 		*/
   117 		IMPORT_C TReal QParameter() const;
   118 
   119 		/**
   120 		* Sets the "q"-parameter value in the "Contact" header
   121 		* @pre Star() == EFalse
   122 		* @param aQValue a "q"-parameter value to set
   123 		*/
   124 		IMPORT_C void SetQParameterL(TReal aQValue);
   125 
   126 		/**
   127 		* Gets the name-address as const
   128 		* @return name-address or 0 if not present
   129 		*         The ownership is NOT transferred.
   130 		*/
   131 		IMPORT_C const CSIPAddress* SIPAddress() const;
   132 
   133 		/**
   134 		* Gets the name-address
   135 		* @return name-address or 0 if not present
   136 		*         The ownership is NOT transferred.
   137 		*/
   138 		IMPORT_C CSIPAddress* SIPAddress();
   139 
   140 		/**
   141 		* Sets the name-address
   142 		* @pre Star() == EFalse
   143 		* @pre aSIPAddress != 0
   144 		* @param aSIPAddress a name-address to set, the ownership is transferred
   145 		*/
   146 		IMPORT_C void SetSIPAddressL(CSIPAddress* aSIPAddress);
   147 
   148 		/**
   149 		* Constructs an instance of a CSIPContactHeader from a RReadStream
   150 		* @param aReadStream a stream containing the value of the
   151 		*        externalized object (header name not included). 
   152 		* @return an instance of a CSIPContactHeader
   153 		*/
   154 		IMPORT_C static CSIPHeaderBase* 
   155 			InternalizeValueL(RReadStream& aReadStream);
   156 
   157 
   158 	public: // From CSIPHeaderBase
   159 		
   160 		/**
   161 		* From CSIPHeaderBase CloneL
   162 		*/
   163 		IMPORT_C CSIPHeaderBase* CloneL() const;
   164 
   165 		/**
   166 		* From CSIPHeaderBase Name
   167 		*/
   168 		IMPORT_C RStringF Name() const;
   169 
   170 
   171 	public: // From CSIPHeaderBase, for internal use
   172 
   173         /**
   174         * @internalComponent
   175         */
   176 		TBool MoreThanOneAllowed() const;
   177 		
   178         /**
   179         * @internalComponent
   180         */		
   181 		TBool HasCompactName() const;
   182 		
   183         /**
   184         * @internalComponent
   185         */		
   186 		RStringF CompactName() const;
   187 		
   188         /**
   189         * @internalComponent
   190         */		
   191 		TPreferredPlace PreferredPlaceInMessage() const;
   192 
   193 	public: // New functions, for internal use
   194 
   195 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
   196 
   197 	private: // From CSIPHeaderBase
   198 
   199 		void ExternalizeValueL(RWriteStream& aWriteStream) const;
   200 
   201 	private: // From CSIPParameterHeaderBase
   202 
   203 		TBool ParamInsertionAllowed() const;
   204 		HBufC8* ToTextMandatoryPartLC() const;
   205 		void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
   206 		const CSIPParamContainerBase& Params() const;
   207 		CSIPParamContainerBase& Params();
   208 
   209 	private: // Constructors
   210 
   211 		CSIPContactHeader(TBool aIsStar=EFalse);
   212 		void ConstructL();
   213 		void ConstructL(CSIPAddress* aSIPAddress);
   214 		void ConstructL(const CSIPContactHeader& aContactHeader);
   215 
   216 	private: // New functions 
   217 
   218 		void DoInternalizeValueL(RReadStream& aReadStream);
   219 
   220 	private: // Data
   221 
   222 		CSIPAddress* iSIPAddress;
   223 		CSIPContactHeaderParams* iParams;
   224 		TBool iIsStar;
   225 
   226 	private: // For testing purposes
   227 	
   228 		UNIT_TEST(CSIPContactHeaderTest)
   229 	};
   230 
   231 #endif // CSIPCONTACTHEADER_H
   232 
   233 // End of File