os/security/contentmgmt/referencedrmagent/contentiterator/FileContentIteratorBase.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 /**
    20  @file
    21  @internalComponent
    22  @released
    23 */
    24 
    25 
    26 #ifndef __FILECONTENTITERATORBASE_H__
    27 #define __FILECONTENTITERATORBASE_H__
    28 
    29 #include <e32base.h>
    30 
    31 #include "StreamablePtrArray.h"
    32 #include "ContentIteratorInterface.h"
    33 #include <caf/virtualpathptr.h>
    34 
    35 class CDir;
    36 
    37 namespace ContentAccess 
    38 	{
    39 	class CContent;
    40 	class CManager;
    41 	class CEmbeddedObject;
    42 
    43 	/** Internal class used to recursively iterate over all files in a path and then
    44 	iterate into all content objects inside each file
    45 
    46 	@internalComponent
    47 	@released
    48 	*/
    49 	NONSHARABLE_CLASS(CFileContentIteratorBase) : public MContentIterator
    50 		{
    51 	public:
    52 		virtual ~CFileContentIteratorBase();
    53 		
    54 		// MContentIterator
    55 		virtual const TDesC& FileName() const;
    56 		virtual const TDesC& UniqueId() const;
    57 		virtual const TDesC& Name() const;
    58 		virtual const TDesC8& MimeType() const;
    59 		virtual TInt Next();
    60 		
    61 	private:
    62 		// Only ever created by CFileContentIterator
    63 		friend class CFileContentIterator;
    64 
    65 		/** Create a content iterator for a particular path in the file system
    66 		@param aPath The path to search under
    67 		@param aRecursive Whether to explore sub-directories under the given path
    68 		@param aMimeType The mime type to search for. Finds content objects of any mime types if this parameter is omitted
    69 		@leave KErrNotFound If no suitable content objects were found inside the given path
    70 		*/
    71 		static CFileContentIteratorBase* NewL(CManager &aManager, const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType = KNullDesC8);
    72 
    73 		CFileContentIteratorBase(CManager& aManager, const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType);
    74 		void ConstructL();
    75 
    76 		// Construction parameters
    77 		CManager& iManager;
    78 		const TDesC& iPath;
    79 		TBool iRecursive;
    80 		const TDesC8& iMimeType;
    81 
    82 		MContentIterator* iSubIterator;
    83 		
    84 		// Index into the directory list
    85 		TInt iDirIndex;
    86 		TInt iFileIndex;
    87 
    88 		// List of files and directories inside (iPath)
    89 		CDir* iCurrentDirectoryList;
    90 		CDir* iCurrentFileList;
    91 		
    92 		// Used to store the path of the subdirectory we are exploring
    93 		HBufC* iNewPath;
    94 		};
    95 	}
    96 
    97 #endif