os/persistentdata/persistentstorage/store/USTRM/US_STRM.CPP
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/store/USTRM/US_STRM.CPP	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,511 @@
     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 +#include "US_STD.H"
    1.20 +
    1.21 +EXPORT_C void RReadStream::Release()
    1.22 +/** Frees resources before abandoning the stream.
    1.23 +
    1.24 +Note that, if a cleanup item for the stream was placed on the cleanup stack 
    1.25 +when the stream was opened by a call to OpenLC(), then this function need 
    1.26 +not be called explicitly; clean up is implicitly done by CleanupStack::PopAndDestroy(). */
    1.27 +	{
    1.28 +	if (iSrc==NULL)
    1.29 +		return;
    1.30 +//
    1.31 +	iSrc->Release();
    1.32 +	iSrc=NULL;
    1.33 +	}
    1.34 +
    1.35 +EXPORT_C void RReadStream::PushL()
    1.36 +/** Puts a cleanup item for this read stream object onto the cleanup stack. This 
    1.37 +allows allocated resources to be cleaned up if a subsequent leave occurs. */
    1.38 +	{
    1.39 +	CleanupReleasePushL(*this);
    1.40 +	}
    1.41 +
    1.42 +EXPORT_C void RReadStream::ReadL(TDes8& aDes)
    1.43 +/** Reads sufficient data from this stream to fill the specified 8 bit descriptor up to its maximum length.
    1.44 +No other information is read from this read stream.
    1.45 +
    1.46 +@param aDes A reference to a modifiable descriptor which is to receive the data read from this stream. Passing the build 
    1.47 +independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit or the 16 bit) at build time.*/
    1.48 +	{
    1.49 +	ReadL(aDes,aDes.MaxLength());
    1.50 +	}
    1.51 +
    1.52 +EXPORT_C void RReadStream::ReadL(TDes8& aDes,TInt aLength)
    1.53 +/** Reads data of specified length from this stream into the specified 8 bit descriptor. No other information is read 
    1.54 +from this stream.
    1.55 +
    1.56 +@param aDes A reference to a modifiable type descriptor which is to receive the data read from this stream. 
    1.57 +Passing the build independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit 
    1.58 +or the 16 bit) at build time.
    1.59 +@param aLength The length of data to be read from this stream. This value must be non-negative and must not be greater than the maximum length of the descriptor otherwise the function raises a USER 11 panic.*/
    1.60 +	{
    1.61 +	__ASSERT_DEBUG(aLength<=aDes.MaxLength(),Panic(EStreamReadBeyondEnd));
    1.62 +	aDes.SetLength(aLength);
    1.63 +	ReadL((TUint8*)aDes.Ptr(),aLength);
    1.64 +	}
    1.65 +
    1.66 +EXPORT_C void RReadStream::ReadL(TDes8& aDes,TChar aDelim)
    1.67 +/** Reads data from this stream into the 8 bit descriptor, until either the specified delimiter is encountered or the descriptor is filled to its maximum length.
    1.68 +The resulting data in aDes always includes the delimiter aDelim, if aDes is large enough.
    1.69 +
    1.70 +@param aDes A reference to a modifiable type descriptor which is to receive the data read from this stream. Passing 
    1.71 +the build independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit or the 16 bit) at build time.
    1.72 +@param aDelim The delimiter marking the end of the data in the stream.*/
    1.73 +
    1.74 +	{
    1.75 +	__ASSERT_DEBUG(iSrc!=NULL,Panic(EStreamNotOpen));
    1.76 +	TUint8* ptr=(TUint8*)aDes.Ptr();
    1.77 +	TDelimitedInput8 input(ptr,aDes.MaxLength(),aDelim);
    1.78 +	do
    1.79 +		{
    1.80 +		iSrc->ReadL(input);
    1.81 +		} while (!input.Done());
    1.82 +	aDes.SetLength(input.Ptr()-ptr);
    1.83 +	}
    1.84 +
    1.85 +EXPORT_C void RReadStream::ReadL(TUint8* aPtr,TInt aLength)
    1.86 +/** Reads data of specified length from this stream into the location defined by the specified TUint8 pointer.
    1.87 +
    1.88 +@param aPtr The target location for the streamed in data.
    1.89 +@param aLength The length of data to be streamed in.*/
    1.90 +	{
    1.91 +	__ASSERT_DEBUG(aLength>=0,Panic(EStreamReadLengthNegative));
    1.92 +	if (aLength==0)
    1.93 +		return;
    1.94 +//
    1.95 +	__ASSERT_DEBUG(iSrc!=NULL,Panic(EStreamNotOpen));
    1.96 +	TInt len=iSrc->ReadL(aPtr,aLength);
    1.97 +	__ASSERT_DEBUG(len>=0&&len<=aLength,Panic(EStreamReadInBreach));
    1.98 +	if (len<aLength)
    1.99 +		__LEAVE(KErrEof);
   1.100 +	}
   1.101 +
   1.102 +EXPORT_C void RReadStream::ReadL(TInt aLength)
   1.103 +/** Discards data of specified length read from this stream.
   1.104 +
   1.105 +@param aLength The length of data to be discarded from this read stream.*/
   1.106 +	{
   1.107 +	__ASSERT_DEBUG(aLength>=0,Panic(EStreamReadLengthNegative));
   1.108 +	if (aLength==0)
   1.109 +		return;
   1.110 +//
   1.111 +	__ASSERT_DEBUG(iSrc!=NULL,Panic(EStreamNotOpen));
   1.112 +	TNullInput input;
   1.113 +	TInt len=iSrc->ReadL(input,aLength);
   1.114 +	__ASSERT_DEBUG(len>=0&&len<=aLength,Panic(EStreamReadInBreach));
   1.115 +	if (len<aLength)
   1.116 +		__LEAVE(KErrEof);
   1.117 +	}
   1.118 +
   1.119 +EXPORT_C void RReadStream::ReadL(TDes16& aDes)
   1.120 +/** Reads sufficient data from this stream to fill the specified 16 bit descriptor up to its maximum length. 
   1.121 +No other information is read from this read stream.
   1.122 +
   1.123 +@param aDes A reference to a modifiable type descriptor which is to receive the data read from this stream. Passing 
   1.124 +the build independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit or the 16 
   1.125 +bit) at build time.*/
   1.126 +	{
   1.127 +	ReadL(aDes,aDes.MaxLength());
   1.128 +	}
   1.129 +
   1.130 +EXPORT_C void RReadStream::ReadL(TDes16& aDes,TInt aLength)
   1.131 +/** Reads data of specified length from this stream into the specified 16 bit descriptor. No other information is read from this stream.
   1.132 +
   1.133 +@param aDes A reference to a modifiable type descriptor which is to receive the data read from this stream. Passing the 
   1.134 +build independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit or the 16 bit) 
   1.135 +at build time.
   1.136 +@param aLength The length of data to be read from this stream. This value must be non-negative and must not be greater
   1.137 +than the maximum length of the descriptor otherwise the function raises a USER 11 panic.*/
   1.138 +	{
   1.139 +	__ASSERT_DEBUG(aLength<=aDes.MaxLength(),Panic(EStreamReadBeyondEnd));
   1.140 +	aDes.SetLength(aLength);
   1.141 +	ReadL((TUint16*)aDes.Ptr(),aLength);
   1.142 +	}
   1.143 +
   1.144 +EXPORT_C void RReadStream::ReadL(TDes16& aDes,TChar aDelim)
   1.145 +/** Reads data from this stream into the 16 bit descriptor, until either the specified delimiter is encountered or 
   1.146 +the descriptor is filled to its maximum length.
   1.147 +The resulting data in aDes always includes the delimiter aDelim, if aDes is large enough.
   1.148 +
   1.149 +@param aDes A reference to a modifiable type descriptor which is to receive the data read from this stream. Passing 
   1.150 +the build independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit or the 16 bit) at build time.
   1.151 +@param aDelim The delimiter marking the end of the data in the stream.*/
   1.152 +	{
   1.153 +	__ASSERT_DEBUG(iSrc!=NULL,Panic(EStreamNotOpen));
   1.154 +	TUint16* ptr=(TUint16*)aDes.Ptr();
   1.155 +	TDelimitedInput16 input(ptr,aDes.MaxLength(),aDelim);
   1.156 +	do
   1.157 +		{
   1.158 +		iSrc->ReadL(input);
   1.159 +		} while (!input.Done());
   1.160 +	aDes.SetLength(input.Ptr()-ptr);
   1.161 +	}
   1.162 +
   1.163 +EXPORT_C void RReadStream::ReadL(TUint16* aPtr,TInt aLength)
   1.164 +/** Reads data of specified length from this stream into the specified 16 bit descriptor.
   1.165 + No other information is read from this stream.
   1.166 +
   1.167 +@param aDes A reference to a modifiable type descriptor which is to receive the data read from this stream. Passing the build independent type TDes& allows the compiler to choose the appropriate ReadL() variant (i.e the 8 bit or the 16 bit) at build time.
   1.168 +@param aLength The length of data to be read from this stream. This value must be non-negative and must not be greater than the maximum length of the descriptor otherwise the function raises a USER 11 panic.*/
   1.169 +	{
   1.170 +	__ASSERT_DEBUG(aLength>=0,Panic(EStreamReadLengthNegative));
   1.171 +	ReadL((TUint8*)aPtr,aLength<<1); // platform dependency
   1.172 +	}
   1.173 +
   1.174 +EXPORT_C TInt8 RReadStream::ReadInt8L()
   1.175 +/** Internalises a TInt8 value The function reads an 8 bit value from this stream 
   1.176 +and interprets it as a TInt8.
   1.177 +
   1.178 +@return The 8 bit value read from this stream. */
   1.179 +	{
   1.180 +	TInt8 val;
   1.181 +	ReadL((TUint8*)&val,1); // platform dependency
   1.182 +	return val;
   1.183 +	}
   1.184 +
   1.185 +EXPORT_C TInt16 RReadStream::ReadInt16L()
   1.186 +/** Internalises a TInt16 value. The function reads a 16 bit value from this stream 
   1.187 +and interprets it as a TInt16.
   1.188 +
   1.189 +@return The 16 bit value read from this stream. */
   1.190 +	{
   1.191 +	TInt16 val;
   1.192 +	ReadL((TUint8*)&val,2); // platform dependency
   1.193 +	return val;
   1.194 +	}
   1.195 +
   1.196 +EXPORT_C TInt32 RReadStream::ReadInt32L()
   1.197 +/** Internalises a TInt32 value. The function reads a 32 bit value from this stream 
   1.198 +and interprets it as a TInt32.
   1.199 +
   1.200 +@return The 32 bit value read from this stream. */
   1.201 +	{
   1.202 +	TInt32 val;
   1.203 +	ReadL((TUint8*)&val,4); // platform dependency
   1.204 +	return val;
   1.205 +	}
   1.206 +
   1.207 +EXPORT_C TUint8 RReadStream::ReadUint8L()
   1.208 +/** Internalises a TUint8 value. The function reads an 8 bit value from this stream 
   1.209 +and interprets it as a TUint8.
   1.210 +
   1.211 +@return The 8 bit value read from this stream. */
   1.212 +	{
   1.213 +	TUint8 val;
   1.214 +	ReadL(&val,1);
   1.215 +	return val;
   1.216 +	}
   1.217 +
   1.218 +EXPORT_C TUint16 RReadStream::ReadUint16L()
   1.219 +/** Internalises a TUint16 value. The function reads a 16 bit value from this 
   1.220 +stream and interprets it as a TUint16.
   1.221 +
   1.222 +@return The 16 bit value read from this stream. */
   1.223 +	{
   1.224 +	TUint16 val;
   1.225 +	ReadL((TUint8*)&val,2); // platform dependency
   1.226 +	return val;
   1.227 +	}
   1.228 +
   1.229 +EXPORT_C TUint32 RReadStream::ReadUint32L()
   1.230 +/** Internalises a TUint32 value. The function reads a 32 bit value from this 
   1.231 +stream and interprets it as a TUint32.
   1.232 +
   1.233 +@return The 32 bit value read from this stream. */
   1.234 +	{
   1.235 +	TUint32 val;
   1.236 +	ReadL((TUint8*)&val,4); // platform dependency
   1.237 +	return val;
   1.238 +	}
   1.239 +
   1.240 +EXPORT_C TReal32 RReadStream::ReadReal32L() __SOFTFP
   1.241 +/** Internalises a TReal32 value. The function reads a 32 bit value from this 
   1.242 +stream and interprets it as a TReal32.
   1.243 +
   1.244 +@return The 32 bit value read from this read stream. */
   1.245 +	{
   1.246 +	TReal32 val;
   1.247 +	ReadL((TUint8*)&val,4); // platform dependency
   1.248 +	return val;
   1.249 +	}
   1.250 +
   1.251 +EXPORT_C TReal64 RReadStream::ReadReal64L() __SOFTFP
   1.252 +/** Internalises a TReal64 value. The function reads a 64 bit value from this 
   1.253 +stream and interprets it as a TReal64.
   1.254 +
   1.255 +@return The 64 bit value read from this stream. */
   1.256 +	{
   1.257 +#if defined(__DOUBLE_WORDS_SWAPPED__)
   1.258 +	union {TReal64 val;TUint32 buf[3];} u; // platform dependency
   1.259 +	ReadL((TUint8*)&u.buf[1],8);
   1.260 +	u.buf[0]=u.buf[2];
   1.261 +	return u.val;
   1.262 +#else
   1.263 +	TReal64 val;
   1.264 +	ReadL((TUint8*)&val,8); // platform dependency
   1.265 +	return val;
   1.266 +#endif
   1.267 +	}
   1.268 +
   1.269 +EXPORT_C void RWriteStream::Close()
   1.270 +/** Commits data to the stream before freeing resources used by the stream. This 
   1.271 +ensures that any buffered data is written to the stream.
   1.272 +
   1.273 +Note that the function cannot leave. Any errors arising from the attempt to 
   1.274 +commit data to the stream are ignored. */
   1.275 +	{
   1.276 +	if (iSnk==NULL)
   1.277 +		return;
   1.278 +//
   1.279 +	iSnk->Close();
   1.280 +	iSnk=NULL;
   1.281 +	}
   1.282 +
   1.283 +EXPORT_C void RWriteStream::Release()
   1.284 +/** Frees resources before abandoning the stream. The function is called after 
   1.285 +data has been committed to the stream.
   1.286 +
   1.287 +Note that if a cleanup item for the stream was placed on the cleanup stack 
   1.288 +when the stream was opened (e.g by a call to RStoreWriteStreamss CreateLC(), 
   1.289 +OpenLC(), ReplaceLC() or RDictionaryStores AssignLC() etc), then this function 
   1.290 +need not be called explicitly; clean up is implicitly done by CleanupStack::PopAndDestroy(). */
   1.291 +	{
   1.292 +	if (iSnk==NULL)
   1.293 +		return;
   1.294 +//
   1.295 +	iSnk->Release();
   1.296 +	iSnk=NULL;
   1.297 +	}
   1.298 +
   1.299 +EXPORT_C void RWriteStream::CommitL()
   1.300 +/** Ensures that any buffered data is written to the stream. Once committed, it 
   1.301 +is not possible to roll back the newly written data. */
   1.302 +	{
   1.303 +	if (iSnk==NULL)
   1.304 +		return;
   1.305 +//
   1.306 +	iSnk->SynchL();
   1.307 +	}
   1.308 +
   1.309 +EXPORT_C void RWriteStream::PushL()
   1.310 +/** Puts a cleanup item for this write stream object onto the cleanup stack. This 
   1.311 +allows allocated resources to be cleaned up if a subsequent leave occurs. */
   1.312 +	{
   1.313 +	CleanupReleasePushL(*this);
   1.314 +	}
   1.315 +
   1.316 +EXPORT_C void RWriteStream::WriteL(const TDesC8& aDes)
   1.317 +/** Writes the content of the 8 bit descriptor to the stream. No other information 
   1.318 +is written to this write stream.
   1.319 +
   1.320 +@param aDes A reference to a descriptor. Passing the build independent type 
   1.321 +TDesC& allows the compiler to choose the appropriate WriteL() variant (i.e 
   1.322 +the 8 bit or the 16 bit) at build time. */
   1.323 +	{
   1.324 +	WriteL(aDes.Ptr(),aDes.Length());
   1.325 +	}
   1.326 +
   1.327 +EXPORT_C void RWriteStream::WriteL(const TDesC8& aDes,TInt aLength)
   1.328 +/** Writes data of the specified length from the 8 bit descriptor to the stream. 
   1.329 +No other information is written to this write stream.
   1.330 +
   1.331 +@param aDes A reference to a descriptor. Passing the build independent type 
   1.332 +TDesC& allows the compiler to choose the appropriate WriteL() variant (i.e 
   1.333 +the 8 bit or the 16 bit) at build time.
   1.334 +@param aLength The length of data to be written to this stream. */
   1.335 +
   1.336 +	{
   1.337 +	__ASSERT_DEBUG(aLength<=aDes.Length(),Panic(EStreamWriteBeyondEnd));
   1.338 +	WriteL(aDes.Ptr(),aLength);
   1.339 +	}
   1.340 +
   1.341 +EXPORT_C void RWriteStream::WriteL(const TUint8* aPtr,TInt aLength)
   1.342 +/** Writes 8 bit data of the specified length from the specified location to this 
   1.343 +write stream.
   1.344 +
   1.345 +@param aPtr The location from where data is to be streamed out.
   1.346 +@param aLength The length of data to be streamed out. */
   1.347 +
   1.348 +	{
   1.349 +	__ASSERT_DEBUG(aLength>=0,Panic(EStreamWriteLengthNegative));
   1.350 +	if (aLength==0)
   1.351 +		return;
   1.352 +//
   1.353 +	__ASSERT_DEBUG(iSnk!=NULL,Panic(EStreamNotOpen));
   1.354 +	iSnk->WriteL(aPtr,aLength);
   1.355 +	}
   1.356 +
   1.357 +EXPORT_C void RWriteStream::WriteL(RReadStream &aStream)
   1.358 +/** Writes the content of the specified read stream to this write stream.
   1.359 +
   1.360 +@param aStream A reference to a read stream which is to be written to this 
   1.361 +stream. */
   1.362 +
   1.363 +	{
   1.364 +	__ASSERT_DEBUG(iSnk!=NULL,Panic(EStreamNotOpen));
   1.365 +	TSourceOutput output(aStream.iSrc);
   1.366 +	iSnk->WriteL(output);
   1.367 +	}
   1.368 +
   1.369 +EXPORT_C void RWriteStream::WriteL(RReadStream& aStream,TInt aLength)
   1.370 +/** Writes data of the specified length from the specified read stream to this 
   1.371 +stream.
   1.372 +
   1.373 +@param aStream A reference to a read stream part of whose content is to be 
   1.374 +written to this stream.
   1.375 +@param aLength The length of data from the read stream to be written to this 
   1.376 +write stream. */
   1.377 +
   1.378 +	{
   1.379 +	__ASSERT_DEBUG(aLength>=0,Panic(EStreamWriteLengthNegative));
   1.380 +	if (aLength==0)
   1.381 +		return;
   1.382 +//
   1.383 +	__ASSERT_DEBUG(iSnk!=NULL,Panic(EStreamNotOpen));
   1.384 +	TSourceOutput output(aStream.iSrc);
   1.385 +	TInt len=iSnk->WriteL(output,aLength);
   1.386 +	__ASSERT_DEBUG(len>=0&&len<=aLength,Panic(EStreamReadInBreach));
   1.387 +	if (len<aLength)
   1.388 +		__LEAVE(KErrEof);
   1.389 +	}
   1.390 +
   1.391 +EXPORT_C void RWriteStream::WriteL(const TDesC16& aDes)
   1.392 +/** Writes the content of the 16 bit descriptor to the stream. No other information 
   1.393 +is written to this write stream.
   1.394 +
   1.395 +@param aDes A reference to a descriptor. Passing the build independent type 
   1.396 +TDesC& allows the compiler to choose the appropriate WriteL() variant (i.e 
   1.397 +the 8 bit or the 16 bit) at build time. */
   1.398 +
   1.399 +	{
   1.400 +	WriteL(aDes.Ptr(),aDes.Length());
   1.401 +	}
   1.402 +
   1.403 +EXPORT_C void RWriteStream::WriteL(const TDesC16& aDes,TInt aLength)
   1.404 +/** Writes data of the specified length from the 16 bit descriptor to the stream. 
   1.405 +No other information is written to this write stream.
   1.406 +
   1.407 +@param aDes A reference to a descriptor. Passing the build independent type 
   1.408 +TDesC& allows the compiler to choose the appropriate WriteL() variant (i.e 
   1.409 +the 8 bit or the 16 bit) at build time.
   1.410 +@param aLength The length of data to be written to this stream. */
   1.411 +
   1.412 +	{
   1.413 +	__ASSERT_DEBUG(aLength<=aDes.Length(),Panic(EStreamWriteBeyondEnd));
   1.414 +	WriteL(aDes.Ptr(),aLength);
   1.415 +	}
   1.416 +
   1.417 +EXPORT_C void RWriteStream::WriteL(const TUint16* aPtr,TInt aLength)
   1.418 +/** Writes 16 bit data of the specified length from the specified location to this 
   1.419 +write stream.
   1.420 +
   1.421 +@param aPtr The location from where data is to be streamed out.
   1.422 +@param aLength The length of data to be streamed out. */
   1.423 +
   1.424 +	{
   1.425 +	__ASSERT_DEBUG(aLength>=0,Panic(EStreamWriteLengthNegative));
   1.426 +	WriteL((const TUint8*)aPtr,aLength<<1); // platform dependency
   1.427 +	}
   1.428 +
   1.429 +EXPORT_C void RWriteStream::WriteInt8L(TInt aValue)
   1.430 +/** Writes a TInt value as an 8 bit value to this stream.
   1.431 +
   1.432 +@param aValue The value to be written to this stream. */
   1.433 +
   1.434 +	{
   1.435 +	WriteL((const TUint8*)&aValue,1); // platform dependency
   1.436 +	}
   1.437 +
   1.438 +EXPORT_C void RWriteStream::WriteInt16L(TInt aValue)
   1.439 +/** Writes a TInt value as a 16 bit value to this stream.
   1.440 +
   1.441 +@param aValue The value to be written to this stream. */
   1.442 +	{
   1.443 +	WriteL((const TUint8*)&aValue,2); // platform dependency
   1.444 +	}
   1.445 +
   1.446 +EXPORT_C void RWriteStream::WriteInt32L(TInt32 aValue)
   1.447 +/** Writes a TInt32 value as a 32 bit value to this stream.
   1.448 +
   1.449 +@param aValue The value to be written to this stream. */
   1.450 +
   1.451 +	{
   1.452 +	WriteL((const TUint8*)&aValue,4); // platform dependency
   1.453 +	}
   1.454 +
   1.455 +EXPORT_C void RWriteStream::WriteUint8L(TUint aValue)
   1.456 +/** Writes a TUint value as an 8 bit value to this stream.
   1.457 +
   1.458 +@param aValue The value to be written to this stream. */
   1.459 +	{
   1.460 +	WriteL((const TUint8*)&aValue,1); // platform dependency
   1.461 +	}
   1.462 +
   1.463 +EXPORT_C void RWriteStream::WriteUint16L(TUint aValue)
   1.464 +/** Writes a TUint value as a 16 bit value to this stream.
   1.465 +
   1.466 +@param aValue The value to be written to this stream. */
   1.467 +
   1.468 +	{
   1.469 +	WriteL((const TUint8*)&aValue,2); // platform dependency
   1.470 +	}
   1.471 +
   1.472 +EXPORT_C void RWriteStream::WriteUint32L(TUint32 aValue)
   1.473 +/** Writes a TUint32 value as a 32 bit value to this stream.
   1.474 +
   1.475 +@param aValue The value to be written to this stream. */
   1.476 +	{
   1.477 +	WriteL((const TUint8*)&aValue,4); // platform dependency
   1.478 +	}
   1.479 +
   1.480 +EXPORT_C void RWriteStream::WriteReal32L(TReal aValue) __SOFTFP
   1.481 +/** Writes a TReal value as a 32 bit value to this stream.
   1.482 +
   1.483 +@param aValue The value to be written to this stream. */
   1.484 +
   1.485 +	{
   1.486 +	TReal32 val=TReal32(aValue);
   1.487 +	WriteL((const TUint8*)&val,4); // platform dependency
   1.488 +	}
   1.489 +
   1.490 +EXPORT_C void RWriteStream::WriteReal64L(TReal64 aValue) __SOFTFP
   1.491 +/** Writes a TReal64 value as a 64 bit value to this stream.
   1.492 +
   1.493 +@param aValue The value to be written to this stream. */
   1.494 +	{
   1.495 +#if defined(__DOUBLE_WORDS_SWAPPED__)
   1.496 +	union {TReal64 val;TUint32 buf[3];} u; // platform dependency
   1.497 +	u.val=aValue;
   1.498 +	u.buf[2]=u.buf[0];
   1.499 +	WriteL((const TUint8*)&u.buf[1],8);
   1.500 +#else
   1.501 +	WriteL((const TUint8*)&aValue,8); // platform dependency
   1.502 +#endif
   1.503 +	}
   1.504 +
   1.505 +EXPORT_C void RWriteStream::WriteRefL(TStreamRef aRef)
   1.506 +//
   1.507 +// Interpret and write aRef to this stream.
   1.508 +//
   1.509 +	{
   1.510 +	__ASSERT_DEBUG(iSnk!=NULL,Panic(EStreamNotOpen));
   1.511 +	__ASSERT_DEBUG(iExterL!=NULL,Panic(EStreamDoesNotUnderstand));
   1.512 +	(*iExterL)(aRef,*this);
   1.513 +	}
   1.514 +