Update contrib.
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "srvparams.h"
18 inline void TRepositoryBackupStreamIndexElement::Set (TUid aUid, TStreamId aSettingsStream, TStreamId aDeletedSettingsStream, TStreamId aInstalledSettingsStream)
21 iSettingsStream = aSettingsStream ;
22 iDeletedSettingsStream = aDeletedSettingsStream;
23 iInstalledSettingsStream = aInstalledSettingsStream;
26 inline void TRepositoryBackupStreamIndexElement::Get (TUid& aUid, TStreamId& aSettingsStreamId, TStreamId& aDeletedSettingsStreamId, TStreamId& aInstalledSettingsStream)
29 aSettingsStreamId = iSettingsStream;
30 aDeletedSettingsStreamId = iDeletedSettingsStream ;
31 aInstalledSettingsStream = iInstalledSettingsStream ;
34 inline void TRepositoryBackupStreamIndexElement::ExternalizeL(RWriteStream& aStream) const
37 aStream << iSettingsStream ;
38 aStream << iDeletedSettingsStream ;
39 aStream << iInstalledSettingsStream ;
42 inline void TRepositoryBackupStreamIndexElement::InternalizeL(RReadStream& aStream, TUint32 aBackupStreamExtensions)
47 aStream >> iSettingsStream ;
48 if (aBackupStreamExtensions & EDeletedKeysSupported)
50 aStream >> iDeletedSettingsStream ;
52 if (aBackupStreamExtensions & EInstalledKeysSupported)
54 aStream >> iInstalledSettingsStream ;
60 inline CRepositoryBackupStreamIndex* CRepositoryBackupStreamIndex::NewL()
62 return new (ELeave) CRepositoryBackupStreamIndex ;
65 inline CRepositoryBackupStreamIndex* CRepositoryBackupStreamIndex::NewLC()
67 CRepositoryBackupStreamIndex* self = CRepositoryBackupStreamIndex::NewL();
68 CleanupStack::PushL(self) ;
72 inline CRepositoryBackupStreamIndex::~CRepositoryBackupStreamIndex()
74 iStreamIndex.Close() ;
77 inline void CRepositoryBackupStreamIndex::Close(void)
79 iStreamIndex.Close() ;
82 inline void CRepositoryBackupStreamIndex::Reset()
87 inline void CRepositoryBackupStreamIndex::ExternalizeL(RWriteStream& aStream) const
89 TCardinality nElements = iStreamIndex.Count() ;
90 aStream << nElements ;
91 for (int i = 0; i < nElements; i++)
93 aStream << iStreamIndex[i] ;
97 inline void CRepositoryBackupStreamIndex::InternalizeL(RReadStream& aStream, TUint32 aBackupStreamExtensions)
99 TCardinality nElements ;
100 aStream >> nElements ;
102 TRepositoryBackupStreamIndexElement indexElement ;
103 iStreamIndex.ReserveL(nElements);
104 for (int i = 0; i < nElements; i++)
106 indexElement.InternalizeL(aStream, aBackupStreamExtensions);
107 iStreamIndex.AppendL(indexElement);
112 inline TRepositoryBackupStreamHeader::TRepositoryBackupStreamHeader(TStreamId aIndexStreamId) : iBackupStreamUid(KServerUid3), iBackupStreamVersion(KBackupStreamVersion), iIndexStreamId(aIndexStreamId), iBackupExtensionsSupported(KBackupExtensionsSupported)
120 inline TRepositoryBackupStreamHeader::TRepositoryBackupStreamHeader()
128 inline void TRepositoryBackupStreamHeader::ExternalizeL(RWriteStream& aStream) const
130 aStream << iBackupStreamUid ;
131 aStream << iBackupStreamVersion ;
132 aStream << iIndexStreamId ;
133 aStream << iBackupExtensionsSupported ;
134 aStream << iReserved1 ;
135 aStream << iReserved2 ;
136 aStream << iReserved3 ;
137 aStream << iReserved4 ;
140 inline void TRepositoryBackupStreamHeader::InternalizeL(RReadStream& aStream)
142 aStream >> iBackupStreamUid ;
143 aStream >> iBackupStreamVersion ;
144 if ((iBackupStreamUid != KServerUid3) ||
145 (iBackupStreamVersion > KBackupStreamVersion))
147 // No valid header found in stream - bail out before we
148 // read off the end of the stream!
149 User::Leave(KErrNotSupported) ;
152 aStream >> iIndexStreamId ;
153 aStream >> iBackupExtensionsSupported ;
154 aStream >> iReserved1 ;
155 aStream >> iReserved2 ;
156 aStream >> iReserved3 ;
157 aStream >> iReserved4 ;
160 inline TUid TRepositoryBackupStreamHeader::getUid()
162 return iBackupStreamUid ;
165 inline TStreamId TRepositoryBackupStreamHeader::getIndexStreamId()
167 return iIndexStreamId ;
170 inline TUint32 TRepositoryBackupStreamHeader::getVersion()
172 return iBackupStreamVersion ;
175 inline TUint32 TRepositoryBackupStreamHeader::getBackupExtensionsSupported()
177 return iBackupExtensionsSupported ;