|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #ifndef MTPFILEENUMERATOR_H |
|
22 #define MTPFILEENUMERATOR_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 |
|
27 #include "rmtpdpsingletons.h" |
|
28 #include "mtpdebug.h" |
|
29 #include "rmtpframework.h" |
|
30 |
|
31 class MMTPDataProviderFramework; |
|
32 class MMTPDataProviderFramework; |
|
33 class MMTPObjectMgr; |
|
34 class MMTPEnumerationCallback; |
|
35 class CMTPObjectMetaData; |
|
36 class CMTPFSExclusionMgr; |
|
37 |
|
38 /** |
|
39 Defines file enumerator. Enumerates all files/directories under a specified path or storage |
|
40 |
|
41 @internalTechnology |
|
42 */ |
|
43 class CMTPFSEnumerator : public CActive |
|
44 { |
|
45 public: |
|
46 IMPORT_C static CMTPFSEnumerator* NewL(MMTPDataProviderFramework& aFramework, CMTPFSExclusionMgr& aExclusionMgr, MMTPEnumerationCallback& aCallback, TInt aProcessLimit); |
|
47 IMPORT_C ~CMTPFSEnumerator(); |
|
48 |
|
49 IMPORT_C void StartL(TUint32 aStorageId); |
|
50 |
|
51 private: |
|
52 //from CActive |
|
53 void DoCancel(); |
|
54 void RunL(); |
|
55 TInt RunError(TInt aError); |
|
56 |
|
57 private: |
|
58 CMTPFSEnumerator(MMTPDataProviderFramework& aFramework, CMTPFSExclusionMgr& aExclusionMgr, MMTPEnumerationCallback& aCallback, TInt aProcessLimit); |
|
59 void ConstructL(); |
|
60 |
|
61 void ScanDirL(); |
|
62 void ScanStorageL(TUint32 aStorageId); |
|
63 void ScanNextL(); |
|
64 void ScanNextStorageL(); |
|
65 void ScanNextSubdirL(); |
|
66 void ProcessEntriesL(); |
|
67 void AddEntryL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& aEntry); |
|
68 void AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& aEntry); |
|
69 void NotifyObjectAddToDP(const TUint32 aHandle,const TUint DpId); |
|
70 |
|
71 private: |
|
72 // Owned |
|
73 MMTPDataProviderFramework& iFramework; |
|
74 CMTPFSExclusionMgr& iExclusionMgr; |
|
75 MMTPEnumerationCallback& iCallback; |
|
76 RMTPDpSingletons iDpSingletons; |
|
77 TUint32 iParentHandle; |
|
78 TParse iPath; |
|
79 RDir iDir; |
|
80 TEntryArray iEntries; |
|
81 TInt iFirstUnprocessed; |
|
82 RArray<TEntry> iDirStack; |
|
83 RArray<TUint> iStorages; |
|
84 TUint32 iStorageId; |
|
85 // How many entries should be processed in one go |
|
86 TInt iProcessLimit; |
|
87 CMTPObjectMetaData* iObject; |
|
88 TUint iDpID; |
|
89 RMTPFramework iSingletons; |
|
90 TBool iSkipCurrentStorage; |
|
91 /** |
|
92 FLOGGER debug trace member variable. |
|
93 */ |
|
94 __FLOG_DECLARATION_MEMBER_MUTABLE; |
|
95 |
|
96 }; |
|
97 |
|
98 #endif // MTPFILEENUMERATOR_H |
|
99 |