epoc32/include/sdprepeatfield.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
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     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
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:
williamr@2
    15
* Name          : SdpRepeatField.h
williamr@2
    16
* Part of       : SDP Codec
williamr@2
    17
* Interface     : SDK API, SDP Codec API
williamr@2
    18
* Version       : 1.0
williamr@2
    19
*
williamr@2
    20
*/
williamr@2
    21
williamr@2
    22
williamr@2
    23
williamr@2
    24
#ifndef CSDPREPEATFIELD_H
williamr@2
    25
#define CSDPREPEATFIELD_H
williamr@2
    26
williamr@2
    27
//  INCLUDES
williamr@2
    28
#include <e32base.h>
williamr@2
    29
#include <stringpool.h>
williamr@2
    30
#include "_sdpdefs.h"
williamr@2
    31
#include <sdptypedtime.h>
williamr@2
    32
williamr@2
    33
// FORWARD DECLARATIONS
williamr@2
    34
class RReadStream;
williamr@2
    35
class RWriteStream;
williamr@2
    36
williamr@2
    37
// CLASS DECLARATION
williamr@2
    38
/**
williamr@2
    39
 *  @publishedAll
williamr@2
    40
 *  @released
williamr@2
    41
 *
williamr@2
    42
 *	This class encapsulates the repeat times field of the 
williamr@2
    43
 *  Session Description Protocol.
williamr@2
    44
 *
williamr@2
    45
 *	The normative reference for correct formatting and values is
williamr@2
    46
 *	draft-ietf-mmusic-sdp-new-14 unless specified otherwise in
williamr@2
    47
 *  member documentation. The implementation supports this normative
williamr@2
    48
 *  reference, but does not enforce it fully. 
williamr@2
    49
 *
williamr@2
    50
 *  @lib sdpcodec.lib
williamr@2
    51
 */
williamr@2
    52
class CSdpRepeatField : public CBase
williamr@2
    53
	{
williamr@2
    54
    public: // Constructors and destructor
williamr@2
    55
        /**
williamr@2
    56
         *	Constructs a new repeat times field.
williamr@2
    57
		 *	
williamr@2
    58
         *	@param aText A string containing a correctly 
williamr@2
    59
         *         formatted field value terminated by a CRLF.
williamr@2
    60
         *	@return a new instance.
williamr@2
    61
         */
williamr@2
    62
		IMPORT_C static	CSdpRepeatField* DecodeL(const TDesC8& aText);
williamr@2
    63
williamr@2
    64
        /**
williamr@2
    65
         *	Constructs a new repeat times field and adds the pointer to the 
williamr@2
    66
         *  cleanup stack.
williamr@2
    67
		 *	
williamr@2
    68
         *	@param aText A string containing a correctly 
williamr@2
    69
         *         formatted field value terminated by a CRLF.
williamr@2
    70
         *	@return a new instance.
williamr@2
    71
         */
williamr@2
    72
		IMPORT_C static	CSdpRepeatField* DecodeLC(const TDesC8& aText);
williamr@2
    73
williamr@2
    74
        /**
williamr@2
    75
         *	Constructs a new repeat times field.
williamr@2
    76
		 *	
williamr@2
    77
         *	@param aRepeatInterval Repeat interval value 
williamr@2
    78
         *         greater than zero.
williamr@2
    79
         *	@param aActiveDuration Active duration.
williamr@2
    80
         *	@param aOffsets At least one time offset.
williamr@2
    81
         *	@return a new instance.
williamr@2
    82
         */
williamr@2
    83
		IMPORT_C static	CSdpRepeatField* NewL(
williamr@2
    84
                                        const TSdpTypedTime  aRepeatInterval,
williamr@2
    85
										const TSdpTypedTime  aActiveDuration,
williamr@2
    86
										const RArray<TSdpTypedTime>& aOffsets);
williamr@2
    87
williamr@2
    88
        /**
williamr@2
    89
         *	Constructs a new repeat times field and adds the pointer to the 
williamr@2
    90
         *  cleanup stack.
williamr@2
    91
		 *	
williamr@2
    92
         *	@param aRepeatInterval Repeat interval value 
williamr@2
    93
         *         greater than zero.
williamr@2
    94
         *	@param aActiveDuration Active duration.
williamr@2
    95
         *	@param aOffsets At least one time offset.
williamr@2
    96
         *	@return a new instance.
williamr@2
    97
         */
williamr@2
    98
		IMPORT_C static	CSdpRepeatField* NewLC(
williamr@2
    99
                                        const TSdpTypedTime  aRepeatInterval,
williamr@2
   100
										const TSdpTypedTime aActiveDuration,
williamr@2
   101
										const RArray<TSdpTypedTime>& aOffsets);
williamr@2
   102
williamr@2
   103
		/**
williamr@2
   104
		 *	Deletes the resources held by the instance.
williamr@2
   105
		 */
williamr@2
   106
		IMPORT_C ~CSdpRepeatField();
williamr@2
   107
williamr@2
   108
    public: // New functions
williamr@2
   109
		/**
williamr@2
   110
		 *	Outputs the field formatted according to SDP syntax and including
williamr@2
   111
		 *  the terminating CRLF.
williamr@2
   112
		 * 
williamr@2
   113
		 *	@param aStream Stream used for output. On return 
williamr@2
   114
         *         the stream includes correctly formatted repeat field.
williamr@2
   115
		 */
williamr@2
   116
		IMPORT_C void EncodeL(RWriteStream& aStream) const;
williamr@2
   117
williamr@2
   118
		/**
williamr@2
   119
		 *	Creates a new instance that is equal to the target.
williamr@2
   120
		 *
williamr@2
   121
		 *	@return a new instance.
williamr@2
   122
		 */
williamr@2
   123
		IMPORT_C CSdpRepeatField * CloneL() const;
williamr@2
   124
williamr@2
   125
		/**	
williamr@2
   126
		 *	Compares this instance to another for equality.
williamr@2
   127
		 *
williamr@2
   128
		 *	@param aObj The instance to compare to.
williamr@2
   129
		 *	@return ETrue if equal, EFalse if not.
williamr@2
   130
		 */
williamr@2
   131
		IMPORT_C TBool operator == (const CSdpRepeatField & aObj) const;
williamr@2
   132
williamr@2
   133
		/**
williamr@2
   134
		 *	Gets the repeat interval.
williamr@2
   135
		 *
williamr@2
   136
		 *	@return The repeat interval.
williamr@2
   137
		 */
williamr@2
   138
		IMPORT_C const TSdpTypedTime RepeatInterval() const;
williamr@2
   139
williamr@2
   140
		/**
williamr@2
   141
		 *	Sets the repeat interval.
williamr@2
   142
		 *
williamr@2
   143
         *	@param aValue Repeat interval value greater than zero.
williamr@2
   144
         *	@leave KErrSdpCodecRepeatField if aValue is not positive integer 
williamr@2
   145
         *         value.
williamr@2
   146
		 */
williamr@2
   147
		IMPORT_C void SetRepeatIntervalL(const TSdpTypedTime  aValue);
williamr@2
   148
williamr@2
   149
		/**
williamr@2
   150
		 *	Gets the active duration..
williamr@2
   151
		 *
williamr@2
   152
		 *	@return The active duration.
williamr@2
   153
		 */
williamr@2
   154
		IMPORT_C const TSdpTypedTime ActiveDuration() const;
williamr@2
   155
williamr@2
   156
		/**
williamr@2
   157
		 *	Sets the active duration.
williamr@2
   158
		 *
williamr@2
   159
         *	@param Active duration.
williamr@2
   160
		 */
williamr@2
   161
		IMPORT_C void SetActiveDuration(const TSdpTypedTime aValue);
williamr@2
   162
williamr@2
   163
		/**
williamr@2
   164
		 *	Gets the array of time offsets.
williamr@2
   165
		 *  This array is used directly for element insertion and removal.
williamr@2
   166
		 *
williamr@2
   167
		 *	@return The offsets.
williamr@2
   168
		 */
williamr@2
   169
		IMPORT_C const RArray<TSdpTypedTime>& TimeOffsets() const;
williamr@2
   170
williamr@2
   171
		/**
williamr@2
   172
		 *	Sets the time offsets.
williamr@2
   173
		 *
williamr@2
   174
         *	@param aOffsets At least one time offset.
williamr@2
   175
		 */
williamr@2
   176
		IMPORT_C void SetTimeOffsetsL(const RArray<TSdpTypedTime>& aValue);
williamr@2
   177
williamr@2
   178
    public:
williamr@2
   179
		/**
williamr@2
   180
         *  Externalizes the object to stream
williamr@2
   181
         *
williamr@2
   182
         *  @param aStream Stream where the object's state will be stored
williamr@2
   183
         */
williamr@2
   184
		void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   185
		
williamr@2
   186
		/**
williamr@2
   187
         *  Creates object from the stream data
williamr@2
   188
         *
williamr@2
   189
         *  @param aStream Stream where the object's state will be read	
williamr@2
   190
         *  @return Initialized object
williamr@2
   191
         */
williamr@2
   192
		static CSdpRepeatField* InternalizeL(RReadStream& aStream);
williamr@2
   193
williamr@2
   194
	private:
williamr@2
   195
		CSdpRepeatField(const TSdpTypedTime aRepeatInterval,
williamr@2
   196
						const TSdpTypedTime aActiveDuration);
williamr@2
   197
		CSdpRepeatField();
williamr@2
   198
		void ConstructL(const TDesC8& aText);
williamr@2
   199
		void ConstructL(const RArray<TSdpTypedTime>& aOffsets);
williamr@2
   200
        
williamr@2
   201
williamr@2
   202
    private: // Data
williamr@2
   203
        RStringPool iPool;
williamr@2
   204
		TSdpTypedTime iRepeatInterval;
williamr@2
   205
		TSdpTypedTime iActiveDuration;
williamr@2
   206
		RArray<TSdpTypedTime> iTimeOffsets;
williamr@2
   207
williamr@2
   208
		__DECLARE_TEST;
williamr@2
   209
	};
williamr@2
   210
williamr@2
   211
#endif // CSDPREPEATFIELD_H