diff -r 000000000000 -r 08ec8eefde2f persistentstorage/dbms/sdbms/SD_UTL.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/persistentstorage/dbms/sdbms/SD_UTL.CPP Fri Jan 22 11:06:30 2010 +0200 @@ -0,0 +1,166 @@ +// 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 "SD_STD.H" + +GLDEF_C void Panic(TDbsPanic aPanic) +// +// Panic the client +// + { + _LIT(KCategory,"DBMS-server"); + Dbms::Panic(KCategory,aPanic); + } + +// Class Dbms + +EXPORT_C void Dbms::Panic(const TDesC& aCategory,TInt aCode) +// +// Panic the client +// Outside of the server this calls User::Panic, within it calls the server and LEAVES! +// + { + __TRACE(aCategory); + __TRACE(aCode); + CDbsServer* server=CDbsServer::Instance(); + if (server) + { + server->Panic(aCategory,aCode); + __LEAVE(KDbsLeavePanic); + } + else + User::Panic(aCategory,aCode); + } + +// streaming functions + +GLDEF_C void ExternalizeL(const TDbCol& aCol,RWriteStream& aStream) + { + aStream<=0) + { + aStream>>name; + col.iType=TDbColType(aStream.ReadUint8L()); + col.iMaxLength=aStream.ReadInt32L(); + col.iAttributes=aStream.ReadUint8L(); + aColSet.AddL(col); + } + } + +GLDEF_C void ExternalizeL(const CDbKey& aKey,RWriteStream& aStream) + { + TInt cc=aKey.Count(); + aStream.WriteInt32L(cc); + for (TInt ii=0;ii=0) + { + aStream>>name; + TUint8 uInt = aStream.ReadUint8L(); + col.iOrder=TDbKeyCol::TOrder(uInt); + col.iLength=aStream.ReadInt32L(); + aKey.AddL(col); + } + aKey.SetComparison(TDbTextComparison(aStream.ReadUint8L())); + if (aStream.ReadUint8L()) + aKey.MakeUnique(); + } + +GLDEF_C void ExternalizeL(const CDbNames& aNames,RWriteStream& aStream) + { + TInt cc=aNames.Count(); + aStream.WriteInt32L(cc); + for (TInt ii=0;ii=0) + { + aStream>>name; + aNames.AddL(name); + } + } + +/** +A helper function, used in +"RWriteStream& operator<<(RWriteStream& aStream,const CDbStrings& aStrings)". +@internalComponent +*/ +GLDEF_C void ExternalizeL(const CDbStrings& aStrings,RWriteStream& aStream) + { + TInt cc=aStrings.Count(); + aStream.WriteInt32L(cc); + for (TInt ii=0;ii TDbString; + +/** +A helper function, used in +"RReadStream& operator>>(RReadStream& aStream,CDbStrings& aStrings)". +@internalComponent +*/ +GLDEF_C void InternalizeL(CDbStrings& aStrings,RReadStream& aStream) + { + __ASSERT(aStrings.Count()==0); + TDbString str; + TInt cc=aStream.ReadInt32L(); + while (--cc>=0) + { + aStream>>str; + aStrings.AddL(str); + } + }