os/security/contentmgmt/referencedrmagent/contentiterator/contentIterator.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/contentmgmt/referencedrmagent/contentiterator/contentIterator.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,123 @@
     1.4 +/*
     1.5 +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + @file
    1.24 + @publishedPartner
    1.25 + @released
    1.26 +*/
    1.27 +
    1.28 +
    1.29 +#ifndef __CAF_CONTENTITERATOR_H__
    1.30 +#define __CAF_CONTENTITERATOR_H__
    1.31 +
    1.32 +#include <e32base.h>
    1.33 +#include <apmstd.h>
    1.34 +#include <caf/caftypes.h>
    1.35 +
    1.36 +namespace ContentAccess 
    1.37 +	{
    1.38 +	class CContentIteratorData;
    1.39 +	class TVirtualPathPtr;
    1.40 +	
    1.41 +	/** This class can be used to asynchronously search through directories
    1.42 +	on the files system to find content with a particular mime type
    1.43 +	
    1.44 +	This class creates a thread that is used to search recursively. It uses
    1.45 +	a considerable amount of memory and should be destroyed as soon as it
    1.46 +	is no longer needed.
    1.47 +	 
    1.48 +	It must work in a thread rather than as a server so the CAF agents can
    1.49 +	perform capability checking against the client process. It uses a thread
    1.50 +	because it is recursive and could lead to a stack overflow if the recursion
    1.51 +	occurred in the client thread
    1.52 +	
    1.53 +	Since CContentIterator is an active object clients should not 
    1.54 +	use the User::WaitForRequest() API since it will not give 
    1.55 +	CContentIterator::RunL() a chance to run.
    1.56 +	
    1.57 +	@publishedPartner
    1.58 +	@released
    1.59 +	*/
    1.60 +	class CContentIterator : public CActive
    1.61 +		{
    1.62 +	public:
    1.63 +	
    1.64 +		/** Create a CContentIterator
    1.65 +		
    1.66 +		@param aPath The path to search for content
    1.67 +		@param aRecursive ETrue to recursively search within directories
    1.68 +		@param aMimeType The mime type to search for, a zero length descriptor can be used as a wildcard to find all content
    1.69 +		@return a new CContentIterator
    1.70 +		*/
    1.71 +		IMPORT_C static CContentIterator* NewL(const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType);
    1.72 +
    1.73 +		/** Destructor */
    1.74 +		virtual ~CContentIterator();
    1.75 +
    1.76 +		/** Find the next content object
    1.77 +		
    1.78 +		Clients should not use the User::WaitForRequest() API when calling 
    1.79 +		the Next() function since it will not give CContentIterator's RunL() 
    1.80 +		a chance to run.
    1.81 +		
    1.82 +		@param aStatus Request to complete when the next content item is found or KErrNotFound if no further content was found
    1.83 +		*/
    1.84 +		IMPORT_C void Next(TRequestStatus &aStatus);
    1.85 +
    1.86 +		/** The name of the file containing the content object found in the most recent call to Next()
    1.87 +	
    1.88 +		@return The name of the file
    1.89 +		*/
    1.90 +		IMPORT_C TVirtualPathPtr VirtualPath();
    1.91 +
    1.92 +		/** The mime type of the content object found in the most recent call to Next()
    1.93 +	
    1.94 +		@return The name of the file
    1.95 +		*/
    1.96 +		IMPORT_C const TDesC8& MimeType();
    1.97 +
    1.98 +		/** The name of the content object found in the most recent call to Next()
    1.99 +	
   1.100 +		@return The name of the content object
   1.101 +		*/
   1.102 +		IMPORT_C const TDesC& Name();
   1.103 +
   1.104 +
   1.105 +	protected:
   1.106 +		virtual void DoCancel();
   1.107 +		virtual void RunL();
   1.108 +			
   1.109 +	private:
   1.110 +		CContentIterator();
   1.111 +		void ConstructL(const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType);
   1.112 +		
   1.113 +		static TInt ThreadEntry(TAny* aAny);
   1.114 +	
   1.115 +	private:
   1.116 +		TBuf8 <KMaxDataTypeLength> iMimeType;
   1.117 +		TFileName iFileName;
   1.118 +		TBuf <KMaxCafContentName> iName;
   1.119 +		TBuf <KMaxCafUniqueId> iUniqueId;
   1.120 +	
   1.121 +		RThread iWorkerThread;	
   1.122 +		CContentIteratorData* info;
   1.123 +		};
   1.124 +	}
   1.125 +
   1.126 +#endif