sl@0: /* sl@0: * Copyright (c) 2004-2010 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 the License "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: sl@0: sl@0: sl@0: #include sl@0: #include sl@0: sl@0: #include "contentIterator.h" sl@0: #include "virtualpath.h" sl@0: #include "content.h" sl@0: #include "manager.h" sl@0: #include "EmbeddedObject.h" sl@0: #include "FileContentIterator.h" sl@0: #include "FileContentIteratorBase.h" sl@0: sl@0: using namespace ContentAccess; sl@0: sl@0: CFileContentIterator* CFileContentIterator::NewL(const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType) sl@0: { sl@0: CFileContentIterator* self = new (ELeave) CFileContentIterator(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aPath, aRecursive, aMimeType); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: void CFileContentIterator::ConstructL(const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType) sl@0: { sl@0: if(aPath.Length() == 0) sl@0: { sl@0: User::Leave(KErrPathNotFound); sl@0: } sl@0: sl@0: iPath = aPath.AllocL(); sl@0: iRecursive = aRecursive; sl@0: iMimeType = aMimeType.AllocL(); sl@0: sl@0: iManager = CManager::NewL(); sl@0: sl@0: // Find the first content object sl@0: iSubIterator = CFileContentIteratorBase::NewL(*iManager, *iPath, iRecursive, *iMimeType); sl@0: } sl@0: sl@0: CFileContentIterator::CFileContentIterator() sl@0: { sl@0: sl@0: } sl@0: CFileContentIterator::~CFileContentIterator() sl@0: { sl@0: delete iSubIterator; sl@0: delete iManager; sl@0: delete iPath; sl@0: delete iMimeType; sl@0: } sl@0: sl@0: sl@0: const TDesC& CFileContentIterator::FileName() const sl@0: { sl@0: return iSubIterator->FileName(); sl@0: } sl@0: sl@0: const TDesC& CFileContentIterator::UniqueId() const sl@0: { sl@0: return iSubIterator->UniqueId(); sl@0: } sl@0: sl@0: const TDesC& CFileContentIterator::Name() const sl@0: { sl@0: return iSubIterator->Name(); sl@0: } sl@0: sl@0: const TDesC8& CFileContentIterator::MimeType() const sl@0: { sl@0: return iSubIterator->MimeType(); sl@0: } sl@0: sl@0: TInt CFileContentIterator::Next() sl@0: { sl@0: return iSubIterator->Next(); sl@0: } sl@0: