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