diff -r 000000000000 -r 08ec8eefde2f persistentstorage/store/USTOR/UT_SWZ.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/store/USTOR/UT_SWZ.CPP Fri Jan 22 11:06:30 2010 +0200 @@ -0,0 +1,90 @@ +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "UT_STD.H" + +EXPORT_C TStreamId TSwizzleCBase::AsId() const +/** Gets the streamid of the represented object. + +This swizzle must currently represent the object as a stream id, otherwise +the function raises a STORE-Store 3 panic. + +@return The stream id of the represented object */ + { + __ASSERT_ALWAYS(IsId(),Panic(EStoreSwizzleBadId)); + return iPtr==NULL?KNullStreamId:TStreamId((TUint32)iPtr>>1); // implementation dependency + } + +EXPORT_C void TSwizzleCBase::InternalizeL(RReadStream& aStream) +/** Internalises a stream id from the read stream, constructs a swizzle from this +stream id and copies the swizzle to this swizzle. + +The presence of this function means that the standard templated operator>>() +can be used to internalise objects of this class. + +@param aStream Stream from which the stream id should be internalised */ + { + TStreamId id; + aStream>>id; + *this=TSwizzleCBase(id); + } + +EXPORT_C TSwizzleCBase::TSwizzleCBase(TStreamId anId) +// +// Construct from a stream id. +// + : iPtr(anId==KNullStreamId?NULL:(TAny*)((anId.Value()<<1)|0x1)) + {} + +EXPORT_C void TSwizzleCBase::DoExternalizeL(RWriteStream& aStream,TExternalizer anExter) const +// +// Write this swizzle to aStream as an out-of-stream reference. +// + { + aStream<