sl@0: // Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include "UT_STD.H" sl@0: sl@0: #pragma BullseyeCoverage off sl@0: sl@0: // sl@0: // Panic the process with STORE-Store as the category. sl@0: // sl@0: GLDEF_C void Panic(TStorePanic aPanic) sl@0: { sl@0: _LIT(KCategory,"STORE-Store"); sl@0: User::Panic(KCategory,aPanic); sl@0: } sl@0: sl@0: #pragma BullseyeCoverage on sl@0: sl@0: EXPORT_C void TStreamId::InternalizeL(RReadStream& aStream) sl@0: /** Internalises an object of this class from a read stream. sl@0: sl@0: The presence of this function means that the standard templated operator>>() sl@0: can be used to internalise objects of this class. sl@0: sl@0: Note that the function has assignment semantics. It replaces the old value sl@0: of the object with a new value read from the read stream. sl@0: sl@0: @param aStream Stream from which the object should be internalised. */ sl@0: { sl@0: aStream>>iVal; sl@0: if (iVal>KMaxStreamIdValue) sl@0: __LEAVE(KErrCorrupt); sl@0: } sl@0: sl@0: EXPORT_C void MIncrementalCollector::DoRelease() sl@0: /** Implementation of the public Release() function. This signals that client has sl@0: no further need of the object and all necessary clean-up should be done. e.g. sl@0: if the implementation object is allocated on the heap, it could be deleted. */ sl@0: {} sl@0: sl@0: EXPORT_C void MIncrementalCollector::DoNextL(TPckgBuf& aStep,TRequestStatus& aStatus,TPckgBuf& aTotal) sl@0: /** Implementation of the public asynchronous NextL() function. The default implementation sl@0: invokes the synchronous form of DoNextL() and then reports the result by signalling sl@0: the request status. sl@0: sl@0: @param aStep The progress value from either the last NextL() increment of sl@0: from ResetL() if the reclamation/compaction was restarted. On return, sl@0: should contain the new progress value, which can be used in subsequent calls sl@0: to NextL(). This must be equal to, or less than, the previous value a sl@0: zero value must be used to indicate that the operation is complete. sl@0: @param aStatus A status variable. KErrNone on successful completion, otherwise sl@0: another of the system-wide error codes. sl@0: @param aTotal On return, should contain the total amount of free space in the sl@0: store. */ sl@0: { sl@0: DoNextL(aStep(),aTotal()); sl@0: TRequestStatus* stat=&aStatus; sl@0: User::RequestComplete(stat,KErrNone); sl@0: } sl@0: sl@0: HDirectStoreBuf* HDirectStoreBuf::CreateL(TStreamExchange& aHost,TStreamId& anId,TInt aMode) sl@0: // sl@0: // Create a stream buffer for a new 'direct' stream. sl@0: // sl@0: { sl@0: TInt size=aHost.SizeL(); sl@0: HDirectStoreBuf* buf=NewL(aHost,size,aMode); sl@0: anId=TStreamId(size); sl@0: return buf; sl@0: } sl@0: sl@0: HDirectStoreBuf* HDirectStoreBuf::OpenL(TStreamExchange& aHost,TStreamId anId,TInt aMode) sl@0: // sl@0: // Create a stream buffer for an existing 'direct' stream. sl@0: // sl@0: { sl@0: HDirectStoreBuf* buf=NewL(aHost,anId.Value(),aMode); sl@0: return buf; sl@0: } sl@0: sl@0: HDirectStoreBuf* HDirectStoreBuf::NewL(TStreamExchange& aHost,TInt anOffset,TInt aMode) sl@0: { sl@0: HDirectStoreBuf* buf=new(ELeave) HDirectStoreBuf(anOffset); sl@0: buf->Open(aHost,TStreamPos(anOffset),aMode); sl@0: return buf; sl@0: } sl@0: sl@0: void HDirectStoreBuf::DoRelease() sl@0: // sl@0: // Finished with this stream buffer. sl@0: // sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: TStreamPos HDirectStoreBuf::DoSeekL(TMark aMark,TStreamLocation aLocation,TInt anOffset) sl@0: // sl@0: // Position the mark(s) indicated by aMark at anOffset from aLocation. sl@0: // sl@0: { sl@0: TInt off=iOff; sl@0: if (aLocation==EStreamBeginning) sl@0: anOffset+=off; sl@0: return RShareBuf::DoSeekL(aMark,aLocation,anOffset)-off; sl@0: } sl@0: sl@0: EXPORT_C void TStreamId::__DbgChkRange(TUint32 aValue) sl@0: // sl@0: // Check for values out of range. sl@0: // sl@0: { sl@0: __ASSERT_ALWAYS(aValue<=KMaxStreamIdValue,Panic(EStoreIdOutOfRange)); sl@0: } sl@0: