Update contrib.
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
26 #ifndef __CAF_CONTENTITERATOR_H__
27 #define __CAF_CONTENTITERATOR_H__
31 #include <caf/caftypes.h>
33 namespace ContentAccess
35 class CContentIteratorData;
36 class TVirtualPathPtr;
38 /** This class can be used to asynchronously search through directories
39 on the files system to find content with a particular mime type
41 This class creates a thread that is used to search recursively. It uses
42 a considerable amount of memory and should be destroyed as soon as it
45 It must work in a thread rather than as a server so the CAF agents can
46 perform capability checking against the client process. It uses a thread
47 because it is recursive and could lead to a stack overflow if the recursion
48 occurred in the client thread
50 Since CContentIterator is an active object clients should not
51 use the User::WaitForRequest() API since it will not give
52 CContentIterator::RunL() a chance to run.
57 class CContentIterator : public CActive
61 /** Create a CContentIterator
63 @param aPath The path to search for content
64 @param aRecursive ETrue to recursively search within directories
65 @param aMimeType The mime type to search for, a zero length descriptor can be used as a wildcard to find all content
66 @return a new CContentIterator
68 IMPORT_C static CContentIterator* NewL(const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType);
71 virtual ~CContentIterator();
73 /** Find the next content object
75 Clients should not use the User::WaitForRequest() API when calling
76 the Next() function since it will not give CContentIterator's RunL()
79 @param aStatus Request to complete when the next content item is found or KErrNotFound if no further content was found
81 IMPORT_C void Next(TRequestStatus &aStatus);
83 /** The name of the file containing the content object found in the most recent call to Next()
85 @return The name of the file
87 IMPORT_C TVirtualPathPtr VirtualPath();
89 /** The mime type of the content object found in the most recent call to Next()
91 @return The name of the file
93 IMPORT_C const TDesC8& MimeType();
95 /** The name of the content object found in the most recent call to Next()
97 @return The name of the content object
99 IMPORT_C const TDesC& Name();
103 virtual void DoCancel();
108 void ConstructL(const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType);
110 static TInt ThreadEntry(TAny* aAny);
113 TBuf8 <KMaxDataTypeLength> iMimeType;
115 TBuf <KMaxCafContentName> iName;
116 TBuf <KMaxCafUniqueId> iUniqueId;
118 RThread iWorkerThread;
119 CContentIteratorData* info;