1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/store/INC/S32BUF.INL Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,601 @@
1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +// Class TStreamPos
1.20 +inline TStreamPos::TStreamPos(TInt anOffset)
1.21 + : iOff(anOffset)
1.22 +/** Constructs the stream position object from the specified value.
1.23 +
1.24 +@param anOffset The position value. */
1.25 + {}
1.26 +inline TBool TStreamPos::operator==(TStreamPos aPos) const
1.27 +/** Tests whether the stream position is equal to the specified stream position.
1.28 +
1.29 +@param aPos The stream position to be compared.
1.30 +@return True, if this object's stream position value is equal to the specified
1.31 +stream position's value; false, otherwise. */
1.32 + {return iOff==aPos.iOff;}
1.33 +inline TBool TStreamPos::operator!=(TStreamPos aPos) const
1.34 +/** Tests whether the stream position is not equal to the specified stream position.
1.35 +
1.36 +@param aPos The stream position to be compared.
1.37 +@return True, if this object's stream position value is not equal to the specified
1.38 +stream position's value; false, otherwise. */
1.39 + {return iOff!=aPos.iOff;}
1.40 +inline TBool TStreamPos::operator<(TStreamPos aPos) const
1.41 +/** Tests whether the stream position is less than the specified stream position.
1.42 +
1.43 +@param aPos The stream position to be compared.
1.44 +@return True, if this object's stream position value is less than the specified
1.45 +stream position's value; false, otherwise. */
1.46 + {return iOff<aPos.iOff;}
1.47 +inline TBool TStreamPos::operator<=(TStreamPos aPos) const
1.48 +/** Tests whether the stream position is less than or equal to the specified stream
1.49 +position.
1.50 +
1.51 +@param aPos The stream position to be compared.
1.52 +@return True, if this object's stream position value is less than or equal
1.53 +to the specified stream position's value; false, otherwise. */
1.54 + {return iOff<=aPos.iOff;}
1.55 +inline TBool TStreamPos::operator>(TStreamPos aPos) const
1.56 +/** Tests whether the stream position is greater than the specified stream position.
1.57 +
1.58 +@param aPos The stream position to be compared.
1.59 +@return True, if this object's stream position value is greater than the specified
1.60 +stream position's value; false, otherwise. */
1.61 + {return iOff>aPos.iOff;}
1.62 +inline TBool TStreamPos::operator>=(TStreamPos aPos) const
1.63 +/** Tests whether the stream position is greater than or equal to the specified
1.64 +stream position.
1.65 +
1.66 +@param aPos The stream position to be compared.
1.67 +@return True, if this object's stream position value is greater than or equal
1.68 +to the specified stream position's value; false, otherwise. */
1.69 + {return iOff>=aPos.iOff;}
1.70 +inline TInt TStreamPos::operator-(TStreamPos aPos) const
1.71 +/** Gets the result of subtracting the specified stream position value from this
1.72 +object's stream position value.
1.73 +
1.74 +@param aPos The stream position whose value is to be subtracted.
1.75 +@return The result of the calculation. */
1.76 + {return iOff-aPos.iOff;}
1.77 +inline TStreamPos TStreamPos::operator+(TInt anOffset) const
1.78 +/** Gets a stream position object that holds the result of adding the specified
1.79 +value to this object's stream position value.
1.80 +
1.81 +@param anOffset The value to be added.
1.82 +@return The stream position object holding the result of the calculation. */
1.83 + {return TStreamPos(iOff+anOffset);}
1.84 +inline TStreamPos TStreamPos::operator-(TInt anOffset) const
1.85 +/** Gets a stream position object that holds the result of subtracting the specified
1.86 +value from this object's stream position value.
1.87 +
1.88 +@param anOffset The value to be subtracted.
1.89 +@return The stream position object holding the result of the calculation. */
1.90 + {return TStreamPos(iOff-anOffset);}
1.91 +inline TStreamPos& TStreamPos::operator+=(TInt anOffset)
1.92 +/** Adds the specified value to this stream position object.
1.93 +
1.94 +@param anOffset The value to be added.
1.95 +@return A reference to this stream position object. */
1.96 + {iOff+=anOffset;return *this;}
1.97 +inline TStreamPos& TStreamPos::operator-=(TInt anOffset)
1.98 +/** Subtracts the specified value from this stream position object.
1.99 +
1.100 +@param anOffset The value to be subtracted.
1.101 +@return A reference to this stream position object. */
1.102 + {iOff-=anOffset;return *this;}
1.103 +inline TInt TStreamPos::Offset() const
1.104 +/** Gets the stream position value.
1.105 +
1.106 +@return The stream position value. */
1.107 + {return iOff;}
1.108 +inline TStreamPos operator+(TInt anOffset,TStreamPos aPos)
1.109 + {return aPos+anOffset;}
1.110 +
1.111 +// Class TStreamTransfer
1.112 +inline TStreamTransfer::TStreamTransfer(TInt aMaxLength)
1.113 + : iVal(aMaxLength)
1.114 +/** Constructs a stream transfer object specifying a length value.
1.115 +
1.116 +This value represents the maximum amount of data that can be transferred between
1.117 +streams.
1.118 +
1.119 +@param aMaxLength The maximum length of data that can be transferred. In debug
1.120 +mode, the function raises a STORE-Stream 13 panic, if this value is negative. */
1.121 + {
1.122 +#if defined (_DEBUG)
1.123 + __DbgChkNonNegative(aMaxLength);
1.124 +#endif
1.125 + }
1.126 +inline TStreamTransfer::TStreamTransfer(TUnlimited)
1.127 + : iVal(-1)
1.128 +/** Constructs a stream transfer object specifying that there is no explicit limit
1.129 +to the amount of data that can be transferred between streams.
1.130 +
1.131 +The amount of data to be transferred is only limited by the streams themselves.
1.132 +
1.133 +The arithmetical operators do not change the state of an unlimited stream
1.134 +transfer object.
1.135 +
1.136 +@param (The enumerator value is not used). */
1.137 + {}
1.138 +inline TBool TStreamTransfer::operator==(TInt aLength) const
1.139 +/** Tests whether the stream transfer value is equal to the specified value.
1.140 +
1.141 +@param aLength The length to compared. In debug mode, the function raises
1.142 +a STORE-Stream 13 panic, if this value is negative.
1.143 +@return True, if the stream transfer value is equal to the specified value;
1.144 +false, otherwise. */
1.145 + {
1.146 +#if defined (_DEBUG)
1.147 + __DbgChkNonNegative(aLength);
1.148 +#endif
1.149 + return iVal==aLength;
1.150 + }
1.151 +inline TBool TStreamTransfer::operator>(TInt aLength) const
1.152 +/** Tests whether the stream transfer value is greater than the specified value.
1.153 +
1.154 +@param aLength The length to compared. In debug mode, the function raises
1.155 +a STORE-Stream 13 panic, if this value is negative.
1.156 +@return True, if the stream transfer value is greater than the specified value;
1.157 +false, otherwise. */
1.158 + {
1.159 +#if defined (_DEBUG)
1.160 + __DbgChkNonNegative(aLength);
1.161 +#endif
1.162 + return TUint(iVal)>TUint(aLength);
1.163 + }
1.164 +inline TStreamTransfer TStreamTransfer::operator-(TInt aLength) const
1.165 +/** Subtracts the specified value from the stream transfer value.
1.166 +
1.167 +If this stream transfer object was originally constructed as an unlimited
1.168 +type, i.e. using the TStreamTransfer(TUnlimited) constructor, then this operator
1.169 +does not change the state of the object, and it remains an unlimited type.
1.170 +
1.171 +@param aLength The length to be subtracted. In debug mode, the function raises
1.172 +a STORE-Stream 13 panic, if this value is negative.
1.173 +@return A stream transfer object containing the result of the subtraction. */
1.174 + {
1.175 +#if defined (_DEBUG)
1.176 + __DbgChkNonNegative(aLength);
1.177 +#endif
1.178 + return iVal<0?*this:TStreamTransfer(iVal-aLength);
1.179 + }
1.180 +inline TInt TStreamTransfer::operator[](TInt aMaxLength) const
1.181 + {return *this>aMaxLength?aMaxLength:iVal;}
1.182 +inline TStreamTransfer& TStreamTransfer::operator-=(TInt aLength)
1.183 +/** Subtracts the specified value from the stream transfer value, updating this
1.184 +stream transfer object.
1.185 +
1.186 +If this stream transfer object was originally constructed as an unlimited
1.187 +type, i.e. using the TStreamTransfer(TUnlimited) constructor, then this operator
1.188 +does not change the state of the object, and it remains an unlimited type.
1.189 +
1.190 +If this stream transfer object was not an unlimited type, then, in debug mode,
1.191 +the function raises a STORE-Stream 13 panic, if the result of the calculation
1.192 +is negative.
1.193 +
1.194 +@param aLength The length to be subtracted. In debug mode, the function raises
1.195 +a STORE-Stream 13 panic, if this value is negative.
1.196 +@return A reference to this stream transfer object. */
1.197 + {
1.198 +#if defined (_DEBUG)
1.199 + __DbgChkNonNegative(aLength);
1.200 +#endif
1.201 + if (iVal>=0)
1.202 + {
1.203 + iVal-=aLength;
1.204 +#if defined (_DEBUG)
1.205 + __DbgChkNonNegative(iVal);
1.206 +#endif
1.207 + }
1.208 + return *this;
1.209 + }
1.210 +inline TInt TStreamTransfer::Left() const
1.211 +/** Gets the stream transfer value.
1.212 +
1.213 +@return The current stream transfer value. */
1.214 + {
1.215 +#if defined (_DEBUG)
1.216 + __DbgChkNonNegative(iVal);
1.217 +#endif
1.218 + return iVal;
1.219 + }
1.220 +inline TBool operator==(TInt aLength,TStreamTransfer aTransfer)
1.221 + {return aTransfer==aLength;}
1.222 +inline TBool operator<(TInt aLength,TStreamTransfer aTransfer)
1.223 + {return aTransfer>aLength;}
1.224 +
1.225 +// Class MStreamBuf
1.226 +inline void MStreamBuf::Release()
1.227 +/** Frees resources before abandoning the stream buffer.
1.228 +
1.229 +The function calls the virtual function DoRelease() to implement this behaviour.
1.230 +
1.231 +Release() is called by both RReadStream::Release() and RWriteStream::Release().
1.232 +
1.233 +@see MStreamBuf::DoRelease()
1.234 +@see RReadStream::Release()
1.235 +@see RWriteStream::Release() */
1.236 + {DoRelease();}
1.237 +inline void MStreamBuf::SynchL()
1.238 +/** Synchronises the stream buffer with the stream, leaving if any error occurs.
1.239 +
1.240 +In effect, this ensures that buffered data is delivered to the stream.
1.241 +
1.242 +The function calls the virtual function DoSynchL() to implement this behaviour.
1.243 +
1.244 +@see MStreamBuf::DoSynchL() */
1.245 + {DoSynchL();}
1.246 +inline TInt MStreamBuf::ReadL(TAny* aPtr,TInt aMaxLength)
1.247 +/** Reads data from the stream buffer into the specified memory location.
1.248 +
1.249 +The function calls the virtual function DoReadL(TAny*,TInt) to implement this
1.250 +behaviour.
1.251 +
1.252 +@param aPtr A pointer to the target memory location for the data read from
1.253 +the stream buffer.
1.254 +@param aMaxLength The maximum number of bytes to be read.
1.255 +@return The number of bytes read.
1.256 +@see MStreamBuf::DoReadL() */
1.257 + {return DoReadL(aPtr,aMaxLength);}
1.258 +inline TInt MStreamBuf::ReadL(TDes8& aDes,TInt aMaxLength,TRequestStatus& aStatus)
1.259 +/** Reads data, asynchronously, from the stream buffer into the specified descriptor.
1.260 +
1.261 +The function calls the virtual function DoReadL(TDes8&,TInt,TRequestStatus&)
1.262 +to implement this behaviour.
1.263 +
1.264 +If the function leaves, then no read request will have been initiated.
1.265 +
1.266 +@param aDes The target descriptor for the data read from the stream buffer.
1.267 +@param aMaxLength The maximum number of bytes to be read.
1.268 +@param aStatus The request status that indicates the completion status of this
1.269 +asynchronous request.
1.270 +@return The maximum number of bytes to be read, as used in this request. This
1.271 +can be different to the value supplied in aMaxLength; this is dependent on
1.272 +the implementation.
1.273 +@see MStreamBuf::DoReadL() */
1.274 + {return DoReadL(aDes,aMaxLength,aStatus);}
1.275 +inline TStreamTransfer MStreamBuf::ReadL(MStreamInput& anInput,TStreamTransfer aTransfer)
1.276 +/** Reads data from the stream buffer into the specified data sink.
1.277 +
1.278 +The function calls the virtual function DoReadL(MStreamInput&,TStreamTransfer)
1.279 +to implement this behaviour.
1.280 +
1.281 +@param anInput The data sink that is the target for the read operation.
1.282 +@param aTransfer Defines the amount of data available to be read.
1.283 +@return The amount of data that was not consumed. */
1.284 + {return DoReadL(anInput,aTransfer);}
1.285 +inline void MStreamBuf::ReadL(MStreamInput& anInput)
1.286 +/** Reads data from the stream buffer into the specified data sink.
1.287 +
1.288 +The function uses the virtual function DoReadL(MStreamInput&,TStreamTransfer)
1.289 +to implement this behaviour.
1.290 +
1.291 +No explicit limit is placed on the amount of data that can be read.
1.292 +
1.293 +@param anInput The data sink that is the target for the read operation. */
1.294 + {DoReadL(anInput,KStreamUnlimited);}
1.295 +inline void MStreamBuf::WriteL(const TAny* aPtr,TInt aLength)
1.296 +/** Writes data from the specified memory location into the stream buffer.
1.297 +
1.298 +The function calls the virtual function DoWriteL(TAny*,TInt) to implement
1.299 +this behaviour.
1.300 +
1.301 +@param aPtr A pointer to the memory location from which data is to be written
1.302 +to the stream buffer.
1.303 +@param aLength The number of bytes to be written.
1.304 +@see MStreamBuf::DoWriteL() */
1.305 + {DoWriteL(aPtr,aLength);}
1.306 +inline TInt MStreamBuf::WriteL(const TDesC8& aDes,TInt aMaxLength,TRequestStatus& aStatus)
1.307 +/** Writes data, asynchronously, from the specified descriptor into the stream buffer.
1.308 +
1.309 +The function calls the virtual function DoWriteL(const TDesC8&,TInt,TRequestStatus&)
1.310 +to implement this behaviour.
1.311 +
1.312 +If the function leaves, then no write request will have been initiated.
1.313 +
1.314 +@param aDes The source descriptor for the data to be written into the stream
1.315 +buffer.
1.316 +@param aMaxLength The maximum number of bytes to be written.
1.317 +@param aStatus The request status that indicates the completion status of this
1.318 +asynchronous request.
1.319 +@return The maximum number of bytes to be written, as used in this request.
1.320 +This can be different to the value supplied in aMaxLength; this is dependent
1.321 +on the implementation.
1.322 +@see MStreamBuf::DoWriteL() */
1.323 + {return DoWriteL(aDes,aMaxLength,aStatus);}
1.324 +inline TStreamTransfer MStreamBuf::WriteL(MStreamOutput& anOutput,TStreamTransfer aTransfer)
1.325 +/** Writes data into the stream buffer from the specified data source.
1.326 +
1.327 +The function calls the virtual function DoWriteL(MStreamOutput&,TStreamTransfer)
1.328 +to implement this behaviour.
1.329 +
1.330 +@param anOutput The data source for the write operation.
1.331 +@param aTransfer Defines the amount of data to be pulled from the output stream
1.332 +object.
1.333 +@return A stream transfer object defining the amount of data that was not consumed. */
1.334 + {return DoWriteL(anOutput,aTransfer);}
1.335 +inline void MStreamBuf::WriteL(MStreamOutput& anOutput)
1.336 +/**Writes data into the stream buffer from the specified data source.
1.337 +
1.338 +The function calls the virtual function DoWriteL(MStreamOutput&,TStreamTransfer) to implement this behaviour.
1.339 +
1.340 +No explicit limit is placed on the amount of data that can be written.
1.341 +
1.342 +@param anOutput The data source for the write operation.
1.343 +@param aMaxLength The maximum amount of data available to be written.
1.344 +*/
1.345 + {DoWriteL(anOutput,KStreamUnlimited);}
1.346 +inline void MStreamBuf::SeekL(TMark aMark,TStreamPos aPos)
1.347 +/**Moves the position of the read or write mark in the stream.
1.348 +
1.349 +The new position is calculated by adding the specified value to the position of the beginning of the stream.
1.350 +
1.351 +The function calls virtual function DoSeekL(TMark,TStreamLocation,TInt) to implement this behaviour.
1.352 +Notes:
1.353 +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.
1.354 +Not all streams are seekable.
1.355 +
1.356 +@param aMark The type of mark, i.e. read or write.
1.357 +@param aLocation A stream position value on which the calculation of the new position is based.
1.358 +*/
1.359 + {DoSeekL(aMark,EStreamBeginning,aPos.Offset());}
1.360 +inline TStreamPos MStreamBuf::SeekL(TMark aMark,TStreamLocation aLocation,TInt anOffset)
1.361 +/** Moves the position of the read mark or the write mark in the stream.
1.362 +
1.363 +The new position is calculated by adding the specified offset to one of:
1.364 +
1.365 +the position of the beginning of the stream
1.366 +
1.367 +the position of the end of the stream
1.368 +
1.369 +the position of the current read mark or write mark.
1.370 +
1.371 +The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt)
1.372 +to implement this behaviour.
1.373 +
1.374 +As there are two current positions, one for the read mark and one for the
1.375 +write mark, it is not valid, in general, to use a single call to SeekL() to
1.376 +move both the read and write marks.
1.377 +
1.378 +Not all streams are seekable.
1.379 +
1.380 +@param aMark The type of mark, i.e read or write.
1.381 +@param aLocation The location in the stream on which the calculation of the
1.382 +new position is based.
1.383 +@param anOffset The offset value.
1.384 +@return The new stream position of the read or write mark. */
1.385 + {return DoSeekL(aMark,aLocation,anOffset);}
1.386 +inline TStreamPos MStreamBuf::SeekL(TRead,TStreamLocation aLocation,TInt anOffset)
1.387 +/** Moves the position of the read mark in the stream.
1.388 +
1.389 +The new position is calculated by adding the specified offset to one of:
1.390 +
1.391 +the position of the beginning of the stream
1.392 +
1.393 +the position of the end of the stream
1.394 +
1.395 +the position of the current read mark.
1.396 +
1.397 +The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt)
1.398 +to implement this behaviour.
1.399 +
1.400 +Not all streams are seekable.
1.401 +
1.402 +@param (The enumerator value is not used)
1.403 +@param aLocation The location in the stream on which the calculation of the
1.404 +new position is based.
1.405 +@param anOffset The offset value.
1.406 +@return The new stream position of the read mark. */
1.407 + {return DoSeekL(ERead,aLocation,anOffset);}
1.408 +inline TStreamPos MStreamBuf::SeekL(TWrite,TStreamLocation aLocation,TInt anOffset)
1.409 +/** Moves the position of the write mark in the stream.
1.410 +
1.411 +The new position is calculated by adding the specified offset to one of:
1.412 +
1.413 +the position of the beginning of the stream
1.414 +
1.415 +the position of the end of the stream
1.416 +
1.417 +the position of the current write mark.
1.418 +
1.419 +The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt)
1.420 +to implement this behaviour.
1.421 +
1.422 +Not all streams are seekable.
1.423 +
1.424 +@param (The enumerator value is not used)
1.425 +@param aLocation The location in the stream on which the calculation of the
1.426 +new position is based.
1.427 +@param anOffset The offset value.
1.428 +@return The new stream position of the write mark. */
1.429 + {return DoSeekL(EWrite,aLocation,anOffset);}
1.430 +inline TStreamPos MStreamBuf::SeekL(TRead,TInt anOffset)
1.431 +/** Moves the position of the read mark in the stream by the specified offset.
1.432 +
1.433 +The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt)
1.434 +to implement this behaviour.
1.435 +
1.436 +Not all streams are seekable.
1.437 +
1.438 +@param (The enumerator value is not used)
1.439 +@param anOffset The amount by which the position of the read mark is to be
1.440 +moved relative to the existing position of the read mark.
1.441 +@return The new stream position of the read mark. */
1.442 + {return DoSeekL(ERead,EStreamMark,anOffset);}
1.443 +inline TStreamPos MStreamBuf::SeekL(TWrite,TInt anOffset)
1.444 +/** Moves the position of the write mark in the stream by the specified offset.
1.445 +
1.446 +The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt)
1.447 +to implement this behaviour.
1.448 +
1.449 +Not all streams are seekable.
1.450 +
1.451 +@param (The enumerator value is not used)
1.452 +@param anOffset The amount by which the position of the write mark is to be
1.453 +moved relative to the existing position of the write mark.
1.454 +@return The new stream position of the write mark. */
1.455 + {return DoSeekL(EWrite,EStreamMark,anOffset);}
1.456 +inline TStreamPos MStreamBuf::TellL(TRead) const
1.457 +/** Gets the position of the read mark within the stream.
1.458 +
1.459 +The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt)
1.460 +to implement this behaviour.
1.461 +
1.462 +@param (The enumerator value is not used).
1.463 +@return The stream position. */
1.464 + {return CONST_CAST(MStreamBuf*,this)->DoSeekL(ERead,EStreamMark,0);}
1.465 +inline TStreamPos MStreamBuf::TellL(TWrite) const
1.466 +/** Gets the position of the write mark within the stream.
1.467 +
1.468 +The function calls the virtual function DoSeekL(TMark,TStreamLocation,TInt)
1.469 +to implement this behaviour.
1.470 +
1.471 +@param (The enumerator value is not used).
1.472 +@return The stream position. */
1.473 + {return CONST_CAST(MStreamBuf*,this)->DoSeekL(EWrite,EStreamMark,0);}
1.474 +inline TInt MStreamBuf::SizeL() const
1.475 +/** Gets the size of the stream.
1.476 +
1.477 +@return The size of the stream, in bytes. */
1.478 + {return CONST_CAST(MStreamBuf*,this)->DoSeekL(0,EStreamEnd,0).Offset();}
1.479 +
1.480 +// Class TStreamBuf
1.481 +inline void TStreamBuf::SetBuf(TRead,TUint8* aPtr,TUint8* anEnd)
1.482 +/** Sets the start and end points of the read area within the intermediate buffer.
1.483 +
1.484 +A start point is always within an area; an end point is always the first byte
1.485 +beyond the end of an area.
1.486 +
1.487 +@param (The enumerator is not used).
1.488 +@param aPtr The start point.
1.489 +@param anEnd The end point.
1.490 +@see MStreamBuf::TRead */
1.491 + {iRPtr=aPtr;iREnd=anEnd;}
1.492 +inline void TStreamBuf::SetBuf(TWrite,TUint8* aPtr,TUint8* anEnd)
1.493 +/** Sets the start and end points of the write area within the intermediate buffer.
1.494 +
1.495 +A start point is always within an area; an end point is always the first byte
1.496 +beyond the end of an area.
1.497 +
1.498 +@param (The enumerator is not used).
1.499 +@param aPtr The start point.
1.500 +@param anEnd The end point.
1.501 +@see MStreamBuf::TWrite */
1.502 + {iWPtr=aPtr;iWEnd=anEnd;}
1.503 +inline void TStreamBuf::SetPtr(TRead,TUint8* aPtr)
1.504 +/** Sets the start point of the write area within the intermediate buffer.
1.505 +
1.506 +A start point is always within an area.
1.507 +
1.508 +@param (The enumerator is not used).
1.509 +@param aPtr The start point.
1.510 +@see MStreamBuf::TWrite */
1.511 + {iRPtr=aPtr;}
1.512 +inline void TStreamBuf::SetPtr(TWrite,TUint8* aPtr)
1.513 +/** Sets the start point of the write area within the intermediate buffer.
1.514 +
1.515 +A start point is always within an area.
1.516 +
1.517 +@param (The enumerator is not used).
1.518 +@param aPtr The start point.
1.519 +@see MStreamBuf::TWrite */
1.520 + {iWPtr=aPtr;}
1.521 +inline void TStreamBuf::SetEnd(TRead,TUint8* anEnd)
1.522 + {iREnd=anEnd;}
1.523 +inline void TStreamBuf::SetEnd(TWrite,TUint8* anEnd)
1.524 + {iWEnd=anEnd;}
1.525 +inline TUint8* TStreamBuf::Ptr(TRead) const
1.526 +/** Gets the current start point of the read area within the intermediate buffer.
1.527 +
1.528 +@param (The enumerator is not used).
1.529 +@return The start point.
1.530 +@see MStreamBuf::TRead */
1.531 + {return iRPtr;}
1.532 +inline TUint8* TStreamBuf::Ptr(TWrite) const
1.533 +/** Gets the current start point of the write area within the intermediate buffer.
1.534 +
1.535 +@param (The enumerator is not used).
1.536 +@return The start point.
1.537 +@see MStreamBuf::TWrite */
1.538 + {return iWPtr;}
1.539 +inline TUint8* TStreamBuf::End(TRead) const
1.540 +/** Gets the current end point of the read area within the intermediate buffer.
1.541 +
1.542 +An end point is always the first byte beyond the end of an area.
1.543 +
1.544 +@param (The enumerator is not used).
1.545 +@return The end point.
1.546 +@see MStreamBuf::TRead */
1.547 + {return iREnd;}
1.548 +inline TUint8* TStreamBuf::End(TWrite) const
1.549 +/** Gets the current end point of the write area within the intermediate buffer.
1.550 +
1.551 +An end point is always the first byte beyond the end of an area.
1.552 +
1.553 +@param (The enumerator is not used).
1.554 +@return The end point.
1.555 +@see MStreamBuf::TWrite */
1.556 + {return iWEnd;}
1.557 +inline TInt TStreamBuf::Avail(TRead) const
1.558 +/** Gets the number of bytes available in the read area within the intermediate
1.559 +buffer.
1.560 +
1.561 +@param (The enumerator is not used).
1.562 +@return The number of bytes available.
1.563 +@see MStreamBuf::TRead */
1.564 + {return iREnd-iRPtr;}
1.565 +inline TInt TStreamBuf::Avail(TWrite) const
1.566 +/** Gets the number of bytes available in the write area within the intermediate
1.567 +buffer.
1.568 +
1.569 +@param (The enumerator is not used).
1.570 +@return The number of bytes available.
1.571 +@see MStreamBuf::TWrite */
1.572 + {return iWEnd-iWPtr;}
1.573 +
1.574 +// Class TStreamFilter
1.575 +inline void TStreamFilter::Set(MStreamBuf* aHost,TInt aMode)
1.576 +/** Sets up the filter to use the specified host for streamed data.
1.577 +
1.578 +Taking ownership of the host stream buffer means that calls to SynchL() propagate
1.579 +to the host buffer after the filter has flushed its data, and that when the
1.580 +filter is released it also releases the host buffer.
1.581 +
1.582 +@param aHost The host for the streamed data - a stream buffer.
1.583 +@param aMode The mode in which the stream buffer is to be used. It can be used
1.584 +in either read or write modes, represented by ERead and EWrite, but not both
1.585 +at the same time. In debug mode, setting both raises a STORE-Stream 18 panic.
1.586 +In addition, specify EAttached to indicate that the filter should take ownership
1.587 +of the host stream buffer.
1.588 +@see MStreamBuf::TRead
1.589 +@see MStreamBuf::TWrite */
1.590 + {
1.591 +#if defined (_DEBUG)
1.592 + __DbgChkMode(aMode);
1.593 +#endif
1.594 + iHost=aHost;iMode=aMode;
1.595 + }
1.596 +inline void TStreamFilter::Committed()
1.597 +/** Flags the streamed data as committed. */
1.598 + {iMode&=~EWrite;}
1.599 +inline TBool TStreamFilter::IsCommitted() const
1.600 +/** Tests whether the streamed data is committed.
1.601 +
1.602 +@return True, if streamed data is committed; false, otherwise. */
1.603 + {return iHost==NULL||!(iMode&EWrite);}
1.604 +