epoc32/include/s32buf.inl
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
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
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
// Class TStreamPos
williamr@2
    17
inline TStreamPos::TStreamPos(TInt anOffset)
williamr@2
    18
	: iOff(anOffset)
williamr@2
    19
/** Constructs the stream position object from the specified value.
williamr@2
    20
williamr@2
    21
@param anOffset The position value. */
williamr@2
    22
	{}
williamr@2
    23
inline TBool TStreamPos::operator==(TStreamPos aPos) const
williamr@2
    24
/** Tests whether the stream position is equal to the specified stream position.
williamr@2
    25
williamr@2
    26
@param aPos The stream position to be compared.
williamr@2
    27
@return True, if this object's stream position value is equal to the specified 
williamr@2
    28
stream position's value; false, otherwise. */
williamr@2
    29
	{return iOff==aPos.iOff;}
williamr@2
    30
inline TBool TStreamPos::operator!=(TStreamPos aPos) const
williamr@2
    31
/** Tests whether the stream position is not equal to the specified stream position.
williamr@2
    32
williamr@2
    33
@param aPos The stream position to be compared.
williamr@2
    34
@return True, if this object's stream position value is not equal to the specified 
williamr@2
    35
stream position's value; false, otherwise. */
williamr@2
    36
	{return iOff!=aPos.iOff;}
williamr@2
    37
inline TBool TStreamPos::operator<(TStreamPos aPos) const
williamr@2
    38
/** Tests whether the stream position is less than the specified stream position.
williamr@2
    39
williamr@2
    40
@param aPos The stream position to be compared.
williamr@2
    41
@return True, if this object's stream position value is less than the specified 
williamr@2
    42
stream position's value; false, otherwise. */
williamr@2
    43
	{return iOff<aPos.iOff;}
williamr@2
    44
inline TBool TStreamPos::operator<=(TStreamPos aPos) const
williamr@2
    45
/** Tests whether the stream position is less than or equal to the specified stream 
williamr@2
    46
position.
williamr@2
    47
williamr@2
    48
@param aPos The stream position to be compared.
williamr@2
    49
@return True, if this object's stream position value is less than or equal 
williamr@2
    50
to the specified stream position's value; false, otherwise. */
williamr@2
    51
	{return iOff<=aPos.iOff;}
williamr@2
    52
inline TBool TStreamPos::operator>(TStreamPos aPos) const
williamr@2
    53
/** Tests whether the stream position is greater than the specified stream position.
williamr@2
    54
williamr@2
    55
@param aPos The stream position to be compared.
williamr@2
    56
@return True, if this object's stream position value is greater than the specified 
williamr@2
    57
stream position's value; false, otherwise. */
williamr@2
    58
	{return iOff>aPos.iOff;}
williamr@2
    59
inline TBool TStreamPos::operator>=(TStreamPos aPos) const
williamr@2
    60
/** Tests whether the stream position is greater than or equal to the specified 
williamr@2
    61
stream position.
williamr@2
    62
williamr@2
    63
@param aPos The stream position to be compared.
williamr@2
    64
@return True, if this object's stream position value is greater than or equal 
williamr@2
    65
to the specified stream position's value; false, otherwise. */
williamr@2
    66
	{return iOff>=aPos.iOff;}
williamr@2
    67
inline TInt TStreamPos::operator-(TStreamPos aPos) const
williamr@2
    68
/** Gets the result of subtracting the specified stream position value from this 
williamr@2
    69
object's stream position value.
williamr@2
    70
williamr@2
    71
@param aPos The stream position whose value is to be subtracted.
williamr@2
    72
@return The result of the calculation. */
williamr@2
    73
	{return iOff-aPos.iOff;}
williamr@2
    74
inline TStreamPos TStreamPos::operator+(TInt anOffset) const
williamr@2
    75
/** Gets a stream position object that holds the result of adding the specified 
williamr@2
    76
value to this object's stream position value.
williamr@2
    77
williamr@2
    78
@param anOffset The value to be added.
williamr@2
    79
@return The stream position object holding the result of the calculation. */
williamr@2
    80
	{return TStreamPos(iOff+anOffset);}
williamr@2
    81
inline TStreamPos TStreamPos::operator-(TInt anOffset) const
williamr@2
    82
/** Gets a stream position object that holds the result of subtracting the specified 
williamr@2
    83
value from this object's stream position value.
williamr@2
    84
williamr@2
    85
@param anOffset The value to be subtracted.
williamr@2
    86
@return The stream position object holding the result of the calculation. */
williamr@2
    87
	{return TStreamPos(iOff-anOffset);}
williamr@2
    88
inline TStreamPos& TStreamPos::operator+=(TInt anOffset)
williamr@2
    89
/** Adds the specified value to this stream position object.
williamr@2
    90
williamr@2
    91
@param anOffset The value to be added.
williamr@2
    92
@return A reference to this stream position object. */
williamr@2
    93
	{iOff+=anOffset;return *this;}
williamr@2
    94
inline TStreamPos& TStreamPos::operator-=(TInt anOffset)
williamr@2
    95
/** Subtracts the specified value from this stream position object.
williamr@2
    96
williamr@2
    97
@param anOffset The value to be subtracted.
williamr@2
    98
@return A reference to this stream position object. */
williamr@2
    99
	{iOff-=anOffset;return *this;}
williamr@2
   100
inline TInt TStreamPos::Offset() const
williamr@2
   101
/** Gets the stream position value.
williamr@2
   102
williamr@2
   103
@return The stream position value. */
williamr@2
   104
	{return iOff;}
williamr@2
   105
inline TStreamPos operator+(TInt anOffset,TStreamPos aPos)
williamr@2
   106
	{return aPos+anOffset;}
williamr@2
   107
williamr@2
   108
// Class TStreamTransfer
williamr@2
   109
inline TStreamTransfer::TStreamTransfer(TInt aMaxLength)
williamr@2
   110
	: iVal(aMaxLength)
williamr@2
   111
/** Constructs a stream transfer object specifying a length value.
williamr@2
   112
williamr@2
   113
This value represents the maximum amount of data that can be transferred between 
williamr@2
   114
streams.
williamr@2
   115
williamr@2
   116
@param aMaxLength The maximum length of data that can be transferred. In debug 
williamr@2
   117
mode, the function raises a STORE-Stream 13 panic, if this value is negative. */
williamr@2
   118
	{
williamr@2
   119
#if defined (_DEBUG)
williamr@2
   120
	__DbgChkNonNegative(aMaxLength);
williamr@2
   121
#endif
williamr@2
   122
	}
williamr@2
   123
inline TStreamTransfer::TStreamTransfer(TUnlimited)
williamr@2
   124
	: iVal(-1)
williamr@2
   125
/** Constructs a stream transfer object specifying that there is no explicit limit 
williamr@2
   126
to the amount of data that can be transferred between streams.
williamr@2
   127
williamr@2
   128
The amount of data to be transferred is only limited by the streams themselves.
williamr@2
   129
williamr@2
   130
The arithmetical operators do not change the state of an unlimited stream 
williamr@2
   131
transfer object.
williamr@2
   132
williamr@2
   133
@param (The enumerator value is not used). */
williamr@2
   134
	{}
williamr@2
   135
inline TBool TStreamTransfer::operator==(TInt aLength) const
williamr@2
   136
/** Tests whether the stream transfer value is equal to the specified value.
williamr@2
   137
williamr@2
   138
@param aLength The length to compared. In debug mode, the function raises 
williamr@2
   139
a STORE-Stream 13 panic, if this value is negative.
williamr@2
   140
@return True, if the stream transfer value is equal to the specified value; 
williamr@2
   141
false, otherwise. */
williamr@2
   142
	{
williamr@2
   143
#if defined (_DEBUG)
williamr@2
   144
	__DbgChkNonNegative(aLength);
williamr@2
   145
#endif
williamr@2
   146
	return iVal==aLength;
williamr@2
   147
	}
williamr@2
   148
inline TBool TStreamTransfer::operator>(TInt aLength) const
williamr@2
   149
/** Tests whether the stream transfer value is greater than the specified value.
williamr@2
   150
williamr@2
   151
@param aLength The length to compared. In debug mode, the function raises 
williamr@2
   152
a STORE-Stream 13 panic, if this value is negative.
williamr@2
   153
@return True, if the stream transfer value is greater than the specified value; 
williamr@2
   154
false, otherwise. */
williamr@2
   155
	{
williamr@2
   156
#if defined (_DEBUG)
williamr@2
   157
	__DbgChkNonNegative(aLength);
williamr@2
   158
#endif
williamr@2
   159
	return TUint(iVal)>TUint(aLength);
williamr@2
   160
	}
williamr@2
   161
inline TStreamTransfer TStreamTransfer::operator-(TInt aLength) const
williamr@2
   162
/** Subtracts the specified value from the stream transfer value.
williamr@2
   163
williamr@2
   164
If this stream transfer object was originally constructed as an unlimited 
williamr@2
   165
type, i.e. using the TStreamTransfer(TUnlimited) constructor, then this operator 
williamr@2
   166
does not change the state of the object, and it remains an unlimited type.
williamr@2
   167
williamr@2
   168
@param aLength The length to be subtracted. In debug mode, the function raises 
williamr@2
   169
a STORE-Stream 13 panic, if this value is negative.
williamr@2
   170
@return A stream transfer object containing the result of the subtraction. */
williamr@2
   171
	{
williamr@2
   172
#if defined (_DEBUG)
williamr@2
   173
	__DbgChkNonNegative(aLength);
williamr@2
   174
#endif
williamr@2
   175
	return iVal<0?*this:TStreamTransfer(iVal-aLength);
williamr@2
   176
	}
williamr@2
   177
inline TInt TStreamTransfer::operator[](TInt aMaxLength) const
williamr@2
   178
	{return *this>aMaxLength?aMaxLength:iVal;}
williamr@2
   179
inline TStreamTransfer& TStreamTransfer::operator-=(TInt aLength)
williamr@2
   180
/** Subtracts the specified value from the stream transfer value, updating this 
williamr@2
   181
stream transfer object.
williamr@2
   182
williamr@2
   183
If this stream transfer object was originally constructed as an unlimited 
williamr@2
   184
type, i.e. using the TStreamTransfer(TUnlimited) constructor, then this operator 
williamr@2
   185
does not change the state of the object, and it remains an unlimited type.
williamr@2
   186
williamr@2
   187
If this stream transfer object was not an unlimited type, then, in debug mode, 
williamr@2
   188
the function raises a STORE-Stream 13 panic, if the result of the calculation 
williamr@2
   189
is negative.
williamr@2
   190
williamr@2
   191
@param aLength The length to be subtracted. In debug mode, the function raises 
williamr@2
   192
a STORE-Stream 13 panic, if this value is negative.
williamr@2
   193
@return A reference to this stream transfer object. */
williamr@2
   194
	{
williamr@2
   195
#if defined (_DEBUG)
williamr@2
   196
	__DbgChkNonNegative(aLength);
williamr@2
   197
#endif
williamr@2
   198
	if (iVal>=0)
williamr@2
   199
		{
williamr@2
   200
		iVal-=aLength;
williamr@2
   201
#if defined (_DEBUG)
williamr@2
   202
		__DbgChkNonNegative(iVal);
williamr@2
   203
#endif
williamr@2
   204
		}
williamr@2
   205
	return *this;
williamr@2
   206
	}
williamr@2
   207
inline TInt TStreamTransfer::Left() const
williamr@2
   208
/** Gets the stream transfer value.
williamr@2
   209
williamr@2
   210
@return The current stream transfer value. */
williamr@2
   211
	{
williamr@2
   212
#if defined (_DEBUG)
williamr@2
   213
	__DbgChkNonNegative(iVal);
williamr@2
   214
#endif
williamr@2
   215
	return iVal;
williamr@2
   216
	}
williamr@2
   217
inline TBool operator==(TInt aLength,TStreamTransfer aTransfer)
williamr@2
   218
	{return aTransfer==aLength;}
williamr@2
   219
inline TBool operator<(TInt aLength,TStreamTransfer aTransfer)
williamr@2
   220
	{return aTransfer>aLength;}
williamr@2
   221
williamr@2
   222
// Class MStreamBuf
williamr@2
   223
inline void MStreamBuf::Release()
williamr@2
   224
/** Frees resources before abandoning the stream buffer.
williamr@2
   225
williamr@2
   226
The function calls the virtual function DoRelease() to implement this behaviour.
williamr@2
   227
williamr@2
   228
Release() is called by both RReadStream::Release() and RWriteStream::Release().
williamr@2
   229
williamr@2
   230
@see MStreamBuf::DoRelease()
williamr@2
   231
@see RReadStream::Release()
williamr@2
   232
@see RWriteStream::Release() */
williamr@2
   233
	{DoRelease();}
williamr@2
   234
inline void MStreamBuf::SynchL()
williamr@2
   235
/** Synchronises the stream buffer with the stream, leaving if any error occurs.
williamr@2
   236
williamr@2
   237
In effect, this ensures that buffered data is delivered to the stream.
williamr@2
   238
williamr@2
   239
The function calls the virtual function DoSynchL() to implement this behaviour.
williamr@2
   240
williamr@2
   241
@see MStreamBuf::DoSynchL() */
williamr@2
   242
	{DoSynchL();}
williamr@2
   243
inline TInt MStreamBuf::ReadL(TAny* aPtr,TInt aMaxLength)
williamr@2
   244
/** Reads data from the stream buffer into the specified memory location.
williamr@2
   245
williamr@2
   246
The function calls the virtual function DoReadL(TAny*,TInt) to implement this 
williamr@2
   247
behaviour.
williamr@2
   248
williamr@2
   249
@param aPtr A pointer to the target memory location for the data read from 
williamr@2
   250
the stream buffer.
williamr@2
   251
@param aMaxLength The maximum number of bytes to be read.
williamr@2
   252
@return The number of bytes read.
williamr@2
   253
@see MStreamBuf::DoReadL() */
williamr@2
   254
	{return DoReadL(aPtr,aMaxLength);}
williamr@2
   255
inline TInt MStreamBuf::ReadL(TDes8& aDes,TInt aMaxLength,TRequestStatus& aStatus)
williamr@2
   256
/** Reads data, asynchronously, from the stream buffer into the specified descriptor.
williamr@2
   257
williamr@2
   258
The function calls the virtual function DoReadL(TDes8&,TInt,TRequestStatus&) 
williamr@2
   259
to implement this behaviour.
williamr@2
   260
williamr@2
   261
If the function leaves, then no read request will have been initiated.
williamr@2
   262
williamr@2
   263
@param aDes The target descriptor for the data read from the stream buffer.
williamr@2
   264
@param aMaxLength The maximum number of bytes to be read.
williamr@2
   265
@param aStatus The request status that indicates the completion status of this 
williamr@2
   266
asynchronous request.
williamr@2
   267
@return The maximum number of bytes to be read, as used in this request. This 
williamr@2
   268
can be different to the value supplied in aMaxLength; this is dependent on 
williamr@2
   269
the implementation.
williamr@2
   270
@see MStreamBuf::DoReadL() */
williamr@2
   271
	{return DoReadL(aDes,aMaxLength,aStatus);}
williamr@2
   272
inline TStreamTransfer MStreamBuf::ReadL(MStreamInput& anInput,TStreamTransfer aTransfer)
williamr@2
   273
/** Reads data from the stream buffer into the specified data sink.
williamr@2
   274
williamr@2
   275
The function calls the virtual function DoReadL(MStreamInput&,TStreamTransfer) 
williamr@2
   276
to implement this behaviour.
williamr@2
   277
williamr@2
   278
@param anInput The data sink that is the target for the read operation.
williamr@2
   279
@param aTransfer Defines the amount of data available to be read.
williamr@2
   280
@return The amount of data that was not consumed. */
williamr@2
   281
	{return DoReadL(anInput,aTransfer);}
williamr@2
   282
inline void MStreamBuf::ReadL(MStreamInput& anInput)
williamr@2
   283
/** Reads data from the stream buffer into the specified data sink.
williamr@2
   284
williamr@2
   285
The function uses the virtual function DoReadL(MStreamInput&,TStreamTransfer) 
williamr@2
   286
to implement this behaviour.
williamr@2
   287
williamr@2
   288
No explicit limit is placed on the amount of data that can be read.
williamr@2
   289
williamr@2
   290
@param anInput The data sink that is the target for the read operation. */
williamr@2
   291
	{DoReadL(anInput,KStreamUnlimited);}
williamr@2
   292
inline void MStreamBuf::WriteL(const TAny* aPtr,TInt aLength)
williamr@2
   293
/** Writes data from the specified memory location into the stream buffer.
williamr@2
   294
williamr@2
   295
The function calls the virtual function DoWriteL(TAny*,TInt) to implement 
williamr@2
   296
this behaviour.
williamr@2
   297
williamr@2
   298
@param aPtr A pointer to the memory location from which data is to be written 
williamr@2
   299
to the stream buffer.
williamr@2
   300
@param aLength The number of bytes to be written.
williamr@2
   301
@see MStreamBuf::DoWriteL() */
williamr@2
   302
	{DoWriteL(aPtr,aLength);}
williamr@2
   303
inline TInt MStreamBuf::WriteL(const TDesC8& aDes,TInt aMaxLength,TRequestStatus& aStatus)
williamr@2
   304
/** Writes data, asynchronously, from the specified descriptor into the stream buffer.
williamr@2
   305
williamr@2
   306
The function calls the virtual function DoWriteL(const TDesC8&,TInt,TRequestStatus&) 
williamr@2
   307
to implement this behaviour.
williamr@2
   308
williamr@2
   309
If the function leaves, then no write request will have been initiated.
williamr@2
   310
williamr@2
   311
@param aDes The source descriptor for the data to be written into the stream 
williamr@2
   312
buffer.
williamr@2
   313
@param aMaxLength The maximum number of bytes to be written.
williamr@2
   314
@param aStatus The request status that indicates the completion status of this 
williamr@2
   315
asynchronous request.
williamr@2
   316
@return The maximum number of bytes to be written, as used in this request. 
williamr@2
   317
This can be different to the value supplied in aMaxLength; this is dependent 
williamr@2
   318
on the implementation.
williamr@2
   319
@see MStreamBuf::DoWriteL() */
williamr@2
   320
	{return DoWriteL(aDes,aMaxLength,aStatus);}
williamr@2
   321
inline TStreamTransfer MStreamBuf::WriteL(MStreamOutput& anOutput,TStreamTransfer aTransfer)
williamr@2
   322
/** Writes data into the stream buffer from the specified data source.
williamr@2
   323
williamr@2
   324
The function calls the virtual function DoWriteL(MStreamOutput&,TStreamTransfer) 
williamr@2
   325
to implement this behaviour.
williamr@2
   326
williamr@2
   327
@param anOutput The data source for the write operation.
williamr@2
   328
@param aTransfer Defines the amount of data to be pulled from the output stream 
williamr@2
   329
object.
williamr@2
   330
@return A stream transfer object defining the amount of data that was not consumed. */
williamr@2
   331
	{return DoWriteL(anOutput,aTransfer);}
williamr@2
   332
inline void MStreamBuf::WriteL(MStreamOutput& anOutput)
williamr@2
   333
/**Writes data into the stream buffer from the specified data source.
williamr@2
   334
williamr@2
   335
The function calls the virtual function DoWriteL(MStreamOutput&,TStreamTransfer) to implement this behaviour.
williamr@2
   336
williamr@2
   337
No explicit limit is placed on the amount of data that can be written.
williamr@2
   338
williamr@2
   339
@param anOutput The data source for the write operation.
williamr@2
   340
@param aMaxLength The maximum amount of data available to be written.
williamr@2
   341
*/
williamr@2
   342
	{DoWriteL(anOutput,KStreamUnlimited);}
williamr@2
   343
inline void MStreamBuf::SeekL(TMark aMark,TStreamPos aPos)
williamr@2
   344
/**Moves the position of the read or write mark in the stream.
williamr@2
   345
williamr@2
   346
The new position is calculated by adding the specified value to the position of the beginning of the stream.
williamr@2
   347
williamr@2
   348
The function calls virtual function DoSeekL(TMark,TStreamLocation,TInt) to implement this behaviour.
williamr@2
   349
Notes:
williamr@2
   350
As there are two current positions, one for the read mark and one for the write mark, it is not valid, in general, to use a single call to SeekL() to move both the read and write marks. 
williamr@2
   351
Not all streams are seekable. 
williamr@2
   352
williamr@2
   353
@param aMark The type of mark, i.e. read or write.
williamr@2
   354
@param aLocation A stream position value on which the calculation of the new position is based.
williamr@2
   355
*/
williamr@2
   356
	{DoSeekL(aMark,EStreamBeginning,aPos.Offset());}
williamr@2
   357
inline TStreamPos MStreamBuf::SeekL(TMark aMark,TStreamLocation aLocation,TInt anOffset)
williamr@2
   358
/** Moves the position of the read mark or the write mark in the stream.
williamr@2
   359
williamr@2
   360
The new position is calculated by adding the specified offset to one of:
williamr@2
   361
williamr@2
   362
the position of the beginning of the stream
williamr@2
   363
williamr@2
   364
the position of the end of the stream
williamr@2
   365
williamr@2
   366
the position of the current read mark or write mark.
williamr@2
   367
williamr@2
   368
The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt) 
williamr@2
   369
to implement this behaviour.
williamr@2
   370
williamr@2
   371
As there are two current positions, one for the read mark and one for the 
williamr@2
   372
write mark, it is not valid, in general, to use a single call to SeekL() to 
williamr@2
   373
move both the read and write marks.
williamr@2
   374
williamr@2
   375
Not all streams are seekable.
williamr@2
   376
williamr@2
   377
@param aMark The type of mark, i.e read or write.
williamr@2
   378
@param aLocation The location in the stream on which the calculation of the 
williamr@2
   379
new position is based.
williamr@2
   380
@param anOffset The offset value.
williamr@2
   381
@return The new stream position of the read or write mark. */
williamr@2
   382
	{return DoSeekL(aMark,aLocation,anOffset);}
williamr@2
   383
inline TStreamPos MStreamBuf::SeekL(TRead,TStreamLocation aLocation,TInt anOffset)
williamr@2
   384
/** Moves the position of the read mark in the stream.
williamr@2
   385
williamr@2
   386
The new position is calculated by adding the specified offset to one of:
williamr@2
   387
williamr@2
   388
the position of the beginning of the stream
williamr@2
   389
williamr@2
   390
the position of the end of the stream
williamr@2
   391
williamr@2
   392
the position of the current read mark.
williamr@2
   393
williamr@2
   394
The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt) 
williamr@2
   395
to implement this behaviour.
williamr@2
   396
williamr@2
   397
Not all streams are seekable.
williamr@2
   398
williamr@2
   399
@param (The enumerator value is not used)
williamr@2
   400
@param aLocation The location in the stream on which the calculation of the 
williamr@2
   401
new position is based.
williamr@2
   402
@param anOffset The offset value.
williamr@2
   403
@return The new stream position of the read mark. */
williamr@2
   404
	{return DoSeekL(ERead,aLocation,anOffset);}
williamr@2
   405
inline TStreamPos MStreamBuf::SeekL(TWrite,TStreamLocation aLocation,TInt anOffset)
williamr@2
   406
/** Moves the position of the write mark in the stream.
williamr@2
   407
williamr@2
   408
The new position is calculated by adding the specified offset to one of:
williamr@2
   409
williamr@2
   410
the position of the beginning of the stream
williamr@2
   411
williamr@2
   412
the position of the end of the stream
williamr@2
   413
williamr@2
   414
the position of the current write mark.
williamr@2
   415
williamr@2
   416
The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt) 
williamr@2
   417
to implement this behaviour.
williamr@2
   418
williamr@2
   419
Not all streams are seekable.
williamr@2
   420
williamr@2
   421
@param (The enumerator value is not used)
williamr@2
   422
@param aLocation The location in the stream on which the calculation of the 
williamr@2
   423
new position is based.
williamr@2
   424
@param anOffset The offset value.
williamr@2
   425
@return The new stream position of the write mark. */
williamr@2
   426
	{return DoSeekL(EWrite,aLocation,anOffset);}
williamr@2
   427
inline TStreamPos MStreamBuf::SeekL(TRead,TInt anOffset)
williamr@2
   428
/** Moves the position of the read mark in the stream by the specified offset.
williamr@2
   429
williamr@2
   430
The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt) 
williamr@2
   431
to implement this behaviour.
williamr@2
   432
williamr@2
   433
Not all streams are seekable.
williamr@2
   434
williamr@2
   435
@param (The enumerator value is not used)
williamr@2
   436
@param anOffset The amount by which the position of the read mark is to be 
williamr@2
   437
moved relative to the existing position of the read mark.
williamr@2
   438
@return The new stream position of the read mark. */
williamr@2
   439
	{return DoSeekL(ERead,EStreamMark,anOffset);}
williamr@2
   440
inline TStreamPos MStreamBuf::SeekL(TWrite,TInt anOffset)
williamr@2
   441
/** Moves the position of the write mark in the stream by the specified offset.
williamr@2
   442
williamr@2
   443
The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt) 
williamr@2
   444
to implement this behaviour.
williamr@2
   445
williamr@2
   446
Not all streams are seekable.
williamr@2
   447
williamr@2
   448
@param (The enumerator value is not used)
williamr@2
   449
@param anOffset The amount by which the position of the write mark is to be 
williamr@2
   450
moved relative to the existing position of the write mark.
williamr@2
   451
@return The new stream position of the write mark. */
williamr@2
   452
	{return DoSeekL(EWrite,EStreamMark,anOffset);}
williamr@2
   453
inline TStreamPos MStreamBuf::TellL(TRead) const
williamr@2
   454
/** Gets the position of the read mark within the stream.
williamr@2
   455
williamr@2
   456
The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt) 
williamr@2
   457
to implement this behaviour.
williamr@2
   458
williamr@2
   459
@param (The enumerator value is not used).
williamr@2
   460
@return The stream position. */
williamr@2
   461
	{return CONST_CAST(MStreamBuf*,this)->DoSeekL(ERead,EStreamMark,0);}
williamr@2
   462
inline TStreamPos MStreamBuf::TellL(TWrite) const
williamr@2
   463
/** Gets the position of the write mark within the stream.
williamr@2
   464
williamr@2
   465
The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt) 
williamr@2
   466
to implement this behaviour.
williamr@2
   467
williamr@2
   468
@param (The enumerator value is not used).
williamr@2
   469
@return The stream position. */
williamr@2
   470
	{return CONST_CAST(MStreamBuf*,this)->DoSeekL(EWrite,EStreamMark,0);}
williamr@2
   471
inline TInt MStreamBuf::SizeL() const
williamr@2
   472
/** Gets the size of the stream.
williamr@2
   473
williamr@2
   474
@return The size of the stream, in bytes. */
williamr@2
   475
	{return CONST_CAST(MStreamBuf*,this)->DoSeekL(0,EStreamEnd,0).Offset();}
williamr@2
   476
williamr@2
   477
// Class TStreamBuf
williamr@2
   478
inline void TStreamBuf::SetBuf(TRead,TUint8* aPtr,TUint8* anEnd)
williamr@2
   479
/** Sets the start and end points of the read area within the intermediate buffer.
williamr@2
   480
williamr@2
   481
A start point is always within an area; an end point is always the first byte 
williamr@2
   482
beyond the end of an area.
williamr@2
   483
williamr@2
   484
@param (The enumerator is not used).
williamr@2
   485
@param aPtr The start point.
williamr@2
   486
@param anEnd The end point.
williamr@2
   487
@see MStreamBuf::TRead */
williamr@2
   488
	{iRPtr=aPtr;iREnd=anEnd;}
williamr@2
   489
inline void TStreamBuf::SetBuf(TWrite,TUint8* aPtr,TUint8* anEnd)
williamr@2
   490
/** Sets the start and end points of the write area within the intermediate buffer.
williamr@2
   491
williamr@2
   492
A start point is always within an area; an end point is always the first byte 
williamr@2
   493
beyond the end of an area.
williamr@2
   494
williamr@2
   495
@param (The enumerator is not used).
williamr@2
   496
@param aPtr The start point.
williamr@2
   497
@param anEnd The end point.
williamr@2
   498
@see MStreamBuf::TWrite */
williamr@2
   499
	{iWPtr=aPtr;iWEnd=anEnd;}
williamr@2
   500
inline void TStreamBuf::SetPtr(TRead,TUint8* aPtr)
williamr@2
   501
/** Sets the start point of the write area within the intermediate buffer.
williamr@2
   502
williamr@2
   503
A start point is always within an area.
williamr@2
   504
williamr@2
   505
@param (The enumerator is not used).
williamr@2
   506
@param aPtr The start point.
williamr@2
   507
@see MStreamBuf::TWrite */
williamr@2
   508
	{iRPtr=aPtr;}
williamr@2
   509
inline void TStreamBuf::SetPtr(TWrite,TUint8* aPtr)
williamr@2
   510
/** Sets the start point of the write area within the intermediate buffer.
williamr@2
   511
williamr@2
   512
A start point is always within an area.
williamr@2
   513
williamr@2
   514
@param (The enumerator is not used).
williamr@2
   515
@param aPtr The start point.
williamr@2
   516
@see MStreamBuf::TWrite */
williamr@2
   517
	{iWPtr=aPtr;}
williamr@2
   518
inline void TStreamBuf::SetEnd(TRead,TUint8* anEnd)
williamr@2
   519
	{iREnd=anEnd;}
williamr@2
   520
inline void TStreamBuf::SetEnd(TWrite,TUint8* anEnd)
williamr@2
   521
	{iWEnd=anEnd;}
williamr@2
   522
inline TUint8* TStreamBuf::Ptr(TRead) const
williamr@2
   523
/** Gets the current start point of the read area within the intermediate buffer.
williamr@2
   524
williamr@2
   525
@param (The enumerator is not used).
williamr@2
   526
@return The start point.
williamr@2
   527
@see MStreamBuf::TRead */
williamr@2
   528
	{return iRPtr;}
williamr@2
   529
inline TUint8* TStreamBuf::Ptr(TWrite) const
williamr@2
   530
/** Gets the current start point of the write area within the intermediate buffer.
williamr@2
   531
williamr@2
   532
@param (The enumerator is not used).
williamr@2
   533
@return The start point.
williamr@2
   534
@see MStreamBuf::TWrite */
williamr@2
   535
	{return iWPtr;}
williamr@2
   536
inline TUint8* TStreamBuf::End(TRead) const
williamr@2
   537
/** Gets the current end point of the read area within the intermediate buffer.
williamr@2
   538
williamr@2
   539
An end point is always the first byte beyond the end of an area.
williamr@2
   540
williamr@2
   541
@param (The enumerator is not used).
williamr@2
   542
@return The end point.
williamr@2
   543
@see MStreamBuf::TRead */
williamr@2
   544
	{return iREnd;}
williamr@2
   545
inline TUint8* TStreamBuf::End(TWrite) const
williamr@2
   546
/** Gets the current end point of the write area within the intermediate buffer.
williamr@2
   547
williamr@2
   548
An end point is always the first byte beyond the end of an area.
williamr@2
   549
williamr@2
   550
@param (The enumerator is not used).
williamr@2
   551
@return The end point.
williamr@2
   552
@see MStreamBuf::TWrite */
williamr@2
   553
	{return iWEnd;}
williamr@2
   554
inline TInt TStreamBuf::Avail(TRead) const
williamr@2
   555
/** Gets the number of bytes available in the read area within the intermediate 
williamr@2
   556
buffer.
williamr@2
   557
williamr@2
   558
@param (The enumerator is not used).
williamr@2
   559
@return The number of bytes available.
williamr@2
   560
@see MStreamBuf::TRead */
williamr@2
   561
	{return iREnd-iRPtr;}
williamr@2
   562
inline TInt TStreamBuf::Avail(TWrite) const
williamr@2
   563
/** Gets the number of bytes available in the write area within the intermediate 
williamr@2
   564
buffer.
williamr@2
   565
williamr@2
   566
@param (The enumerator is not used).
williamr@2
   567
@return The number of bytes available.
williamr@2
   568
@see MStreamBuf::TWrite */
williamr@2
   569
	{return iWEnd-iWPtr;}
williamr@2
   570
williamr@2
   571
// Class TStreamFilter
williamr@2
   572
inline void TStreamFilter::Set(MStreamBuf* aHost,TInt aMode)
williamr@2
   573
/** Sets up the filter to use the specified host for streamed data.
williamr@2
   574
williamr@2
   575
Taking ownership of the host stream buffer means that calls to SynchL() propagate 
williamr@2
   576
to the host buffer after the filter has flushed its data, and that when the 
williamr@2
   577
filter is released it also releases the host buffer. 
williamr@2
   578
williamr@2
   579
@param aHost The host for the streamed data - a stream buffer.
williamr@2
   580
@param aMode The mode in which the stream buffer is to be used. It can be used 
williamr@2
   581
in either read or write modes, represented by ERead and EWrite, but not both 
williamr@2
   582
at the same time. In debug mode, setting both raises a STORE-Stream 18 panic. 
williamr@2
   583
In addition, specify EAttached to indicate that the filter should take ownership 
williamr@2
   584
of the host stream buffer.
williamr@2
   585
@see MStreamBuf::TRead
williamr@2
   586
@see MStreamBuf::TWrite */
williamr@2
   587
	{
williamr@2
   588
#if defined (_DEBUG)
williamr@2
   589
	__DbgChkMode(aMode);
williamr@2
   590
#endif
williamr@2
   591
	iHost=aHost;iMode=aMode;
williamr@2
   592
	}
williamr@2
   593
inline void TStreamFilter::Committed()
williamr@2
   594
/** Flags the streamed data as committed. */
williamr@2
   595
	{iMode&=~EWrite;}
williamr@2
   596
inline TBool TStreamFilter::IsCommitted() const
williamr@2
   597
/** Tests whether the streamed data is committed.
williamr@2
   598
williamr@2
   599
@return True, if streamed data is committed; false, otherwise. */
williamr@2
   600
	{return iHost==NULL||!(iMode&EWrite);}
williamr@4
   601