epoc32/include/mw/siptimestampheader.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
equal deleted inserted replaced
2:2fe1408b6811 3:e1b950c65cb4
       
     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          : siptimestampheader.h
       
    16 * Part of       : SIP Codec
       
    17 * Version       : SIP/4.0 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 #ifndef CSIPTIMESTAMPHEADER_H
       
    25 #define CSIPTIMESTAMPHEADER_H
       
    26 
       
    27 //  INCLUDES
       
    28 #include "sipheaderbase.h"
       
    29 #include "_sipcodecdefs.h"
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33 * @publishedAll
       
    34 * @released
       
    35 *
       
    36 * Class for a SIP Timestamp header.
       
    37 *
       
    38 * @lib sipcodec.lib
       
    39 */
       
    40 class CSIPTimestampHeader : public CSIPHeaderBase
       
    41 	{
       
    42 	public:	// Constructors and destructor
       
    43 
       
    44 		/**
       
    45 		* Constructs a CSIPTimestampHeader from textual representation 
       
    46 		* of the header's value part.
       
    47 		* @param aValue a value part of a "Timestamp"-header (e.g. "12 3.4")
       
    48 		* @returns a new instance of CSIPTimestampHeader
       
    49 		*/
       
    50 		IMPORT_C static CSIPTimestampHeader* DecodeL(const TDesC8& aValue);
       
    51 
       
    52         /**
       
    53 		* Constructor
       
    54         * @param aTimestamp a timestamp value to set.
       
    55         * @param aDealy a delay value to set.
       
    56 		*/
       
    57 		IMPORT_C CSIPTimestampHeader(TReal aTimestamp);
       
    58 
       
    59         /**
       
    60 		* Destructor
       
    61 		*/
       
    62 		IMPORT_C ~CSIPTimestampHeader ();
       
    63 
       
    64 
       
    65 	public: // New functions
       
    66 
       
    67         /**
       
    68         * Set the timestamp from the "Timestamp" header.
       
    69         * @param aTimestamp a timestamp to set.
       
    70         */
       
    71         IMPORT_C void SetTimestamp(TReal aTimestamp);
       
    72 
       
    73         /**
       
    74         * Gets the timestamp from the "Timestamp" header.
       
    75         * @return a timestamp value.
       
    76         */
       
    77         IMPORT_C TReal Timestamp() const;
       
    78 
       
    79         /**
       
    80         * Check if the delay-part is present
       
    81         * @return a delay value.
       
    82         */
       
    83         IMPORT_C TBool HasDelay() const;
       
    84 
       
    85         /**
       
    86         * Set the delay-part of the "Timestamp" header.
       
    87         * @param aDelay a delay to set.
       
    88         */
       
    89         IMPORT_C void SetDelay(TReal aDelay);
       
    90 
       
    91         /**
       
    92         * Gets the delay-part of the "Timestamp" header, 
       
    93         * if delay-part is present
       
    94         * @return a delay value or zero if HasDelay() == EFalse
       
    95         */
       
    96         IMPORT_C TReal Delay() const;
       
    97 
       
    98 		/**
       
    99 		* Constructs an instance of a CSIPTimestampHeader from a RReadStream
       
   100 		* @param aReadStream a stream containing the value of the
       
   101 		*	     externalized object (header name not included). 
       
   102 		* @return an instance of a CSIPTimestampHeader
       
   103 		*/
       
   104 		IMPORT_C static CSIPHeaderBase* 
       
   105 			InternalizeValueL(RReadStream& aReadStream);
       
   106 
       
   107 	public: // From CSIPHeaderBase
       
   108 
       
   109 		/**
       
   110 		* From CSIPHeaderBase CloneL
       
   111 		*/
       
   112 		IMPORT_C CSIPHeaderBase* CloneL() const;
       
   113 		
       
   114 		/**
       
   115 		* From CSIPHeaderBase Name
       
   116 		*/		
       
   117 		IMPORT_C RStringF Name() const;
       
   118 
       
   119 		/**
       
   120 		* From CSIPHeaderBase ToTextValueL
       
   121 		*/
       
   122 		IMPORT_C HBufC8* ToTextValueL() const;
       
   123 
       
   124 
       
   125 	public: // From CSIPHeaderBase, for internal use
       
   126 
       
   127         /**
       
   128         * @internalComponent
       
   129         */	
       
   130 		TPreferredPlace PreferredPlaceInMessage() const;
       
   131 
       
   132 	public: // New functions, for internal use
       
   133 
       
   134 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
       
   135 
       
   136 	private: // From CSIPHeaderBase
       
   137 
       
   138 		void ExternalizeValueL (RWriteStream& aWriteStream) const;
       
   139 
       
   140 	private: // New functions
       
   141 
       
   142 		void ParseL(const TDesC8& aValue);
       
   143         void DoInternalizeValueL(RReadStream& aReadStream);
       
   144 
       
   145 	private: // Data
       
   146 
       
   147 		TReal iTimestamp;
       
   148         TBool iHasDelay;
       
   149         TReal iDelay;
       
   150 
       
   151 	private: // For testing purposes
       
   152 	
       
   153 		UNIT_TEST(CSIPTimestampHeaderTest)
       
   154 	};
       
   155 
       
   156 
       
   157 #endif // end of CSIPTIMESTAMPHEADER_H
       
   158 
       
   159 // End of File