diff -r 491b3ed49290 -r 65326cf895ed filemanager/src/fmbkupengine/src/CMMCScBkupFileListCollection.cpp --- a/filemanager/src/fmbkupengine/src/CMMCScBkupFileListCollection.cpp Tue Aug 31 15:06:05 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -/* -* Copyright (c) 2005-2008 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: CMMCScBkupFileListCollection implementation -* -* -*/ - -#include "CMMCScBkupFileListCollection.h" - -#include -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupDataOwnerInfo.h" -#ifdef RD_FILE_MANAGER_BACKUP -#include -#include "BkupEngine.hrh" -#include "pathconfiguration.hrh" -#endif - -// Constants -const TInt KMMCScBkupDataOwnerGranularity = 50; - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::CMMCScBkupFileListCollection() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupFileListCollection::CMMCScBkupFileListCollection( TBitFlags aCategory, - RFs& aFsSession ) - :iEntries(KMMCScBkupDataOwnerGranularity), - iCategory( aCategory ), - iFsSession( aFsSession ) - { - } - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::~CMMCScBkupFileListCollection() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupFileListCollection::~CMMCScBkupFileListCollection() - { - Reset(); - iEntries.Close(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupFileListCollection::ConstructL() - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupFileListCollection* CMMCScBkupFileListCollection::NewL( TBitFlags aCategory, - RFs& aFsSession ) - { - CMMCScBkupFileListCollection* self = new(ELeave) CMMCScBkupFileListCollection( aCategory, aFsSession ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::AppendL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupFileListCollection::AppendL( const RArray& aArray, RArray< const CMMCScBkupFileInfo* >& aAddedItems, TSecureId aAssociatedSID ) - { - const TInt count = aArray.Count(); - - __LOG2("CMMCScBkupFileListCollection::AppendL() - Number of files %d to check for category %x", count, Category().Value() ); - - for(TInt i=0; i comparer( CMMCScBkupFileInfo::OrderByFileName ); - const TInt indexIfFound = iEntries.FindInOrder( fileInfo, comparer ); - if (indexIfFound < 0) - { - // Item wasn't found - insert it in sorted order - AppendL( fileInfo ); - CleanupStack::Pop( fileInfo ); - - __LOG1("CMMCScBkupFileListCollection::AppendL() - Adding file %S", &fileInfo->FileName() ); - - // Add a copy to our return array. - aAddedItems.AppendL( fileInfo ); - } - else - { - // Duplicate, discard - __LOG1("CMMCScBkupFileListCollection::AppendL() - Duplicate file %S", &fileInfo->FileName() ); - CleanupStack::PopAndDestroy( fileInfo ); - } - } - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::AppendL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupFileListCollection::AppendL( CMMCScBkupFileInfo* aFileInfo ) - { - TLinearOrder comparer( CMMCScBkupFileInfo::OrderByFileName ); - iEntries.InsertInOrderL( aFileInfo, comparer ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::Count() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupFileListCollection::Count() const - { - return iEntries.Count(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::Entry() -// -// -// --------------------------------------------------------------------------- -const CMMCScBkupFileInfo& CMMCScBkupFileListCollection::Entry(TInt aIndex) const - { - const CMMCScBkupFileInfo& entry = *iEntries[aIndex]; - return entry; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::Remove() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupFileListCollection::Remove( TInt aIndex ) - { - CMMCScBkupFileInfo* entry = iEntries[aIndex]; - delete entry; - iEntries.Remove(aIndex); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::Reset() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupFileListCollection::Reset() - { - iEntries.ResetAndDestroy(); - } -