sl@0: // Copyright (c) 2004-2009 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 "srvparams.h" sl@0: sl@0: inline void TRepositoryBackupStreamIndexElement::Set (TUid aUid, TStreamId aSettingsStream, TStreamId aDeletedSettingsStream, TStreamId aInstalledSettingsStream) sl@0: { sl@0: iUid = aUid; sl@0: iSettingsStream = aSettingsStream ; sl@0: iDeletedSettingsStream = aDeletedSettingsStream; sl@0: iInstalledSettingsStream = aInstalledSettingsStream; sl@0: } sl@0: sl@0: inline void TRepositoryBackupStreamIndexElement::Get (TUid& aUid, TStreamId& aSettingsStreamId, TStreamId& aDeletedSettingsStreamId, TStreamId& aInstalledSettingsStream) sl@0: { sl@0: aUid = iUid; sl@0: aSettingsStreamId = iSettingsStream; sl@0: aDeletedSettingsStreamId = iDeletedSettingsStream ; sl@0: aInstalledSettingsStream = iInstalledSettingsStream ; sl@0: } sl@0: sl@0: inline void TRepositoryBackupStreamIndexElement::ExternalizeL(RWriteStream& aStream) const sl@0: { sl@0: aStream << iUid ; sl@0: aStream << iSettingsStream ; sl@0: aStream << iDeletedSettingsStream ; sl@0: aStream << iInstalledSettingsStream ; sl@0: } sl@0: sl@0: inline void TRepositoryBackupStreamIndexElement::InternalizeL(RReadStream& aStream, TUint32 aBackupStreamExtensions) sl@0: { sl@0: TUint32 intUid ; sl@0: aStream >> intUid ; sl@0: iUid.iUid = intUid ; sl@0: aStream >> iSettingsStream ; sl@0: if (aBackupStreamExtensions & EDeletedKeysSupported) sl@0: { sl@0: aStream >> iDeletedSettingsStream ; sl@0: } sl@0: if (aBackupStreamExtensions & EInstalledKeysSupported) sl@0: { sl@0: aStream >> iInstalledSettingsStream ; sl@0: } sl@0: sl@0: } sl@0: sl@0: sl@0: inline CRepositoryBackupStreamIndex* CRepositoryBackupStreamIndex::NewL() sl@0: { sl@0: return new (ELeave) CRepositoryBackupStreamIndex ; sl@0: } sl@0: sl@0: inline CRepositoryBackupStreamIndex* CRepositoryBackupStreamIndex::NewLC() sl@0: { sl@0: CRepositoryBackupStreamIndex* self = CRepositoryBackupStreamIndex::NewL(); sl@0: CleanupStack::PushL(self) ; sl@0: return self ; sl@0: } sl@0: sl@0: inline CRepositoryBackupStreamIndex::~CRepositoryBackupStreamIndex() sl@0: { sl@0: iStreamIndex.Close() ; sl@0: } sl@0: sl@0: inline void CRepositoryBackupStreamIndex::Close(void) sl@0: { sl@0: iStreamIndex.Close() ; sl@0: } sl@0: sl@0: inline void CRepositoryBackupStreamIndex::Reset() sl@0: { sl@0: iIndex = 0; sl@0: } sl@0: sl@0: inline void CRepositoryBackupStreamIndex::ExternalizeL(RWriteStream& aStream) const sl@0: { sl@0: TCardinality nElements = iStreamIndex.Count() ; sl@0: aStream << nElements ; sl@0: for (int i = 0; i < nElements; i++) sl@0: { sl@0: aStream << iStreamIndex[i] ; sl@0: } sl@0: } sl@0: sl@0: inline void CRepositoryBackupStreamIndex::InternalizeL(RReadStream& aStream, TUint32 aBackupStreamExtensions) sl@0: { sl@0: TCardinality nElements ; sl@0: aStream >> nElements ; sl@0: sl@0: TRepositoryBackupStreamIndexElement indexElement ; sl@0: iStreamIndex.ReserveL(nElements); sl@0: for (int i = 0; i < nElements; i++) sl@0: { sl@0: indexElement.InternalizeL(aStream, aBackupStreamExtensions); sl@0: iStreamIndex.AppendL(indexElement); sl@0: } sl@0: } sl@0: sl@0: sl@0: inline TRepositoryBackupStreamHeader::TRepositoryBackupStreamHeader(TStreamId aIndexStreamId) : iBackupStreamUid(KServerUid3), iBackupStreamVersion(KBackupStreamVersion), iIndexStreamId(aIndexStreamId), iBackupExtensionsSupported(KBackupExtensionsSupported) sl@0: { sl@0: iReserved1 = 0 ; sl@0: iReserved2 = 0 ; sl@0: iReserved3 = 0 ; sl@0: iReserved4 = 0 ; sl@0: } sl@0: sl@0: inline TRepositoryBackupStreamHeader::TRepositoryBackupStreamHeader() sl@0: { sl@0: iReserved1 = 0 ; sl@0: iReserved2 = 0 ; sl@0: iReserved3 = 0 ; sl@0: iReserved4 = 0 ; sl@0: } sl@0: sl@0: inline void TRepositoryBackupStreamHeader::ExternalizeL(RWriteStream& aStream) const sl@0: { sl@0: aStream << iBackupStreamUid ; sl@0: aStream << iBackupStreamVersion ; sl@0: aStream << iIndexStreamId ; sl@0: aStream << iBackupExtensionsSupported ; sl@0: aStream << iReserved1 ; sl@0: aStream << iReserved2 ; sl@0: aStream << iReserved3 ; sl@0: aStream << iReserved4 ; sl@0: } sl@0: sl@0: inline void TRepositoryBackupStreamHeader::InternalizeL(RReadStream& aStream) sl@0: { sl@0: aStream >> iBackupStreamUid ; sl@0: aStream >> iBackupStreamVersion ; sl@0: if ((iBackupStreamUid != KServerUid3) || sl@0: (iBackupStreamVersion > KBackupStreamVersion)) sl@0: { sl@0: // No valid header found in stream - bail out before we sl@0: // read off the end of the stream! sl@0: User::Leave(KErrNotSupported) ; sl@0: } sl@0: sl@0: aStream >> iIndexStreamId ; sl@0: aStream >> iBackupExtensionsSupported ; sl@0: aStream >> iReserved1 ; sl@0: aStream >> iReserved2 ; sl@0: aStream >> iReserved3 ; sl@0: aStream >> iReserved4 ; sl@0: } sl@0: sl@0: inline TUid TRepositoryBackupStreamHeader::getUid() sl@0: { sl@0: return iBackupStreamUid ; sl@0: } sl@0: sl@0: inline TStreamId TRepositoryBackupStreamHeader::getIndexStreamId() sl@0: { sl@0: return iIndexStreamId ; sl@0: } sl@0: sl@0: inline TUint32 TRepositoryBackupStreamHeader::getVersion() sl@0: { sl@0: return iBackupStreamVersion ; sl@0: } sl@0: sl@0: inline TUint32 TRepositoryBackupStreamHeader::getBackupExtensionsSupported() sl@0: { sl@0: return iBackupExtensionsSupported ; sl@0: }