21
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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 "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 |
* An utility class to handle the UIDs and filename extensions used to
|
|
16 |
* identify data types. It is also used to store the results per data type.
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef CMSENGINFOARRAY_H
|
|
22 |
#define CMSENGINFOARRAY_H
|
|
23 |
|
|
24 |
// INCLUDES
|
|
25 |
#include <badesca.h>
|
|
26 |
#include <f32file.h>
|
|
27 |
|
|
28 |
// FORWARD DECLARATIONS
|
|
29 |
class CResourceFile;
|
|
30 |
class RResourceReader;
|
|
31 |
|
|
32 |
|
|
33 |
// CLASS DECLARATION
|
|
34 |
|
|
35 |
/**
|
|
36 |
* An utility class to handle the UIDs and filename extensions
|
|
37 |
* used to identify data types. It is also used to store
|
|
38 |
* the results per data type
|
|
39 |
*/
|
|
40 |
class CMsengInfoArray : public CBase
|
|
41 |
{
|
|
42 |
public: // Constructors and destructor
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Two-phased constructor.
|
|
46 |
*/
|
|
47 |
static CMsengInfoArray* NewL(TDriveNumber aDrive,
|
|
48 |
TInt aNumberOfDataGroups,
|
|
49 |
RFs& aFsSession,
|
|
50 |
CResourceFile& aResFile);
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Destructor.
|
|
54 |
*/
|
|
55 |
~CMsengInfoArray();
|
|
56 |
|
|
57 |
public: // New functions
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Get the scan results per UID.
|
|
61 |
* @return Pointer to the array of scan results per UID.
|
|
62 |
*/
|
|
63 |
inline CArrayFix<TInt64>* UidResults() const;
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Get the scan results per filename extension.
|
|
67 |
* @return Pointer to the array of scan results per extension.
|
|
68 |
*/
|
|
69 |
inline CArrayFix<TInt64>* ExtResults() const;
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Get the scan results per data group.
|
|
73 |
* @return Pointer to the array of scan results per group.
|
|
74 |
*/
|
|
75 |
inline CArrayFix<TInt64>* GroupResults() const;
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Get UIDs to be scanned for.
|
|
79 |
* @return Pointer to the array of UIDs.
|
|
80 |
*/
|
|
81 |
inline const CArrayFix<TUid>& Uids() const;
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Get the extensions to be scanned for.
|
|
85 |
* @return Pointer to the array of filename extensions.
|
|
86 |
*/
|
|
87 |
inline const CDesCArray& Exts() const;
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Get the directories to be scanned.
|
|
91 |
* @return Pointer to the array of directory paths.
|
|
92 |
*/
|
|
93 |
inline const CDesCArray& Dirs() const;
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Get the special data directories to be scanned.
|
|
97 |
* @return Pointer to the array data dir - data group pairs.
|
|
98 |
*/
|
|
99 |
inline const CDesCArray& DataDirs() const;
|
|
100 |
|
|
101 |
/**
|
|
102 |
*
|
|
103 |
*
|
|
104 |
*/
|
|
105 |
inline const CArrayFix<TInt>& DataDirGroups() const;
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Get the files excluded from directory to be scanned.
|
|
109 |
*/
|
|
110 |
inline const CArrayPtrFlat<CDesCArray>& DataDirExcludedFiles() const;
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Get the drive that is currently scanned
|
|
114 |
* @return Drive current drive
|
|
115 |
*/
|
|
116 |
inline const TDriveNumber CurrentDrive() const;
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Add new file size to the result array.
|
|
120 |
* @param aUid The file UID type in question
|
|
121 |
* @param aSize Size of the file
|
|
122 |
*/
|
|
123 |
inline void AddSizeByUidL(TInt aUid, TInt64 aSize);
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Add new file size to the result array.
|
|
127 |
* @param aExt Filename extension type in question
|
|
128 |
* @param aSize Size of the file
|
|
129 |
*/
|
|
130 |
inline void AddSizeByExtL(TInt aExt, TInt64 aSize);
|
|
131 |
|
|
132 |
/**
|
|
133 |
* Add scan result af a specific data group.
|
|
134 |
* @param aGroupIndex Data group in question
|
|
135 |
* @param aSize Size of the file
|
|
136 |
*/
|
|
137 |
inline void AddSizeByGroupL(TInt aGroupIndex, TInt64 aSize);
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Query if the directory is in the list of directories to be
|
|
141 |
* excluded from scanning, or is a subdirectory of one
|
|
142 |
* @param aDirectory Path of the directory
|
|
143 |
* @return TBool
|
|
144 |
*/
|
|
145 |
TBool IsExcludedDir(const TDesC& aDirectory) const;
|
|
146 |
|
|
147 |
/**
|
|
148 |
* This function is otherwise similar to BaflUtils::FolderExists, but
|
|
149 |
* it also ETrue for drive root (e.g. "c:\")
|
|
150 |
* @param aFs File server session
|
|
151 |
* @param aDirectory Path of the directory
|
|
152 |
*/
|
|
153 |
TBool FolderExists(RFs& aFs, const TDesC& aPath);
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Query if the directory is in the list of directories to be
|
|
157 |
* excluded from scanning, or is a subdirectory of one
|
|
158 |
* @param aDirectory Path of the directory
|
|
159 |
* @return TBool
|
|
160 |
*/
|
|
161 |
TBool IsSpecialDir(const TDesC& aDirectory) const;
|
|
162 |
|
|
163 |
|
|
164 |
private:
|
|
165 |
|
|
166 |
/**
|
|
167 |
* C++ default constructor is prohibited.
|
|
168 |
*/
|
|
169 |
CMsengInfoArray(TDriveNumber aDrive);
|
|
170 |
|
|
171 |
/**
|
|
172 |
* By default Symbian OS constructor is private.
|
|
173 |
*/
|
|
174 |
void ConstructL(TInt aNumberOfDataGroups, RFs& aFsSession, CResourceFile& aResFile);
|
|
175 |
|
|
176 |
// Prohibit copy constructor if not deriving from CBase.
|
|
177 |
CMsengInfoArray( const CMsengInfoArray& );
|
|
178 |
// Prohibit assigment operator if not deriving from CBase.
|
|
179 |
CMsengInfoArray& operator= ( const CMsengInfoArray& );
|
|
180 |
|
|
181 |
private: // Data
|
|
182 |
// Root directories for scanning
|
|
183 |
CDesCArray* iDirArray;
|
|
184 |
|
|
185 |
// Directories that are excluded from the normal scan
|
|
186 |
CDesCArray* iExcludedDirArray;
|
|
187 |
|
|
188 |
// Directories scanned as a whole excluding listed files
|
|
189 |
CDesCArray* iDataDirArray;
|
|
190 |
CArrayFix<TInt>* iDataDirGroupArray;
|
|
191 |
CArrayPtrFlat<CDesCArray>* iDataDirExclArray;
|
|
192 |
|
|
193 |
// The drive that is currently scanned
|
|
194 |
TDriveNumber iCurrentScannedDrive;
|
|
195 |
|
|
196 |
// The following arrays are indexed using values from enumerations
|
|
197 |
// TUidTypes and TExtTypes
|
|
198 |
|
|
199 |
// Results are inserted into these arrays
|
|
200 |
CArrayFix<TInt64>* iUidResultArray;
|
|
201 |
CArrayFix<TInt64>* iExtResultArray;
|
|
202 |
CArrayFix<TInt64>* iGroupResultArray;
|
|
203 |
|
|
204 |
// UIDs and extensions, which are searched,
|
|
205 |
// are in these two arrays
|
|
206 |
CArrayFix<TUid>* iUidArray;
|
|
207 |
CDesCArray* iExtArray;
|
|
208 |
};
|
|
209 |
|
|
210 |
#include "msenginfoarray.inl"
|
|
211 |
|
|
212 |
#endif // CMSENGINFOARRAY_H
|
|
213 |
|
|
214 |
// End of File
|