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: @file sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: sl@0: sl@0: #ifndef __FILECONTENTITERATORBASE_H__ sl@0: #define __FILECONTENTITERATORBASE_H__ sl@0: sl@0: #include sl@0: sl@0: #include "StreamablePtrArray.h" sl@0: #include "ContentIteratorInterface.h" sl@0: #include sl@0: sl@0: class CDir; sl@0: sl@0: namespace ContentAccess sl@0: { sl@0: class CContent; sl@0: class CManager; sl@0: class CEmbeddedObject; sl@0: sl@0: /** Internal class used to recursively iterate over all files in a path and then sl@0: iterate into all content objects inside each file sl@0: sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: NONSHARABLE_CLASS(CFileContentIteratorBase) : public MContentIterator sl@0: { sl@0: public: sl@0: virtual ~CFileContentIteratorBase(); sl@0: sl@0: // MContentIterator sl@0: virtual const TDesC& FileName() const; sl@0: virtual const TDesC& UniqueId() const; sl@0: virtual const TDesC& Name() const; sl@0: virtual const TDesC8& MimeType() const; sl@0: virtual TInt Next(); sl@0: sl@0: private: sl@0: // Only ever created by CFileContentIterator sl@0: friend class CFileContentIterator; sl@0: sl@0: /** Create a content iterator for a particular path in the file system sl@0: @param aPath The path to search under sl@0: @param aRecursive Whether to explore sub-directories under the given path sl@0: @param aMimeType The mime type to search for. Finds content objects of any mime types if this parameter is omitted sl@0: @leave KErrNotFound If no suitable content objects were found inside the given path sl@0: */ sl@0: static CFileContentIteratorBase* NewL(CManager &aManager, const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType = KNullDesC8); sl@0: sl@0: CFileContentIteratorBase(CManager& aManager, const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType); sl@0: void ConstructL(); sl@0: sl@0: // Construction parameters sl@0: CManager& iManager; sl@0: const TDesC& iPath; sl@0: TBool iRecursive; sl@0: const TDesC8& iMimeType; sl@0: sl@0: MContentIterator* iSubIterator; sl@0: sl@0: // Index into the directory list sl@0: TInt iDirIndex; sl@0: TInt iFileIndex; sl@0: sl@0: // List of files and directories inside (iPath) sl@0: CDir* iCurrentDirectoryList; sl@0: CDir* iCurrentFileList; sl@0: sl@0: // Used to store the path of the subdirectory we are exploring sl@0: HBufC* iNewPath; sl@0: }; sl@0: } sl@0: sl@0: #endif