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