epoc32/include/mw/sdptypedtime.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) 2003-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          : SdpTypedTime.h
    16 * Part of       : SDP Codec
    17 * Interface     : SDK API, SDP Codec API
    18 * Version       : 1.0
    19 *
    20 */
    21 
    22 
    23 
    24 #ifndef TSDPTYPEDTIME_H
    25 #define TSDPTYPEDTIME_H
    26 
    27 //  INCLUDES
    28 #include <e32std.h>
    29 
    30 // FORWARD DECLARATIONS
    31 class RReadStream;
    32 class RWriteStream;
    33 
    34 // CLASS DECLARATION
    35 /**
    36  *  @publishedAll
    37  *  @released
    38  *
    39  *	This class implements the typed time element of the Session
    40  *	Description Protocol.
    41  *
    42  *	The normative reference for correct formatting and values is
    43  *	draft-ietf-mmusic-sdp-new-14 unless specified otherwise in
    44  *  member documentation. The implementation supports this normative
    45  *  reference, but does not enforce it fully. 
    46  *
    47  *  @lib sdpcodec.lib
    48  */
    49 class TSdpTypedTime
    50 	{
    51     public: // enums
    52 
    53         /** Time units. */
    54         enum TUnit
    55             {
    56             ETimeUnitDays,      /** d */
    57             ETimeUnitHours,     /** h */
    58 		    ETimeUnitMinutes,   /** m */
    59 		    ETimeUnitSeconds,   /** s */
    60 		    ETimeUnitNone,
    61             };
    62 
    63     public: // Constructors and destructor
    64 		/**
    65 		 *	Constructs a typed time equal to zero and with no time unit set.
    66 		 */
    67 		IMPORT_C TSdpTypedTime();
    68 
    69 		/**
    70 		 *	Constructs a typed time equal to specified value and time unit.
    71 		 *
    72 		 *	@param aValue Time value.
    73 		 *	@param aUnit Time unit.
    74 		 */
    75 		IMPORT_C TSdpTypedTime(TInt64 aValue, TUnit aUnit);
    76 
    77     public: // New functions
    78 		/**	
    79 		 *	Compares this instance to another for equality.
    80 		 *
    81 		 *	@param aObj Another instance to compare with.
    82 		 *	@return ETrue if equal, EFalse if not.
    83 		 */
    84 		IMPORT_C TBool operator == (const TSdpTypedTime& aObj) const;
    85 
    86 		/**
    87 		 *	Sets the typed time value.
    88 		 *
    89 		 *	@param aValue Time value.
    90 		 *	@param aUnit Time unit.
    91 		 */
    92 		IMPORT_C void SetValue(TInt64 aValue, TUnit aUnit);
    93 
    94     public:
    95 		
    96 		/**
    97          *  Externalizes the object to stream
    98          *
    99          *  @param aStream Stream where the object's state will be stored
   100          */
   101 		void ExternalizeL(RWriteStream& aStream) const;
   102 		
   103 		/**
   104          *  Creates object from the stream data
   105          *
   106          *  @param aStream Stream where the object's state will be read
   107          *  @return Initialized object
   108          */
   109 		static TSdpTypedTime InternalizeL(RReadStream& aStream);
   110         
   111         /**
   112 		 *	Output the field formatted according to SDP syntax and including
   113 		 *  the terminating CRLF.
   114 		 * 
   115 		 *	@param aStream	Stream used for output.
   116 		 */
   117         void EncodeL(RWriteStream& aStream) const;
   118         
   119         /**
   120          *	Construct a new origin field.
   121 		 *		 
   122          *	@param aText A string containing a correctly formatted field value
   123 		 *               terminated by a CRLF.
   124          *	@return The new instance.
   125          */
   126         static TSdpTypedTime DecodeL(const TDesC8& aText);
   127 
   128     public: // Data
   129     
   130         /**
   131         * @internalComponent
   132         */
   133 		TInt64 iValue;
   134 		
   135 		/**
   136 		* @internalComponent
   137 		*/
   138 		TInt iUnit;
   139 
   140 	};
   141 
   142 #endif // TSDPTYPEDTIME_H