2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Name : siptimestampheader.h
24 #ifndef CSIPTIMESTAMPHEADER_H
25 #define CSIPTIMESTAMPHEADER_H
28 #include "sipheaderbase.h"
35 * Class for a SIP Timestamp header.
39 class CSIPTimestampHeader : public CSIPHeaderBase
41 public: // Constructors and destructor
44 * Constructs a CSIPTimestampHeader from textual representation
45 * of the header's value part.
46 * @param aValue a value part of a "Timestamp"-header (e.g. "12 3.4")
47 * @returns a new instance of CSIPTimestampHeader
49 IMPORT_C static CSIPTimestampHeader* DecodeL(const TDesC8& aValue);
53 * @param aTimestamp a timestamp value to set.
54 * @param aDealy a delay value to set.
56 IMPORT_C CSIPTimestampHeader(TReal aTimestamp);
61 IMPORT_C ~CSIPTimestampHeader ();
64 public: // New functions
67 * Set the timestamp from the "Timestamp" header.
68 * @param aTimestamp a timestamp to set.
70 IMPORT_C void SetTimestamp(TReal aTimestamp);
73 * Gets the timestamp from the "Timestamp" header.
74 * @return a timestamp value.
76 IMPORT_C TReal Timestamp() const;
79 * Check if the delay-part is present
80 * @return a delay value.
82 IMPORT_C TBool HasDelay() const;
85 * Set the delay-part of the "Timestamp" header.
86 * @param aDelay a delay to set.
88 IMPORT_C void SetDelay(TReal aDelay);
91 * Gets the delay-part of the "Timestamp" header,
92 * if delay-part is present
93 * @return a delay value or zero if HasDelay() == EFalse
95 IMPORT_C TReal Delay() const;
98 * Constructs an instance of a CSIPTimestampHeader from a RReadStream
99 * @param aReadStream a stream containing the value of the
100 * externalized object (header name not included).
101 * @return an instance of a CSIPTimestampHeader
103 IMPORT_C static CSIPHeaderBase*
104 InternalizeValueL(RReadStream& aReadStream);
106 public: // From CSIPHeaderBase
109 * From CSIPHeaderBase CloneL
111 IMPORT_C CSIPHeaderBase* CloneL() const;
114 * From CSIPHeaderBase Name
116 IMPORT_C RStringF Name() const;
119 * From CSIPHeaderBase ToTextValueL
121 IMPORT_C HBufC8* ToTextValueL() const;
124 public: // From CSIPHeaderBase, for internal use
129 TPreferredPlace PreferredPlaceInMessage() const;
131 public: // New functions, for internal use
133 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
135 private: // From CSIPHeaderBase
137 void ExternalizeValueL (RWriteStream& aWriteStream) const;
139 private: // New functions
141 void ParseL(const TDesC8& aValue);
142 void DoInternalizeValueL(RReadStream& aReadStream);
150 private: // For testing purposes
152 friend class CSIPTimestampHeaderTest;
157 #endif // end of CSIPTIMESTAMPHEADER_H