1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/sdptypedtime.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,143 @@
1.4 +/*
1.5 +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* 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
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* Name : SdpTypedTime.h
1.19 +* Part of : SDP Codec
1.20 +* Interface : SDK API, SDP Codec API
1.21 +* Version : 1.0
1.22 +*
1.23 +*/
1.24 +
1.25 +
1.26 +
1.27 +#ifndef TSDPTYPEDTIME_H
1.28 +#define TSDPTYPEDTIME_H
1.29 +
1.30 +// INCLUDES
1.31 +#include <e32std.h>
1.32 +#include "_sdpdefs.h"
1.33 +
1.34 +// FORWARD DECLARATIONS
1.35 +class RReadStream;
1.36 +class RWriteStream;
1.37 +
1.38 +// CLASS DECLARATION
1.39 +/**
1.40 + * @publishedAll
1.41 + * @released
1.42 + *
1.43 + * This class implements the typed time element of the Session
1.44 + * Description Protocol.
1.45 + *
1.46 + * The normative reference for correct formatting and values is
1.47 + * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in
1.48 + * member documentation. The implementation supports this normative
1.49 + * reference, but does not enforce it fully.
1.50 + *
1.51 + * @lib sdpcodec.lib
1.52 + */
1.53 +class TSdpTypedTime
1.54 + {
1.55 + public: // enums
1.56 +
1.57 + /** Time units. */
1.58 + enum TUnit
1.59 + {
1.60 + ETimeUnitDays, /** d */
1.61 + ETimeUnitHours, /** h */
1.62 + ETimeUnitMinutes, /** m */
1.63 + ETimeUnitSeconds, /** s */
1.64 + ETimeUnitNone,
1.65 + };
1.66 +
1.67 + public: // Constructors and destructor
1.68 + /**
1.69 + * Constructs a typed time equal to zero and with no time unit set.
1.70 + */
1.71 + IMPORT_C TSdpTypedTime();
1.72 +
1.73 + /**
1.74 + * Constructs a typed time equal to specified value and time unit.
1.75 + *
1.76 + * @param aValue Time value.
1.77 + * @param aUnit Time unit.
1.78 + */
1.79 + IMPORT_C TSdpTypedTime(TInt64 aValue, TUnit aUnit);
1.80 +
1.81 + public: // New functions
1.82 + /**
1.83 + * Compares this instance to another for equality.
1.84 + *
1.85 + * @param aObj Another instance to compare with.
1.86 + * @return ETrue if equal, EFalse if not.
1.87 + */
1.88 + IMPORT_C TBool operator == (const TSdpTypedTime& aObj) const;
1.89 +
1.90 + /**
1.91 + * Sets the typed time value.
1.92 + *
1.93 + * @param aValue Time value.
1.94 + * @param aUnit Time unit.
1.95 + */
1.96 + IMPORT_C void SetValue(TInt64 aValue, TUnit aUnit);
1.97 +
1.98 + public:
1.99 +
1.100 + /**
1.101 + * Externalizes the object to stream
1.102 + *
1.103 + * @param aStream Stream where the object's state will be stored
1.104 + */
1.105 + void ExternalizeL(RWriteStream& aStream) const;
1.106 +
1.107 + /**
1.108 + * Creates object from the stream data
1.109 + *
1.110 + * @param aStream Stream where the object's state will be read
1.111 + * @return Initialized object
1.112 + */
1.113 + static TSdpTypedTime InternalizeL(RReadStream& aStream);
1.114 +
1.115 + /**
1.116 + * Output the field formatted according to SDP syntax and including
1.117 + * the terminating CRLF.
1.118 + *
1.119 + * @param aStream Stream used for output.
1.120 + */
1.121 + void EncodeL(RWriteStream& aStream) const;
1.122 +
1.123 + /**
1.124 + * Construct a new origin field.
1.125 + *
1.126 + * @param aText A string containing a correctly formatted field value
1.127 + * terminated by a CRLF.
1.128 + * @return The new instance.
1.129 + */
1.130 + static TSdpTypedTime DecodeL(const TDesC8& aText);
1.131 +
1.132 + public: // Data
1.133 +
1.134 + /**
1.135 + * @internalComponent
1.136 + */
1.137 + TInt64 iValue;
1.138 +
1.139 + /**
1.140 + * @internalComponent
1.141 + */
1.142 + TInt iUnit;
1.143 +
1.144 + };
1.145 +
1.146 +#endif // TSDPTYPEDTIME_H