author | hgs |
Fri, 23 Apr 2010 22:08:41 +0100 | |
changeset 121 | 661475905584 |
parent 90 | 947f0dc9f7a8 |
child 102 | ef2a444a7410 |
child 132 | e4a7b1cbe40c |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-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 the License "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 |
@publishedAll |
|
19 |
@released |
|
20 |
*/ |
|
21 |
||
22 |
#if !defined(__F32FILE_H__) |
|
23 |
#define __F32FILE_H__ |
|
24 |
||
25 |
#if !defined(__E32BASE_H__) |
|
26 |
#include <e32base.h> |
|
27 |
#endif |
|
28 |
||
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
29 |
#ifndef SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
30 |
// Old implementation including platform e32svr.h (which includes the several other platform headers)... |
0 | 31 |
#if !defined(__E32SVR_H__) |
32 |
#include <e32svr.h> |
|
33 |
#endif |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
34 |
#include <e32ldr.h> |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
35 |
#else |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
36 |
// New implementation including only the public headers needed for f32file.h... |
0 | 37 |
#include <e32ldr.h> |
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
38 |
// And the public headers previously included via e32svr.h but otherwise not needed for f32file.h... |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
39 |
#include <e32def.h> |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
40 |
#include <e32event.h> |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
41 |
#include <e32debug.h> |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
42 |
#include <e32keys.h> |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
43 |
#endif |
0 | 44 |
|
45 |
||
46 |
/** |
|
47 |
@publishedAll |
|
48 |
@released |
|
49 |
||
50 |
The session default drive. |
|
51 |
*/ |
|
52 |
const TInt KDefaultDrive=KMaxTInt; |
|
53 |
||
54 |
||
55 |
||
56 |
||
57 |
/** |
|
58 |
@publishedAll |
|
59 |
@released |
|
60 |
||
61 |
Indicates a drive letter which is not in use. |
|
62 |
||
63 |
This is useful when scanning a drive list to find which drives are available. |
|
64 |
*/ |
|
65 |
const TInt KDriveAbsent=0x00; |
|
66 |
||
67 |
||
68 |
||
69 |
||
70 |
/** |
|
71 |
@publishedAll |
|
72 |
@released |
|
73 |
||
74 |
The default value for the number of message slots passed to RFs::Connect(). |
|
75 |
||
76 |
@see RFs::Connect |
|
77 |
*/ |
|
78 |
const TInt KFileServerDefaultMessageSlots=-1; |
|
79 |
||
80 |
||
81 |
||
82 |
||
83 |
/** |
|
84 |
@publishedAll |
|
85 |
@released |
|
86 |
||
87 |
The size of the array of TEntry items contained in a TEntryArray object. |
|
88 |
||
89 |
@see TEntryArray |
|
90 |
@see TEntry |
|
91 |
*/ |
|
92 |
const TInt KEntryArraySize=(0x200*sizeof(TText)); |
|
93 |
||
94 |
||
95 |
||
96 |
||
97 |
/** |
|
98 |
@publishedAll |
|
99 |
@released |
|
100 |
||
101 |
The character used to separate directories in the path name. |
|
102 |
*/ |
|
103 |
const TInt KPathDelimiter='\\'; |
|
104 |
||
105 |
||
106 |
||
107 |
||
108 |
/** |
|
109 |
@publishedAll |
|
110 |
@released |
|
111 |
||
112 |
The character used to separate the drive letter from the path. |
|
113 |
*/ |
|
114 |
const TInt KDriveDelimiter=':'; |
|
115 |
||
116 |
||
117 |
||
118 |
||
119 |
/** |
|
120 |
@publishedAll |
|
121 |
@released |
|
122 |
||
123 |
The character used to separate the filename from the extension. |
|
124 |
*/ |
|
125 |
const TInt KExtDelimiter='.'; |
|
126 |
||
127 |
||
128 |
||
129 |
||
130 |
/** |
|
131 |
@publishedAll |
|
132 |
@released |
|
133 |
||
134 |
The maximum number of available drives. |
|
135 |
*/ |
|
136 |
const TInt KMaxDrives=26; |
|
137 |
||
138 |
||
139 |
/** |
|
140 |
@publishedAll |
|
141 |
@released |
|
142 |
||
143 |
The maximum number of available proxy drives. |
|
144 |
*/ |
|
145 |
const TInt KMaxProxyDrives=KMaxDrives-KMaxLocalDrives; |
|
146 |
||
147 |
||
148 |
/** |
|
149 |
@publishedAll |
|
150 |
@released |
|
151 |
||
152 |
Defines a modifiable buffer descriptor to contain a drive list. |
|
153 |
||
154 |
The descriptor has maximum length KMaxDrives, sufficient to contain |
|
155 |
all possible drive letters. |
|
156 |
||
157 |
@see RFs::DriveList |
|
158 |
@see KMaxDrives |
|
159 |
*/ |
|
160 |
typedef TBuf8<KMaxDrives> TDriveList; |
|
161 |
||
162 |
||
163 |
||
164 |
/** |
|
165 |
@publishedAll |
|
166 |
@released |
|
167 |
||
168 |
The maximum length of a drivename. |
|
169 |
||
170 |
Sufficient for a drive letter and colon. |
|
171 |
*/ |
|
172 |
const TInt KMaxDriveName=0x02; |
|
173 |
||
174 |
||
175 |
||
176 |
||
177 |
/** |
|
178 |
@publishedAll |
|
179 |
@released |
|
180 |
||
181 |
Defines a modifiable buffer descriptor to contain a drive name. |
|
182 |
||
183 |
A drive name comprises a drive letter (A through Z) and a colon. |
|
184 |
KMaxDriveName (2 bytes) is sufficient for a drive letter and colon. |
|
185 |
||
186 |
@see TDriveUnit::Name |
|
187 |
@see KMaxDriveName |
|
188 |
*/ |
|
189 |
typedef TBuf<KMaxDriveName> TDriveName; |
|
190 |
||
191 |
||
192 |
||
193 |
||
194 |
/** |
|
195 |
@publishedAll |
|
196 |
@released |
|
197 |
||
198 |
The maximum length of a file system name or file system sub type name. |
|
199 |
32 characters is sufficient for a file system or sub type name. |
|
200 |
*/ |
|
201 |
const TInt KMaxFSNameLength=0x0020; |
|
202 |
||
203 |
||
204 |
||
205 |
||
206 |
/** |
|
207 |
@publishedAll |
|
208 |
@released |
|
209 |
||
210 |
Defines a modifiable buffer descriptor to contain a file system or file system sub type name. |
|
211 |
||
212 |
@see KMaxFSNameLength |
|
213 |
*/ |
|
214 |
typedef TBuf<KMaxFSNameLength> TFSName; |
|
215 |
||
216 |
||
217 |
||
218 |
||
219 |
/** |
|
220 |
@publishedAll |
|
221 |
@released |
|
222 |
||
223 |
File/directory attribute: any file without the hidden or system attribute. |
|
224 |
*/ |
|
225 |
const TUint KEntryAttNormal=0x0000; |
|
226 |
||
227 |
||
228 |
||
229 |
||
230 |
/** |
|
231 |
@publishedAll |
|
232 |
@released |
|
233 |
||
234 |
File/directory attribute: read-only file or directory. |
|
235 |
*/ |
|
236 |
const TUint KEntryAttReadOnly=0x0001; |
|
237 |
||
238 |
||
239 |
||
240 |
||
241 |
/** |
|
242 |
@publishedAll |
|
243 |
@released |
|
244 |
||
245 |
File/directory attribute: hidden file or directory. |
|
246 |
*/ |
|
247 |
const TUint KEntryAttHidden=0x0002; |
|
248 |
||
249 |
||
250 |
||
251 |
||
252 |
/** |
|
253 |
@publishedAll |
|
254 |
@released |
|
255 |
||
256 |
File/directory attribute: system file. |
|
257 |
*/ |
|
258 |
const TUint KEntryAttSystem=0x0004; |
|
259 |
||
260 |
||
261 |
||
262 |
||
263 |
/** |
|
264 |
@publishedAll |
|
265 |
@released |
|
266 |
||
267 |
File/directory attribute: volume name directory. |
|
268 |
*/ |
|
269 |
const TUint KEntryAttVolume=0x0008; |
|
270 |
||
271 |
||
272 |
||
273 |
||
274 |
/** |
|
275 |
@publishedAll |
|
276 |
@released |
|
277 |
||
278 |
File/directory attribute: a directory without the hidden or system attribute. |
|
279 |
*/ |
|
280 |
const TUint KEntryAttDir=0x0010; |
|
281 |
||
282 |
||
283 |
||
284 |
||
285 |
/** |
|
286 |
@publishedAll |
|
287 |
@released |
|
288 |
||
289 |
File/directory attribute: an archive file. |
|
290 |
*/ |
|
291 |
const TUint KEntryAttArchive=0x0020; |
|
292 |
||
293 |
||
294 |
||
295 |
||
296 |
/** |
|
297 |
@publishedAll |
|
298 |
@released |
|
299 |
||
300 |
File/directory attribute: ROM eXecute In Place file |
|
301 |
*/ |
|
302 |
const TUint KEntryAttXIP=0x0080; |
|
303 |
||
304 |
||
305 |
||
306 |
||
307 |
/** |
|
308 |
@publishedAll |
|
309 |
@released |
|
310 |
||
311 |
This file attribute bit is set if the file exists only on a remote file |
|
312 |
system and is not locally cached. |
|
313 |
||
314 |
Due to the potential high-latency of remote file systems, applications |
|
315 |
(or users of applications) may make use of this bit to modify their |
|
316 |
behaviour when working with remote files. |
|
317 |
||
318 |
This is a read-only attribute, so any attempt to set this attribute will |
|
319 |
will be ignored. |
|
320 |
*/ |
|
321 |
const TUint KEntryAttRemote=0x0100; |
|
322 |
||
323 |
||
324 |
||
325 |
||
326 |
/** |
|
327 |
@publishedAll |
|
328 |
@released |
|
329 |
||
330 |
The range of entry attributes reserved for file-system specific meanings. |
|
331 |
File systems may assign meaning to these bits, but their definition will |
|
332 |
not be supported nor maintained by Symbian. |
|
333 |
||
334 |
All other file attribute bits are reserved for use by Symbian. |
|
335 |
||
336 |
The following table summarises the assignment of attribute bits: |
|
337 |
||
338 |
0 - KEntryAttReadOnly |
|
339 |
1 - KEntryAttHidden |
|
340 |
2 - KEntryAttSystem |
|
341 |
3 - KEntryAttVolume |
|
342 |
||
343 |
4 - KEntryAttDir |
|
344 |
6 - KEntryAttArchive |
|
345 |
7 - KEntryAttXIP |
|
346 |
||
347 |
8 - KEntryAttRemote |
|
348 |
9 - Reserved |
|
349 |
10 - Reserved |
|
350 |
11 - Reserved |
|
351 |
||
352 |
12 - Reserved |
|
353 |
13 - Reserved |
|
354 |
14 - Reserved |
|
355 |
15 - Reserved |
|
356 |
||
357 |
16 - File System Specific |
|
358 |
17 - File System Specific |
|
359 |
18 - File System Specific |
|
360 |
19 - File System Specific |
|
361 |
||
362 |
20 - File System Specific |
|
363 |
22 - File System Specific |
|
364 |
22 - File System Specific |
|
365 |
23 - File System Specific |
|
366 |
||
367 |
24 - KEntryAttPacked |
|
368 |
25 - Reserved |
|
369 |
26 - Reserved |
|
370 |
27 - KEntryAttMatchExclude |
|
371 |
||
372 |
28 - KEntryAttAllowUid |
|
373 |
29 - Reserved |
|
374 |
30 - KEntryAttMatchExclusive |
|
375 |
31 - Reserved |
|
376 |
*/ |
|
377 |
const TUint KEntryAttMaskFileSystemSpecific=0x00FF0000; |
|
378 |
||
379 |
||
380 |
||
381 |
||
382 |
/** |
|
383 |
@publishedAll |
|
384 |
@released |
|
385 |
||
386 |
Bit mask for matching file and directory entries. |
|
387 |
||
388 |
This mask ensures that directories and hidden and |
|
389 |
system files are matched. |
|
390 |
||
391 |
(Note that KEntryAttNormal matches all entry types except directories, hidden |
|
392 |
and system entries). |
|
393 |
||
394 |
@see RFs::GetDir |
|
395 |
*/ |
|
396 |
const TUint KEntryAttMatchMask=(KEntryAttHidden|KEntryAttSystem|KEntryAttDir); |
|
397 |
||
398 |
||
399 |
||
400 |
||
401 |
||
402 |
/** |
|
403 |
@publishedAll |
|
404 |
@released |
|
405 |
||
406 |
Bit mask for matching file and directory entries. |
|
407 |
||
408 |
This is used when all entry types, including hidden and system files, |
|
409 |
but excluding the volume entry are to be matched. |
|
410 |
||
411 |
@see RFs::GetDir |
|
412 |
*/ |
|
413 |
const TUint KEntryAttMaskSupported=0x3f; |
|
414 |
||
415 |
||
416 |
||
417 |
||
418 |
/** |
|
419 |
@publishedAll |
|
420 |
@released |
|
421 |
||
422 |
Bit mask for matching file and directory entries. |
|
423 |
||
424 |
This is used for exclusive matching. When OR'ed with one or more file attribute |
|
425 |
constants, for example, KEntryAttNormal, it ensures that only the files with |
|
426 |
those attributes are matched. |
|
427 |
When OR’ed with KEntryAttDir, directories only (not hidden or system) are matched. |
|
428 |
||
429 |
@see KEntryAttDir |
|
430 |
@see KEntryAttNormal |
|
431 |
@see RFs::GetDir |
|
432 |
*/ |
|
433 |
const TUint KEntryAttMatchExclusive=0x40000000; |
|
434 |
||
435 |
||
436 |
||
437 |
||
438 |
/** |
|
439 |
@publishedAll |
|
440 |
@released |
|
441 |
||
442 |
Bit mask for feature manager file entries. |
|
443 |
||
444 |
It is used in order to identify each ROM feature set data file |
|
445 |
uniquely in the mount order of ROM sections. |
|
446 |
||
447 |
*/ |
|
448 |
const TUint KEntryAttUnique=0x01000000; |
|
449 |
||
450 |
||
451 |
||
452 |
||
453 |
/** |
|
454 |
@publishedAll |
|
455 |
@released |
|
456 |
||
457 |
Bit mask for matching file and directory entries. |
|
458 |
||
459 |
It is used to exclude files or directories with certain attributes from |
|
460 |
directory listings. This bitmask has the opposite effect |
|
461 |
to KEntryAttMatchExclusive. For example: |
|
462 |
||
463 |
@code |
|
464 |
KEntryAttMatchExclude|KEntryAttReadOnly |
|
465 |
@endcode |
|
466 |
||
467 |
excludes all read only entries from the directory listing. |
|
468 |
||
469 |
@code |
|
470 |
KEntryAttMatchExclusive|KEntryAttReadOnly |
|
471 |
@endcode |
|
472 |
lists only read only entries. |
|
473 |
||
474 |
@see KEntryAttMatchExclusive |
|
475 |
@see RFs::GetDir |
|
476 |
*/ |
|
477 |
const TUint KEntryAttMatchExclude=0x08000000; |
|
478 |
||
479 |
||
480 |
||
481 |
||
482 |
/** |
|
483 |
@publishedAll |
|
484 |
@released |
|
485 |
||
486 |
Bit mask for matching file and directory entries. |
|
487 |
||
488 |
Bit mask flag used when UID information should be included in the directory |
|
489 |
entry listing. |
|
490 |
||
491 |
@see RFs::GetDir |
|
492 |
*/ |
|
493 |
const TUint KEntryAttAllowUid=0x10000000; |
|
494 |
||
495 |
||
496 |
||
497 |
||
498 |
/** |
|
499 |
@publishedAll |
|
500 |
@released |
|
501 |
||
502 |
Indicates that a TEntry (that is generally returned from a TEntryArray) is |
|
503 |
stored in packed format where the iSizeHigh and iReserved fields follow the |
|
504 |
valid characters of the name string. Before accessing the aforementioned |
|
505 |
members, the entry must be unpacked. |
|
506 |
||
507 |
*/ |
|
508 |
const TUint KEntryAttPacked = 0x01000000; |
|
509 |
||
510 |
||
511 |
/** |
|
512 |
@publishedAll |
|
513 |
@released |
|
514 |
*/ |
|
515 |
const TUint KMaxMapsPerCall = 0x8; |
|
516 |
||
517 |
||
518 |
||
519 |
||
520 |
enum TNotifyType |
|
521 |
/** |
|
522 |
@publishedAll |
|
523 |
@released |
|
524 |
||
525 |
A set of change notification flags. |
|
526 |
||
527 |
These flags indicate the kind of change that should result in notification. |
|
528 |
||
529 |
This is useful for programs that maintain displays of file lists that |
|
530 |
must be dynamically updated. |
|
531 |
||
532 |
@see RFs::NotifyChange |
|
533 |
@see RFs |
|
534 |
@see RFile |
|
535 |
@see RRawDisk |
|
536 |
*/ |
|
537 |
{ |
|
538 |
/** |
|
539 |
Any change, including mounting and unmounting drives. |
|
540 |
*/ |
|
541 |
ENotifyAll=0x01, |
|
542 |
||
543 |
||
544 |
/** |
|
545 |
Addition or deletion of a directory entry, or changing or formatting a disk. |
|
546 |
*/ |
|
547 |
ENotifyEntry=0x02, |
|
548 |
||
549 |
||
550 |
/** |
|
551 |
Change resulting from file requests: |
|
552 |
RFile::Create(), RFile::Replace(), RFile::Rename(), RFs::Delete(), |
|
553 |
RFs::Replace(), and RFs::Rename(). |
|
554 |
*/ |
|
555 |
ENotifyFile=0x04, |
|
556 |
||
557 |
||
558 |
/** |
|
559 |
Change resulting from directory requests: |
|
560 |
RFs::MkDir(), RFs::RmDir(), and RFs::Rename(). |
|
561 |
*/ |
|
562 |
ENotifyDir=0x08, |
|
563 |
||
564 |
||
565 |
/** |
|
566 |
Change resulting from: RFs::SetEntry(), RFile::Set(), RFile::SetAtt(), |
|
567 |
RFile::SetModified() and RFile::SetSize() requests. |
|
568 |
*/ |
|
569 |
ENotifyAttributes=0x10, |
|
570 |
||
571 |
||
572 |
/** |
|
573 |
Change resulting from the RFile::Write() request. |
|
574 |
*/ |
|
575 |
ENotifyWrite=0x20, |
|
576 |
||
577 |
||
578 |
/** |
|
579 |
Change resulting from the RRawDisk::Write() request. |
|
580 |
*/ |
|
581 |
ENotifyDisk=0x40 |
|
582 |
}; |
|
583 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
584 |
/** |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
585 |
@publishedAll |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
586 |
@released |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
587 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
588 |
Notification modes for safe media removal notification API |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
589 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
590 |
@see RFs::NotifyDismount |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
591 |
*/ |
0 | 592 |
enum TNotifyDismountMode |
593 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
594 |
/** Used by a client to register for notification of pending dismount. This is the default behaviour for RFs::NotifyDismount*/ |
0 | 595 |
EFsDismountRegisterClient=0x01, |
596 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
597 |
/** |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
598 |
Used for graceful file system dismounting with notifying clients of a pending dismount. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
599 |
If all clients have responded by RFs::AllowDismount(), the file system will be dismounted. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
600 |
*/ |
0 | 601 |
EFsDismountNotifyClients=0x02, |
602 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
603 |
/** Used to forcibly dismount the file system without notifying clients. */ |
0 | 604 |
EFsDismountForceDismount=0x03, |
605 |
}; |
|
606 |
||
607 |
||
608 |
enum TFileCacheFlags |
|
609 |
/** |
|
610 |
@publishedAll |
|
611 |
@released |
|
612 |
||
613 |
Flags used to enable file server drive-specific caching |
|
614 |
*/ |
|
615 |
{ |
|
616 |
/** |
|
617 |
Enable read caching - if file explicitly opened in EFileReadBuffered mode |
|
618 |
*/ |
|
619 |
EFileCacheReadEnabled = 0x01, |
|
620 |
||
621 |
/** |
|
622 |
Enable read caching for all files, regardless of file open mode |
|
623 |
*/ |
|
624 |
EFileCacheReadOn = 0x02, |
|
625 |
||
626 |
/** |
|
627 |
Enable read-ahead caching - if file explicitly opened in EFileReadAheadOn mode |
|
628 |
*/ |
|
629 |
EFileCacheReadAheadEnabled = 0x04, |
|
630 |
||
631 |
/** |
|
632 |
Enable read-ahead caching, regardless of file open mode |
|
633 |
*/ |
|
634 |
EFileCacheReadAheadOn = 0x08, |
|
635 |
||
636 |
/** |
|
637 |
Enable write caching, if file explicitly opened in EFileWriteBuffered mode |
|
638 |
*/ |
|
639 |
EFileCacheWriteEnabled = 0x10, |
|
640 |
||
641 |
/** |
|
642 |
Enable write caching for all files, regardless of file open mode |
|
643 |
*/ |
|
644 |
EFileCacheWriteOn = 0x20, |
|
645 |
}; |
|
646 |
||
647 |
/** |
|
648 |
@publishedAll |
|
649 |
@released |
|
650 |
||
651 |
Commands to query specific volume information. |
|
652 |
||
653 |
@see TVolumeIOParamInfo |
|
654 |
*/ |
|
655 |
enum TQueryVolumeInfoExtCmd |
|
656 |
{ |
|
657 |
/** |
|
658 |
Queries the sub type of the file system mounted on a specified volume. |
|
659 |
For example, FAT12, FAT16 or FAT32. |
|
660 |
*/ |
|
661 |
EFileSystemSubType, |
|
662 |
||
663 |
/** |
|
664 |
Queries the I/O parameters of a specificed volume. |
|
665 |
This includes the block size, the cluster size and the recommended read and write sizes for the media. |
|
666 |
*/ |
|
667 |
EIOParamInfo, |
|
668 |
||
669 |
/** |
|
670 |
This command determines whether the volume is synchronous or asynchronous. |
|
671 |
A boolean value is returned within the buffer defined as TPckgBuf<TBool>. |
|
672 |
ETrue for Synchronous and EFalse for Asynchronous. |
|
673 |
*/ |
|
674 |
EIsDriveSync, |
|
675 |
||
676 |
/** |
|
677 |
Query if the given drive is finalised. See RFs::FinaliseDrive() |
|
678 |
Not all file systems may support this query. |
|
679 |
A boolean value is returned within the buffer defined as TPckgBuf<TBool>. |
|
680 |
ETrue value means that the drive is finalised |
|
681 |
*/ |
|
682 |
EIsDriveFinalised, |
|
683 |
}; |
|
684 |
||
685 |
/** |
|
686 |
@publishedAll |
|
687 |
@released |
|
688 |
||
689 |
Volume IO parameter information. |
|
690 |
||
691 |
This class is used to return IO parameter information for a specified volume. |
|
692 |
||
693 |
The volume parameter information holds recommended buffer sizes for the creation of efficient buffers for |
|
694 |
reading and writing. |
|
695 |
||
696 |
@see RFs::VolumeIOParam() |
|
697 |
*/ |
|
698 |
class TVolumeIOParamInfo |
|
699 |
{ |
|
700 |
public: |
|
701 |
/** |
|
702 |
The size of a block in bytes. |
|
703 |
||
704 |
Reads and writes that are aligned on block boundaries are up to twice as fast as when |
|
705 |
mis-aligned. |
|
706 |
||
707 |
Read and write operations on certain underlying media is done in blocks. |
|
708 |
A write operation that modifies only part of a block is less efficient, in general, than |
|
709 |
one that modifies an entire block. Data throughput degrades linearly for reads and writes in smaller |
|
710 |
sized units. |
|
711 |
*/ |
|
712 |
TInt iBlockSize; |
|
713 |
/** |
|
714 |
The size in bytes of a single disk cluster. |
|
715 |
||
716 |
Read and write operations that are aligned on cluster boundaries are more efficient. |
|
717 |
||
718 |
The file system organises and allocates the file data on the disk in clusters where each cluster is |
|
719 |
one or more blocks. Files that are not zero length occupy at least one cluster of the disk, |
|
720 |
so large numbers of very small files use up more disk space than expected. |
|
721 |
*/ |
|
722 |
TInt iClusterSize; |
|
723 |
/** |
|
724 |
The recommended buffer size for optimised reading performance. |
|
725 |
||
726 |
The given buffer size is based on sensible benchmark testing results produced by the mobile device vendor. |
|
727 |
The buffer size is then added to the estart.txt file |
|
728 |
||
729 |
The figure is included in the estart.txt file along with the drive number and the variable name. |
|
730 |
The example below shows the required format: |
|
731 |
||
732 |
[DriveC] |
|
733 |
RecReadBufSize 8192 |
|
734 |
||
735 |
When no value is provided, value KErrNotSupported is returned. |
|
736 |
*/ |
|
737 |
TInt iRecReadBufSize; |
|
738 |
/** |
|
739 |
The recommended buffer size for optimised writing performance. |
|
740 |
||
741 |
The given buffer size is based on sensible benchmark testing results produced by the mobile device vendor. |
|
742 |
The buffer size is then added to the estart.txt file |
|
743 |
||
744 |
The figure is included in the estart.txt file along with the drive number and the variable name. |
|
745 |
The example below shows the required format: |
|
746 |
||
747 |
[DriveC] |
|
748 |
RecWriteBufSize 16384 |
|
749 |
||
750 |
When no value is provided, value KErrNotSupported is returned. |
|
751 |
*/ |
|
752 |
TInt iRecWriteBufSize; |
|
753 |
||
754 |
||
755 |
/** |
|
756 |
The maximum file size that is supported by the file system mounted on this volume. |
|
757 |
Not all file system may provide this parameter; The value KMaxTUint64 (0xffffffffffffffff) means that this particular file system hasn't |
|
758 |
provided this information. |
|
759 |
*/ |
|
760 |
TUint64 iMaxSupportedFileSize; |
|
761 |
||
762 |
private: |
|
763 |
/* |
|
764 |
Reserved space for future use |
|
765 |
*/ |
|
766 |
TInt iReserved[2]; |
|
767 |
}; |
|
768 |
||
769 |
enum TDriveNumber |
|
770 |
/** |
|
771 |
@publishedAll |
|
772 |
@released |
|
773 |
||
774 |
The drive number enumeration. |
|
775 |
*/ |
|
776 |
{ |
|
777 |
EDriveA, EDriveB, EDriveC, EDriveD, EDriveE, |
|
778 |
EDriveF, EDriveG, EDriveH, EDriveI, EDriveJ, |
|
779 |
EDriveK, EDriveL, EDriveM, EDriveN, EDriveO, |
|
780 |
EDriveP, EDriveQ, EDriveR, EDriveS, EDriveT, |
|
781 |
EDriveU, EDriveV, EDriveW, EDriveX, EDriveY, |
|
782 |
EDriveZ |
|
783 |
}; |
|
784 |
||
785 |
||
786 |
||
787 |
||
788 |
enum TEntryKey |
|
789 |
/** |
|
790 |
@publishedAll |
|
791 |
@released |
|
792 |
||
793 |
Flags indicating the order in which directory entries are to be sorted. |
|
794 |
||
795 |
@see RFs::GetDir |
|
796 |
@see CDirScan::SetScanDataL |
|
797 |
@see CDir::Sort |
|
798 |
*/ |
|
799 |
{ |
|
800 |
/** |
|
801 |
The default; no sorting takes place |
|
802 |
*/ |
|
803 |
ESortNone=0, |
|
804 |
||
805 |
||
806 |
/** |
|
807 |
Sort according to alphabetic order of file and directory name. |
|
808 |
||
809 |
This setting is mutually exclusive with ESortByExt, ESortBySize, |
|
810 |
ESortByDate and ESortByUid. |
|
811 |
*/ |
|
812 |
ESortByName, |
|
813 |
||
814 |
||
815 |
/** |
|
816 |
Sort according to alphabetic order of file extension. |
|
817 |
||
818 |
Files without an extension take precedence over files with an extension. |
|
819 |
For files with the same extension or without an extension, the default is |
|
820 |
to sort by name. |
|
821 |
||
822 |
This setting is mutually exclusive with ESortByName, ESortBySize, |
|
823 |
ESortByDate and ESortByUid. |
|
824 |
*/ |
|
825 |
ESortByExt, |
|
826 |
||
827 |
||
828 |
/** |
|
829 |
Sort according to file size. |
|
830 |
||
831 |
This setting is mutually exclusive with ESortByName, ESortByExt, |
|
832 |
ESortByDate and ESortByUid. |
|
833 |
*/ |
|
834 |
ESortBySize, |
|
835 |
||
836 |
||
837 |
/** |
|
838 |
Sort according to files' last modified time and date. |
|
839 |
||
840 |
By default, most recent last. |
|
841 |
||
842 |
This setting is mutually exclusive with ESortByName, ESortByExt, |
|
843 |
ESortBySize and ESortByUid. |
|
844 |
*/ |
|
845 |
ESortByDate, |
|
846 |
||
847 |
||
848 |
/** |
|
849 |
Sort according to file UID. |
|
850 |
||
851 |
This setting is mutually exclusive with ESortByName, ESortByExt, |
|
852 |
ESortBySize and ESortByDate. |
|
853 |
*/ |
|
854 |
ESortByUid, |
|
855 |
||
856 |
||
857 |
/** |
|
858 |
Qualifies the sort order; if set, directories are listed in the order in |
|
859 |
which they occur. |
|
860 |
||
861 |
This is the default. |
|
862 |
||
863 |
This flag is mutually exclusive with EDirsFirst and EDirslast. |
|
864 |
*/ |
|
865 |
EDirsAnyOrder=0, |
|
866 |
||
867 |
||
868 |
/** |
|
869 |
Qualifies the sort order; if set, directories come before files in sort order. |
|
870 |
||
871 |
This flag is mutually exclusive with EDirsAnyOrder and EDirsLast. |
|
872 |
*/ |
|
873 |
EDirsFirst=0x100, |
|
874 |
||
875 |
||
876 |
/** |
|
877 |
Qualifies the sort order; if set, files come before directories in sort order. |
|
878 |
||
879 |
This flag is mutually exclusive with EDirsAnyOrder and EDirsFirst. |
|
880 |
*/ |
|
881 |
EDirsLast=0x200, |
|
882 |
||
883 |
||
884 |
/** |
|
885 |
Qualifies the sort order; files are sorted in ascending order, i.e. from A to Z. |
|
886 |
This is the default behaviour. |
|
887 |
||
888 |
This flag is mutually exclusive with EDescending and EDirDescending. |
|
889 |
*/ |
|
890 |
EAscending=0, |
|
891 |
||
892 |
||
893 |
/** |
|
894 |
Qualifies the sort order; files are sorted in descending order, i.e. from Z to A. |
|
895 |
||
896 |
This flag is mutually exclusive with EAscending and EDirDescending. |
|
897 |
*/ |
|
898 |
EDescending=0x400, |
|
899 |
||
900 |
||
901 |
/** |
|
902 |
Qualifies the sort order; directories are sorted in descending order, i.e. from Z to A. |
|
903 |
||
904 |
This flag shall be used in combination with either EDirsFirst or EDirsLast. |
|
905 |
This flag is mutually exclusive with EAscending and EDescending. |
|
906 |
*/ |
|
907 |
EDirDescending=0x800 |
|
908 |
}; |
|
909 |
||
910 |
||
911 |
||
912 |
||
913 |
enum TFileMode |
|
914 |
/** |
|
915 |
@publishedAll |
|
916 |
@released |
|
917 |
||
918 |
Access and share modes available when opening a file. |
|
919 |
||
920 |
The access mode indicates whether the file is opened just for reading or |
|
921 |
for writing. |
|
922 |
||
923 |
The share mode indicates whether other RFile objects can access the |
|
924 |
open file, and whether this access is read only. |
|
925 |
||
926 |
Use EFileShareReadersOrWriters if a client does not care whether the file has |
|
927 |
been previously opened for ReadOnly or Read/Write access. |
|
928 |
||
929 |
If EFileShareReadersOrWriters is not used, then a client needs to cooperate with |
|
930 |
other clients in order to open the file with the correct share mode, either |
|
931 |
EFileShareReadersOnly or EFileShareAny, depending on the share mode used when |
|
932 |
the file was originally opened. |
|
933 |
||
934 |
To open a file for reading and writing with read and write shared access, |
|
935 |
use: |
|
936 |
||
937 |
@code |
|
938 |
_LIT(KFilename, "filename.ext"); |
|
939 |
RFile file; |
|
940 |
file.Open(theFs, KFilename, EFileShareAny|EFileWrite); |
|
941 |
@endcode |
|
942 |
||
943 |
If another instance of RFile tries to open this file in EFileShareExclusive |
|
944 |
or EFileShareReadersOnly mode, access is denied. However, it can be opened |
|
945 |
in EFileShareAny mode or EFileShareReadersOrWriters mode. |
|
946 |
||
947 |
If a file is opened with EFileShareReadersOrWriters, and the file is opened for |
|
948 |
sharing by another client, then the file share mode is promoted to the new share |
|
949 |
mode. When the file handle is closed then the share mode is demoted back to |
|
950 |
EFileShareReadersOrWriters. |
|
951 |
||
952 |
@code |
|
953 |
||
954 |
Table of FileShare promotion rules |
|
955 |
---------------------------------- |
|
956 |
||
957 |
Client A Client B Resultant Share Mode |
|
958 |
-------- -------- -------------------- |
|
959 |
ReadersOnly ReadersOnly ReadersOnly |
|
960 |
ReadersOnly ReadersOrWriters|EFileRead ReadersOnly |
|
961 |
ReadersOnly ReadersOrWriters|EFileWrite INCOMPATIBLE |
|
962 |
ReadersOnly Any INCOMPATIBLE |
|
963 |
||
964 |
ReadersOrWriters|EFileRead ReadersOnly ReadersOnly |
|
965 |
ReadersOrWriters|EFileRead ReadersOrWriters|EFileRead ReadersOrWriters |
|
966 |
ReadersOrWriters|EFileRead ReadersOrWriters|EFileWrite ReadersOrWriters |
|
967 |
ReadersOrWriters|EFileRead Any Any |
|
968 |
||
969 |
ReadersOrWriters|EFileWrite ReadersOnly INCOMPATIBLE |
|
970 |
ReadersOrWriters|EFileWrite ReadersOrWriters|EFileRead ReadersOrWriters |
|
971 |
ReadersOrWriters|EFileWrite ReadersOrWriters|EFileWrite ReadersOrWriters |
|
972 |
ReadersOrWriters|EFileWrite Any Any |
|
973 |
||
974 |
Any ReadersOnly INCOMPATIBLE |
|
975 |
Any ReadersOrWriters|EFileRead Any |
|
976 |
Any ReadersOrWriters|EFileWrite Any |
|
977 |
Any Any Any |
|
978 |
@endcode |
|
979 |
||
980 |
Use the following guidance notes for selecting FileShare mode with shared RFile objects: |
|
981 |
||
982 |
EFileShareAny |
|
983 |
- Use this mode to request both read and write access when another client needs |
|
984 |
to write to the file and respective client access to the file is coordinated. |
|
985 |
- To open a file for non-exclusive write, use EFileShareAny | EFileWrite. |
|
986 |
- It is recommended that either EFileShareAny or EFileShareAny | EFileRead are |
|
987 |
not used. These combinations will block users attempting to use the |
|
988 |
EFileShareReadersOnly mode even if all the EFileShareAny handles do not have |
|
989 |
the EFileWrite bit set as the EFileRead and EFileWrite bits have no affect on |
|
990 |
sharing. Use either EFileShareReadersOnly or EFileShareReadersOrWriters. |
|
991 |
||
992 |
EFileShareReadersOrWriters |
|
993 |
- Use this mode when it does not matter if another file writes to the file and |
|
994 |
file access can not be coordinated as other clients are unknown. |
|
995 |
- To open a file for shared read access whilst permitting writers, use |
|
996 |
EFileShareReadersOrWriters | EFileRead. |
|
997 |
||
998 |
- For write access with unrestricted share mode, |
|
999 |
EFileShareReadersOrWriters | EFileWrite may be used however |
|
1000 |
EFilesShareAny | EFileWrite is preferred. |
|
1001 |
||
1002 |
EFileShareReadersOnly |
|
1003 |
- Use this mode to get read access to the file and deny write access for any |
|
1004 |
other handles on this file. |
|
1005 |
- To open a file for shared read access whilst disallowing writers use |
|
1006 |
EFileShareReadersOnly. |
|
1007 |
||
1008 |
||
1009 |
Files may be opened in text or binary mode. Native Symbian OS application |
|
1010 |
files are nearly all binary, (so they will usually be opened in binary mode). |
|
1011 |
However, they can be opened in text mode (to support testing, and to make them |
|
1012 |
compatible with text formats on remote systems). |
|
1013 |
Symbian OS native text format uses CR-LF (ASCII 0x0d, 0x0a) to denote the end of |
|
1014 |
a line. When reading, however, any combination of CR, LF, LF-CR or CR-LF is |
|
1015 |
recognised as the end of a line. Where a remote file system uses a different |
|
1016 |
format, it is the responsibility of the installable file system to present |
|
1017 |
an interface for text files which conforms with this format. |
|
1018 |
||
1019 |
The share mode may be OR’ed with either EFileStream or EFileStreamText. |
|
1020 |
||
1021 |
Additionally, it may be OR’ed with either EFileRead or EFileWrite. |
|
1022 |
*/ |
|
1023 |
{ |
|
1024 |
/** |
|
1025 |
Exclusive access for the program opening the file. |
|
1026 |
||
1027 |
No other program can access the file until it is closed. |
|
1028 |
If another program is already accessing the file in any share mode, then |
|
1029 |
an attempt to open it with an EFileShareExclusive will fail. |
|
1030 |
*/ |
|
1031 |
EFileShareExclusive, |
|
1032 |
||
1033 |
||
1034 |
/** |
|
1035 |
Read-only sharing. |
|
1036 |
||
1037 |
This means that the file may only be accessed for reading. |
|
1038 |
A file cannot be opened using a share mode of EFileShareReadersOnly with |
|
1039 |
an EFileWrite flag. |
|
1040 |
*/ |
|
1041 |
EFileShareReadersOnly, |
|
1042 |
||
1043 |
||
1044 |
/** |
|
1045 |
Shared access for reading and writing. |
|
1046 |
||
1047 |
This means that other programs may share access to the file for reading |
|
1048 |
and writing with the program which opened the file. |
|
1049 |
||
1050 |
When using this mode, the program is expecting another program to be able |
|
1051 |
to write to the file, so is not compatible with EFileShareReadersOnly. |
|
1052 |
*/ |
|
1053 |
EFileShareAny, |
|
1054 |
||
1055 |
||
1056 |
/** |
|
1057 |
Shared access for reading and writing. |
|
1058 |
||
1059 |
This means that other programs may share access to the file for reading |
|
1060 |
and writing with the program which opened the file. |
|
1061 |
||
1062 |
When using this mode, the program does not care if another program has |
|
1063 |
the file open for read or write access. |
|
1064 |
*/ |
|
1065 |
EFileShareReadersOrWriters, |
|
1066 |
||
1067 |
||
1068 |
/** |
|
1069 |
For files to be opened in binary mode. |
|
1070 |
*/ |
|
1071 |
EFileStream=0, |
|
1072 |
||
1073 |
||
1074 |
/** |
|
1075 |
For files to be opened in text mode. |
|
1076 |
*/ |
|
1077 |
EFileStreamText=0x100, |
|
1078 |
||
1079 |
||
1080 |
/** |
|
1081 |
The file may be read from but not written to. |
|
1082 |
*/ |
|
1083 |
EFileRead=0, |
|
1084 |
||
1085 |
||
1086 |
/** |
|
1087 |
The file may be read from and written to |
|
1088 |
||
1089 |
Cannot be combined with a share mode of EFileShareReadersOnly. |
|
1090 |
*/ |
|
1091 |
EFileWrite=0x200, |
|
1092 |
||
1093 |
/** |
|
1094 |
Specifies that an asynchronous read request should not be completed |
|
1095 |
until all requested data becomes available. |
|
1096 |
||
1097 |
Cannot be combined with the EFileShareExclusive or EFileShareReadersOnly |
|
1098 |
share modes as this will prohibit a writer from updating the file. |
|
1099 |
*/ |
|
1100 |
EFileReadAsyncAll=0x400, |
|
1101 |
||
1102 |
/** |
|
1103 |
Enables write buffering |
|
1104 |
*/ |
|
1105 |
EFileWriteBuffered =0x00000800, |
|
1106 |
||
1107 |
/** |
|
1108 |
Disables write buffering |
|
1109 |
*/ |
|
1110 |
EFileWriteDirectIO =0x00001000, |
|
1111 |
||
1112 |
/** |
|
1113 |
Enables read buffering |
|
1114 |
*/ |
|
1115 |
EFileReadBuffered =0x00002000, |
|
1116 |
||
1117 |
/** |
|
1118 |
Disables read buffering |
|
1119 |
*/ |
|
1120 |
EFileReadDirectIO =0x00004000, |
|
1121 |
||
1122 |
/** |
|
1123 |
Enables read ahead. |
|
1124 |
*/ |
|
1125 |
EFileReadAheadOn =0x00008000, |
|
1126 |
||
1127 |
/** |
|
1128 |
Disables read ahead. |
|
1129 |
*/ |
|
1130 |
EFileReadAheadOff =0x00010000, |
|
1131 |
||
1132 |
/** |
|
1133 |
Enable delete on close |
|
1134 |
*/ |
|
1135 |
EDeleteOnClose =0x00020000, |
|
1136 |
||
1137 |
/** |
|
1138 |
Enables operations on large files. |
|
1139 |
||
1140 |
@internalTechnology |
|
1141 |
||
1142 |
*/ |
|
1143 |
EFileBigFile =0x00040000 |
|
1144 |
||
1145 |
}; |
|
1146 |
||
1147 |
||
1148 |
||
1149 |
||
1150 |
/** |
|
1151 |
@publishedAll |
|
1152 |
@released |
|
1153 |
||
1154 |
Bit mask provided for retrieving a file's share mode. |
|
1155 |
||
1156 |
@see TFileMode |
|
1157 |
*/ |
|
1158 |
const TUint KFileShareMask=0xff; |
|
1159 |
||
1160 |
||
1161 |
||
1162 |
||
1163 |
enum TFormatMode |
|
1164 |
/** |
|
1165 |
@publishedAll |
|
1166 |
@released |
|
1167 |
||
1168 |
The format method. |
|
1169 |
*/ |
|
1170 |
{ |
|
1171 |
/** |
|
1172 |
Indicates a high density floppy disk to be formatted. |
|
1173 |
||
1174 |
Obsolete. |
|
1175 |
||
1176 |
Can be ORed with EFullFormat or EQuickFormat, but does not |
|
1177 |
have any effect. |
|
1178 |
*/ |
|
1179 |
EHighDensity, |
|
1180 |
||
1181 |
||
1182 |
/** |
|
1183 |
Indicates a low density floppy disk to be formatted. |
|
1184 |
||
1185 |
Obsolete. |
|
1186 |
||
1187 |
Can be ORed with EFullFormat or EQuickFormat, but does not |
|
1188 |
have any effect. |
|
1189 |
*/ |
|
1190 |
ELowDensity, |
|
1191 |
||
1192 |
||
1193 |
/** |
|
1194 |
Performs a full format, erasing whole media content and creating |
|
1195 |
new file system layout. |
|
1196 |
||
1197 |
This is the default mode. |
|
1198 |
*/ |
|
1199 |
EFullFormat=0, |
|
1200 |
||
1201 |
||
1202 |
/** |
|
1203 |
Performs a quick media format, erasing only required minimum media content. |
|
1204 |
For example, for FAT file system it resets FAT and root directory content. |
|
1205 |
Also preserves bad sectors if there are some on the volume. |
|
1206 |
*/ |
|
1207 |
EQuickFormat=0x100, |
|
1208 |
||
1209 |
||
1210 |
/** |
|
1211 |
Indicates a custom formatting mode. In this mode some optional file system |
|
1212 |
specific parameters may be passed to RFormat::Open(). |
|
1213 |
||
1214 |
@see TLDFormatInfo |
|
1215 |
@see TInt RFormat::Open(RFs &aFs, const TDesC &aName, TUint aFormatMode, TInt &aCount, const TDesC8 &anInfo); |
|
1216 |
*/ |
|
1217 |
ESpecialFormat=0x200, |
|
1218 |
||
1219 |
/** |
|
1220 |
Forced erase of locked media |
|
1221 |
*/ |
|
1222 |
EForceErase=0x400, |
|
1223 |
||
1224 |
/** |
|
1225 |
This flag enables formatting the volume even if it has files or directories opened on it. |
|
1226 |
If this flag is specified, the volume will be forcedly dismounted before performing media formatting. |
|
1227 |
||
1228 |
Even with this flag the RFormat::Open() can fail with KErrInUse in following cases: |
|
1229 |
1. if there are clamped files on the volume. |
|
1230 |
2. there are opened "disk access" objects, like RFormat or RRawDisk on the volume. |
|
1231 |
*/ |
|
1232 |
EForceFormat = 0x800, |
|
1233 |
||
1234 |
}; |
|
1235 |
||
1236 |
||
1237 |
||
1238 |
||
1239 |
enum TSeek |
|
1240 |
/** |
|
1241 |
@publishedAll |
|
1242 |
@released |
|
1243 |
||
1244 |
Flags indicating the destination of a seek operation. |
|
1245 |
||
1246 |
File locations are specified as a 32-bit signed integer, |
|
1247 |
allowing offsets of ?GB from the origin of the seek. |
|
1248 |
||
1249 |
@see RFile::Seek |
|
1250 |
*/ |
|
1251 |
{ |
|
1252 |
/** |
|
1253 |
This can only be used for file systems with execute-in-place facilities, |
|
1254 |
such as the ROM file system: the offset specifies the absolute address of |
|
1255 |
the data. |
|
1256 |
*/ |
|
1257 |
ESeekAddress, |
|
1258 |
||
1259 |
||
1260 |
/** |
|
1261 |
Destination is the start of file. |
|
1262 |
*/ |
|
1263 |
ESeekStart, |
|
1264 |
||
1265 |
||
1266 |
/** |
|
1267 |
Destination is the current position in file. |
|
1268 |
*/ |
|
1269 |
ESeekCurrent, |
|
1270 |
||
1271 |
||
1272 |
/** |
|
1273 |
Destination is the end of file. |
|
1274 |
*/ |
|
1275 |
ESeekEnd |
|
1276 |
}; |
|
1277 |
||
1278 |
/** |
|
1279 |
@publishedAll |
|
1280 |
@released |
|
1281 |
||
1282 |
*/ |
|
1283 |
class TBlockMapEntry : public TBlockMapEntryBase |
|
1284 |
{ |
|
1285 |
public: |
|
1286 |
IMPORT_C TBlockMapEntry(); |
|
1287 |
IMPORT_C void SetNumberOfBlocks( TUint aNumberOfBlocks ); |
|
1288 |
IMPORT_C void SetStartBlock( TUint aStartBlock ); |
|
1289 |
}; |
|
1290 |
||
1291 |
/** |
|
1292 |
@publishedAll |
|
1293 |
@released |
|
1294 |
||
1295 |
*/ |
|
1296 |
typedef TBuf8<KMaxMapsPerCall*sizeof(TBlockMapEntry)> TBlockArrayDes; |
|
1297 |
||
1298 |
struct SBlockMapInfo : public SBlockMapInfoBase |
|
1299 |
{ |
|
1300 |
TBlockArrayDes iMap; |
|
1301 |
}; |
|
1302 |
||
1303 |
/** |
|
1304 |
@publishedAll |
|
1305 |
@released |
|
1306 |
*/ |
|
1307 |
enum TBlockMapUsage |
|
1308 |
{ |
|
1309 |
/* */ |
|
1310 |
EBlockMapUsagePaging, |
|
1311 |
/* */ |
|
1312 |
ETestDebug |
|
1313 |
}; |
|
1314 |
||
1315 |
class TEntry |
|
1316 |
/** |
|
1317 |
@publishedAll |
|
1318 |
@released |
|
1319 |
||
1320 |
Encapsulates an entry in a directory, which can be another (nested) directory, |
|
1321 |
a file or a volume label. |
|
1322 |
||
1323 |
Each directory entry has a name which is relative to its owning directory |
|
1324 |
and a type, which is indicated by its unique identifier (UID). |
|
1325 |
||
1326 |
An entry can be interrogated for the following properties: |
|
1327 |
||
1328 |
1. the kind of entry: stored in the entry UIDs, stored in iType |
|
1329 |
||
1330 |
2. the entry attributes, stored in iAtt |
|
1331 |
||
1332 |
3. the size of entry |
|
1333 |
||
1334 |
4. the time the entry was last modified. |
|
1335 |
||
1336 |
@see RDir |
|
1337 |
@see RFs::Entry |
|
1338 |
@see RFs::SetEntry |
|
1339 |
@see CfileBase::CurrentEntry |
|
1340 |
*/ |
|
1341 |
{ |
|
1342 |
public: |
|
1343 |
IMPORT_C TEntry(); |
|
1344 |
IMPORT_C TEntry(const TEntry& aEntry); |
|
1345 |
IMPORT_C TEntry& operator=(const TEntry& aEntry); |
|
1346 |
IMPORT_C TBool IsReadOnly() const; |
|
1347 |
IMPORT_C TBool IsHidden() const; |
|
1348 |
IMPORT_C TBool IsSystem() const; |
|
1349 |
IMPORT_C TBool IsDir() const; |
|
1350 |
IMPORT_C TBool IsArchive() const; |
|
1351 |
inline const TUid& operator[](TInt anIndex) const; |
|
1352 |
inline TBool IsUidPresent(TUid aUid) const; |
|
1353 |
inline TBool IsTypeValid() const; |
|
1354 |
inline TUid MostDerivedUid() const; |
|
1355 |
IMPORT_C TInt64 FileSize() const; |
|
1356 |
inline void SetFileSize(TInt64 aFileSize); |
|
1357 |
||
1358 |
private: |
|
1359 |
inline void Copy(const TEntry& aEntry); |
|
1360 |
inline void Unpack(); |
|
1361 |
||
1362 |
public: |
|
1363 |
/** |
|
1364 |
The individual bits within this byte indicate which attributes |
|
1365 |
have been set. |
|
1366 |
||
1367 |
@see KEntryAttNormal |
|
1368 |
@see KEntryAttReadOnly |
|
1369 |
@see KEntryAttHidden |
|
1370 |
@see KEntryAttSystem |
|
1371 |
*/ |
|
1372 |
TUint iAtt; |
|
1373 |
||
1374 |
||
1375 |
/** |
|
1376 |
The size of the file in bytes. |
|
1377 |
For files larger that 2G it must be cast to TUint in order to avoid looking like negative signed. |
|
1378 |
*/ |
|
1379 |
TInt iSize; |
|
1380 |
||
1381 |
||
1382 |
/** |
|
1383 |
The local time of last modification. |
|
1384 |
*/ |
|
1385 |
TTime iModified; |
|
1386 |
||
1387 |
||
1388 |
/** |
|
1389 |
The file's UIDtype |
|
1390 |
*/ |
|
1391 |
TUidType iType; |
|
1392 |
||
1393 |
||
1394 |
/** |
|
1395 |
The name of the file relative to the owning directory, |
|
1396 |
with a maximum of KMaxFileName characters. |
|
1397 |
||
1398 |
@see KMaxFileName |
|
1399 |
*/ |
|
1400 |
TBufC<KMaxFileName> iName; |
|
1401 |
||
1402 |
private: |
|
1403 |
TUint32 iSizeHigh; |
|
1404 |
/** |
|
1405 |
Reserved for future expansion |
|
1406 |
*/ |
|
1407 |
TUint32 iReserved; |
|
1408 |
}; |
|
1409 |
||
1410 |
||
1411 |
||
1412 |
||
1413 |
class RDir; |
|
1414 |
class TEntryArray |
|
1415 |
/** |
|
1416 |
@publishedAll |
|
1417 |
@released |
|
1418 |
||
1419 |
Array of directory entries. |
|
1420 |
||
1421 |
It contains the results of a call to RDir::Read(): it will contain all |
|
1422 |
the TEntry items in the directory. Thus, a directory can be read in |
|
1423 |
a single call, minimising client/server communication overheads. |
|
1424 |
||
1425 |
@see TEntry |
|
1426 |
@see RDir::Read |
|
1427 |
*/ |
|
1428 |
{ |
|
1429 |
public: |
|
1430 |
IMPORT_C TEntryArray(); |
|
1431 |
IMPORT_C TInt Count() const; |
|
1432 |
IMPORT_C const TEntry& operator[](TInt anIndex) const; |
|
1433 |
private: |
|
1434 |
TInt iCount; |
|
1435 |
TInt iIndex; |
|
1436 |
const TEntry* iPos; |
|
1437 |
TBuf8<KEntryArraySize> iBuf; |
|
1438 |
friend class RDir; |
|
1439 |
friend class RFs; |
|
1440 |
friend class TRawEntryArray; |
|
1441 |
}; |
|
1442 |
||
1443 |
||
1444 |
||
1445 |
||
1446 |
class TDriveInfo |
|
1447 |
/** |
|
1448 |
@publishedAll |
|
1449 |
@released |
|
1450 |
||
1451 |
Contains drive information. |
|
1452 |
||
1453 |
@see RFs::Drive |
|
1454 |
*/ |
|
1455 |
{ |
|
1456 |
public: |
|
1457 |
/** |
|
1458 |
The type of media mounted on the drive. |
|
1459 |
*/ |
|
1460 |
TMediaType iType; |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1461 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1462 |
|
0 | 1463 |
/** |
1464 |
Indicates whether the drive supports a battery, and if so, its state. |
|
1465 |
*/ |
|
1466 |
TBatteryState iBattery; |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1467 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1468 |
|
0 | 1469 |
/** |
1470 |
The drive attributes. |
|
1471 |
||
1472 |
@see KDriveAttLocal |
|
1473 |
@see KDriveAttRom |
|
1474 |
@see KDriveAttRedirected |
|
1475 |
@see KDriveAttSubsted |
|
1476 |
@see KDriveAttInternal |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1477 |
@see KDriveAttRemovable |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1478 |
@see KDriveAttExternal |
0 | 1479 |
*/ |
1480 |
TUint iDriveAtt; |
|
1481 |
||
1482 |
||
1483 |
/** |
|
1484 |
The attributes of the media mounted on the drive. |
|
1485 |
||
1486 |
@see KMediaAttVariableSize |
|
1487 |
@see KMediaAttDualDensity |
|
1488 |
@see KMediaAttFormattable |
|
1489 |
@see KMediaAttWriteProtected |
|
1490 |
@see KMediaAttLockable |
|
1491 |
@see KMediaAttLocked |
|
1492 |
*/ |
|
1493 |
TUint iMediaAtt; |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1494 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1495 |
|
0 | 1496 |
/** |
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1497 |
The type of interface used to connect to the media. |
0 | 1498 |
*/ |
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1499 |
TConnectionBusType iConnectionBusType; |
0 | 1500 |
}; |
1501 |
||
1502 |
||
1503 |
||
1504 |
||
1505 |
class TVolumeInfo |
|
1506 |
/** |
|
1507 |
@publishedAll |
|
1508 |
@released |
|
1509 |
||
1510 |
Contains information about a volume mounted on a drive. Use RFs::Drive() if only |
|
1511 |
the drive information is required. |
|
1512 |
||
1513 |
If a drive supports removable media it may contain different volumes over time. |
|
1514 |
||
1515 |
Volume information is made up of information concerning the drive on which it is mounted, |
|
1516 |
which can also be accessed through RFs::Drive(), and the volume information, this is made |
|
1517 |
up of the size of the volume, the free space, its unique identifying number and a name. |
|
1518 |
||
1519 |
TVolumeInfo is initialised by RFs::Volume(). |
|
1520 |
||
1521 |
@see RFs::Volume() |
|
1522 |
@see RFs::Drive() |
|
1523 |
*/ |
|
1524 |
{ |
|
1525 |
public: |
|
1526 |
IMPORT_C TVolumeInfo(); |
|
1527 |
||
1528 |
/** |
|
1529 |
Information about the drive on which the volume is mounted. |
|
1530 |
||
1531 |
@see TDriveInfo |
|
1532 |
*/ |
|
1533 |
TDriveInfo iDrive; |
|
1534 |
||
1535 |
||
1536 |
/** |
|
1537 |
The volume’s unique identifying number. |
|
1538 |
*/ |
|
1539 |
TUint iUniqueID; |
|
1540 |
||
1541 |
||
1542 |
/** |
|
1543 |
The maximum size of the volume in bytes. The current amount of memory |
|
1544 |
in use plus the amount of free memory. |
|
1545 |
*/ |
|
1546 |
TInt64 iSize; |
|
1547 |
||
1548 |
||
1549 |
/** |
|
1550 |
The amount of free space on the volume in bytes. |
|
1551 |
*/ |
|
1552 |
TInt64 iFree; |
|
1553 |
||
1554 |
||
1555 |
/** |
|
1556 |
Name of the volume, with a maximum of KMaxFileName characters. |
|
1557 |
||
1558 |
This field is optional. |
|
1559 |
||
1560 |
@see KMaxFileName |
|
1561 |
*/ |
|
1562 |
TBufC<KMaxFileName> iName; |
|
1563 |
||
1564 |
/** |
|
1565 |
Flags which define the default file-caching behaviour for this volume |
|
1566 |
||
1567 |
@see TFileCacheFlags |
|
1568 |
*/ |
|
1569 |
TFileCacheFlags iFileCacheFlags; |
|
1570 |
||
1571 |
/** |
|
1572 |
@prototype |
|
1573 |
@internalTechnology |
|
1574 |
Internal flag, used in the case of non-blocking getting volume information. |
|
1575 |
@see RFs::Volume(TVolumeInfo& aVol,TInt aDrive, TRequestStatus& aStat) |
|
1576 |
||
1577 |
If this flag is set, it means that the volume information will be obtained |
|
1578 |
asynchronously. More specific, on return iFree will reflect the _current_ amount of free space on volume at the moment of |
|
1579 |
RFs::Volume() call, not the exact final value. This is because in this case getting volume information will be asynchronous, |
|
1580 |
and the client will not be suspended until the mount finish calculating free space. At present appicable to FAT32 file system only. |
|
1581 |
*/ |
|
1582 |
TUint8 iVolSizeAsync : 1; |
|
1583 |
||
1584 |
private: |
|
1585 |
/** |
|
1586 |
Reserved for future expansion |
|
1587 |
*/ |
|
1588 |
TUint8 i8Reserved1; |
|
1589 |
TUint16 i16Reserved1; |
|
1590 |
TUint32 i32Reserved1; |
|
1591 |
TUint32 i32Reserved2; |
|
1592 |
}; |
|
1593 |
||
1594 |
||
1595 |
||
1596 |
||
1597 |
class TDriveUnit |
|
1598 |
/** |
|
1599 |
@publishedAll |
|
1600 |
@released |
|
1601 |
||
1602 |
Drive numbers and letters. |
|
1603 |
||
1604 |
A drive may be represented by either an integer between zero and twenty five |
|
1605 |
inclusive, or by a buffer descriptor containing a character between "A" and "Z" |
|
1606 |
inclusive, followed by a colon. |
|
1607 |
This class encapsulates both representations. |
|
1608 |
An instance of this class is constructed specifying either the drive number |
|
1609 |
or the drive letter and may be converted between the two representations. |
|
1610 |
*/ |
|
1611 |
{ |
|
1612 |
public: |
|
1613 |
inline TDriveUnit() {}; |
|
1614 |
IMPORT_C TDriveUnit(TInt aDrive); |
|
1615 |
IMPORT_C TDriveUnit(const TDesC& aDrive); |
|
1616 |
IMPORT_C TDriveUnit& operator=(TInt aDrive); |
|
1617 |
IMPORT_C TDriveUnit& operator=(const TDesC& aDrive); |
|
1618 |
inline operator TInt() const; |
|
1619 |
IMPORT_C TDriveName Name() const; |
|
1620 |
private: |
|
1621 |
TInt iDrive; |
|
1622 |
}; |
|
1623 |
||
1624 |
||
1625 |
||
1626 |
||
1627 |
class RFs; |
|
1628 |
// |
|
1629 |
class TParseBase |
|
1630 |
/** |
|
1631 |
@publishedAll |
|
1632 |
@released |
|
1633 |
||
1634 |
Base class for file name parsing. |
|
1635 |
||
1636 |
You first need to set up the path to be parsed using either a TParse, TParsePtr |
|
1637 |
or TParsePtrC object. |
|
1638 |
||
1639 |
The interrogation and extraction functions in this class allow you to test |
|
1640 |
whether a component has been specified in the pathname, and if so, |
|
1641 |
to extract it. If a component is not present in the pathname, |
|
1642 |
the extraction function returns an empty string. |
|
1643 |
||
1644 |
This class also allows directories to be added to, and popped from the path. |
|
1645 |
||
1646 |
Notes: |
|
1647 |
||
1648 |
1. the filename modification functions cannot be used by the TParsePtrC class. |
|
1649 |
||
1650 |
2. navigation using .. and . is not supported. |
|
1651 |
||
1652 |
@see TParse |
|
1653 |
@see TParsePtr |
|
1654 |
@see TParsePtrC |
|
1655 |
*/ |
|
1656 |
{ |
|
1657 |
private: |
|
1658 |
struct SField {TUint8 pos;TUint8 len;TUint8 present;TUint8 filler;}; |
|
1659 |
enum TField {EDrive,EPath,EName,EExt,EMaxFields}; |
|
1660 |
enum TWild {EWildName=0x01,EWildExt=0x02,EWildEither=0x04,EIsRoot=0x08,EWildIsKMatchOne=0x10,EWildIsKMatchAny=0x20}; |
|
1661 |
public: |
|
1662 |
IMPORT_C TParseBase(); |
|
1663 |
IMPORT_C TInt PopDir(); |
|
1664 |
IMPORT_C TInt AddDir(const TDesC& aName); |
|
1665 |
IMPORT_C const TDesC& FullName() const; |
|
1666 |
IMPORT_C TPtrC Drive() const; |
|
1667 |
IMPORT_C TPtrC Path() const; |
|
1668 |
IMPORT_C TPtrC DriveAndPath() const; |
|
1669 |
IMPORT_C TPtrC Name() const; |
|
1670 |
IMPORT_C TPtrC Ext() const; |
|
1671 |
IMPORT_C TPtrC NameAndExt() const; |
|
1672 |
IMPORT_C TBool DrivePresent() const; |
|
1673 |
IMPORT_C TBool PathPresent() const; |
|
1674 |
IMPORT_C TBool NamePresent() const; |
|
1675 |
IMPORT_C TBool ExtPresent() const; |
|
1676 |
IMPORT_C TBool NameOrExtPresent() const; |
|
1677 |
IMPORT_C TBool IsRoot() const; |
|
1678 |
IMPORT_C TBool IsWild() const; |
|
1679 |
IMPORT_C TBool IsKMatchOne() const; |
|
1680 |
IMPORT_C TBool IsKMatchAny() const; |
|
1681 |
IMPORT_C TBool IsNameWild() const; |
|
1682 |
IMPORT_C TBool IsExtWild() const; |
|
1683 |
protected: |
|
1684 |
virtual TDes& NameBuf() = 0; // Reference to derived class descriptor containing the filename. |
|
1685 |
virtual const TDesC& NameBufC() const = 0; // const reference to derived class descriptor containing the filename. |
|
1686 |
TInt Set(const TDesC* aName,const TDesC* aRelated,const TDesC* aDefault,TBool allowWild); |
|
1687 |
private: |
|
1688 |
TInt ParseDrive(TLex& aName,TBool& aDone); |
|
1689 |
TInt ParsePath(TLex& aName,TBool& aDone); |
|
1690 |
TInt ParseName(TLex& aName,TBool& aDone); |
|
1691 |
TInt ParseExt(TLex& aName,TBool& aDone); |
|
1692 |
protected: |
|
1693 |
TInt16 iMod; // Non-zero indicates File name modification functionality is enabled. |
|
1694 |
private: |
|
1695 |
TInt16 iWild; |
|
1696 |
SField iField[EMaxFields]; |
|
1697 |
}; |
|
1698 |
||
1699 |
||
1700 |
||
1701 |
||
1702 |
class TParsePtr : public TParseBase |
|
1703 |
/** |
|
1704 |
@publishedAll |
|
1705 |
@released |
|
1706 |
||
1707 |
Parses filenames using less space on the stack than TParse. |
|
1708 |
||
1709 |
Stores a reference to a filename, unlike TParse, which uses |
|
1710 |
a 512 byte TFileName object as an internal buffer to store |
|
1711 |
a copy of the filename. |
|
1712 |
The filename's components (drive, path, etc.) can be retrieved using |
|
1713 |
the functions provided by the base class, TParseBase. |
|
1714 |
This class should be used in preference to TParse when minimising stack |
|
1715 |
usage is a priority. |
|
1716 |
||
1717 |
@see TParse |
|
1718 |
@see TFileName |
|
1719 |
*/ |
|
1720 |
{ |
|
1721 |
public: |
|
1722 |
IMPORT_C TParsePtr(TDes& aName); |
|
1723 |
protected: |
|
1724 |
IMPORT_C TDes& NameBuf(); |
|
1725 |
IMPORT_C const TDesC& NameBufC() const; |
|
1726 |
private: |
|
1727 |
TPtr iNameBuf; |
|
1728 |
}; |
|
1729 |
||
1730 |
||
1731 |
||
1732 |
||
1733 |
class TParsePtrC : public TParseBase |
|
1734 |
/** |
|
1735 |
@publishedAll |
|
1736 |
@released |
|
1737 |
||
1738 |
Parses, but cannot modify, filenames using less space on the stack than TParse. |
|
1739 |
||
1740 |
Stores a reference to a filename, unlike TParse, which uses |
|
1741 |
a 512 byte TFileName object as an internal buffer to store |
|
1742 |
a copy of the filename. |
|
1743 |
The filename's components (drive, path, etc.) can be retrieved using |
|
1744 |
the functions provided by the base class, TParseBase. |
|
1745 |
Note that because the filename cannot be modified through this class, |
|
1746 |
the base class functions PopDir() and AddDir() cannot be called, because |
|
1747 |
a panic will be raised. |
|
1748 |
||
1749 |
@see TParse |
|
1750 |
@see TFileName |
|
1751 |
*/ |
|
1752 |
{ |
|
1753 |
public: |
|
1754 |
IMPORT_C TParsePtrC(const TDesC& aName); |
|
1755 |
protected: |
|
1756 |
IMPORT_C TDes& NameBuf(); |
|
1757 |
IMPORT_C const TDesC& NameBufC() const; |
|
1758 |
private: |
|
1759 |
TPtrC iNameBuf; |
|
1760 |
}; |
|
1761 |
||
1762 |
||
1763 |
||
1764 |
||
1765 |
class TParse : public TParseBase |
|
1766 |
/** |
|
1767 |
@publishedAll |
|
1768 |
@released |
|
1769 |
||
1770 |
Parses filenames. |
|
1771 |
||
1772 |
The class uses the full filename structure supported by Symbian OS. |
|
1773 |
||
1774 |
TParse works by using the Set() function to set up the filename to be parsed. |
|
1775 |
Then, various getter functions defined in the base class, TParseBase, such as: |
|
1776 |
FullName(), Drive(), Path(), DriveAndPath(), Name(), Ext() and NameAndExt() |
|
1777 |
may be used to retrieve path components. |
|
1778 |
||
1779 |
There are a number of restrictions to valid path components, which are |
|
1780 |
described in guide documentation. |
|
1781 |
*/ |
|
1782 |
{ |
|
1783 |
public: |
|
1784 |
IMPORT_C TParse(); |
|
1785 |
IMPORT_C TInt Set(const TDesC& aName,const TDesC* aRelated,const TDesC* aDefault); |
|
1786 |
IMPORT_C TInt SetNoWild(const TDesC& aName,const TDesC* aRelated,const TDesC* aDefault); |
|
1787 |
protected: |
|
1788 |
IMPORT_C TDes& NameBuf(); |
|
1789 |
IMPORT_C const TDesC& NameBufC() const; |
|
1790 |
private: |
|
1791 |
TFileName iNameBuf; |
|
1792 |
}; |
|
1793 |
||
1794 |
||
1795 |
||
1796 |
||
1797 |
class CDir : public CBase |
|
1798 |
/** |
|
1799 |
@publishedAll |
|
1800 |
@released |
|
1801 |
||
1802 |
Array of directory entries that has been read into memory from the file system. |
|
1803 |
||
1804 |
It can be read and sorted by user programs, but cannot be created by them. |
|
1805 |
*/ |
|
1806 |
{ |
|
1807 |
public: |
|
1808 |
IMPORT_C virtual ~CDir(); |
|
1809 |
IMPORT_C TInt Count() const; |
|
1810 |
IMPORT_C const TEntry& operator[](TInt anIndex) const; |
|
1811 |
IMPORT_C TInt Sort(TUint aEntrySortKey); |
|
1812 |
protected: |
|
1813 |
IMPORT_C CDir(); |
|
1814 |
IMPORT_C static CDir* NewL(); |
|
1815 |
IMPORT_C void AddL(const TEntry& anEntry); |
|
1816 |
IMPORT_C void ExtractL(TBool aRemove,CDir*& aDir); |
|
1817 |
IMPORT_C void Compress(); |
|
1818 |
protected: |
|
1819 |
CArrayPakFlat<TEntry>* iArray; |
|
1820 |
friend class RFs; |
|
1821 |
friend class TOpenFileScan; |
|
1822 |
}; |
|
1823 |
||
1824 |
||
1825 |
#if defined SYMBIAN_PRIVATE_EFSRV |
|
1826 |
#define EFSRV_EXPORT_C |
|
1827 |
#define EFSRV_IMPORT_C |
|
1828 |
#else |
|
1829 |
#define EFSRV_EXPORT_C EXPORT_C |
|
1830 |
#define EFSRV_IMPORT_C IMPORT_C |
|
1831 |
#endif |
|
1832 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1833 |
// forward declarations from e32ldr_private.h |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1834 |
class RFileClamp; |
0 | 1835 |
|
1836 |
class RFs : public RSessionBase |
|
1837 |
/** |
|
1838 |
@publishedAll |
|
1839 |
@released |
|
1840 |
||
1841 |
A handle to a file server session. |
|
1842 |
||
1843 |
A program or thread may have arbitrarily many sessions open simultaneously. |
|
1844 |
||
1845 |
Use this class for all file system manipulation, including: |
|
1846 |
||
1847 |
1. adding, removing, moving and renaming files and directories |
|
1848 |
||
1849 |
2. inspecting and changing file attributes and directory entry details. |
|
1850 |
These include the time and date when the file or directory was last |
|
1851 |
written to, its size and various attribute flags such as read-only, |
|
1852 |
hidden, archive or system. |
|
1853 |
||
1854 |
3. finding a file’s real name; if the file system on which it is stored |
|
1855 |
has to "mangle" the name into a shorter format |
|
1856 |
||
1857 |
4. getting directory listings |
|
1858 |
||
1859 |
5. maintaining a default path; unlike some other systems, there is a single |
|
1860 |
system default path, rather than one for each drive: the default path |
|
1861 |
consists of a drive and a path specification. |
|
1862 |
||
1863 |
6. performing context-sensitive parses using TParse objects, and |
|
1864 |
the session path |
|
1865 |
||
1866 |
7. obtaining information on drives and volumes |
|
1867 |
||
1868 |
8. formatting and labelling volumes |
|
1869 |
||
1870 |
9. obtaining a list of valid drives |
|
1871 |
||
1872 |
10. emulating the DOS subst command, which allows any directory to appear |
|
1873 |
as if it were a separate drive |
|
1874 |
||
1875 |
11. requesting notification of when significant change occurs. |
|
1876 |
This can be used for programs which maintain file lists, but must |
|
1877 |
update those lists when change occurs. |
|
1878 |
||
1879 |
12. finding the version number of the file server |
|
1880 |
||
1881 |
13. resource counting to ensure that all resources are closed when |
|
1882 |
the session terminates. |
|
1883 |
||
1884 |
This class is not intended for user derivation. |
|
1885 |
||
1886 |
The following restrictions apply when a path is specified: |
|
1887 |
||
1888 |
1. its total length must not exceed 256 characters |
|
1889 |
||
1890 |
2. wildcards cannot be used in the drive or in any directory name, |
|
1891 |
although they may be allowed in the filename and extension. |
|
1892 |
||
1893 |
3. double backslashes are not allowed in the path. |
|
1894 |
||
1895 |
4. the following characters must not be included anywhere in the path: < > " / | |
|
1896 |
||
1897 |
5. a colon may only be included between the drive and path |
|
1898 |
||
1899 |
6. no directory name or filename plus extension may consist solely |
|
1900 |
of space characters, or of a single or double dot. |
|
1901 |
||
1902 |
7. spaces between the drive, if specified, and the first directory in |
|
1903 |
the path are illegal, although there may be spaces between other |
|
1904 |
path components, for instance between directories. |
|
1905 |
*/ |
|
1906 |
{ |
|
1907 |
public: |
|
1908 |
EFSRV_IMPORT_C TInt Connect(TInt aMessageSlots=KFileServerDefaultMessageSlots); |
|
1909 |
EFSRV_IMPORT_C void Close(); |
|
1910 |
EFSRV_IMPORT_C TVersion Version() const; |
|
1911 |
EFSRV_IMPORT_C TInt AddFileSystem(const TDesC& aFileName) const; |
|
1912 |
EFSRV_IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const; |
|
1913 |
EFSRV_IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,TInt aDrive, TBool aIsSync) const; |
|
1914 |
EFSRV_IMPORT_C TInt MountFileSystemAndScan(const TDesC& aFileSystemName,TInt aDrive,TBool& aIsMountSuccess) const; |
|
1915 |
EFSRV_IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive); |
|
1916 |
EFSRV_IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive, TBool aIsSync); |
|
1917 |
EFSRV_IMPORT_C TInt MountFileSystemAndScan(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive,TBool& aIsMountSuccess) const; |
|
1918 |
EFSRV_IMPORT_C TInt DismountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const; |
|
1919 |
EFSRV_IMPORT_C TInt RemoveFileSystem(const TDesC& aFileSystemName) const; |
|
1920 |
EFSRV_IMPORT_C TInt FileSystemName(TDes& aName,TInt aDrive) const; |
|
1921 |
EFSRV_IMPORT_C TInt AddExtension(const TDesC& aFileName); |
|
1922 |
EFSRV_IMPORT_C TInt MountExtension(const TDesC& aExtensionName,TInt aDrive); |
|
1923 |
EFSRV_IMPORT_C TInt DismountExtension(const TDesC& aExtensionName,TInt aDrive); |
|
1924 |
EFSRV_IMPORT_C TInt RemoveExtension(const TDesC& aExtensionName); |
|
1925 |
EFSRV_IMPORT_C TInt ExtensionName(TDes& aExtensionName,TInt aDrive,TInt aPos); |
|
1926 |
EFSRV_IMPORT_C TInt RemountDrive(TInt aDrive,const TDesC8* aMountInfo=NULL,TUint aFlags=0); |
|
1927 |
EFSRV_IMPORT_C void NotifyChange(TNotifyType aType,TRequestStatus& aStat); |
|
1928 |
EFSRV_IMPORT_C void NotifyChange(TNotifyType aType,TRequestStatus& aStat,const TDesC& aPathName); |
|
1929 |
EFSRV_IMPORT_C void NotifyChangeCancel(); |
|
1930 |
EFSRV_IMPORT_C void NotifyChangeCancel(TRequestStatus& aStat); |
|
1931 |
EFSRV_IMPORT_C void NotifyDiskSpace(TInt64 aThreshold,TInt aDrive,TRequestStatus& aStat); |
|
1932 |
EFSRV_IMPORT_C void NotifyDiskSpaceCancel(TRequestStatus& aStat); |
|
1933 |
EFSRV_IMPORT_C void NotifyDiskSpaceCancel(); |
|
1934 |
EFSRV_IMPORT_C TInt DriveList(TDriveList& aList) const; |
|
1935 |
EFSRV_IMPORT_C TInt DriveList(TDriveList& aList, TUint aFlags) const; |
|
1936 |
EFSRV_IMPORT_C TInt Drive(TDriveInfo& anInfo,TInt aDrive=KDefaultDrive) const; |
|
1937 |
EFSRV_IMPORT_C TInt Volume(TVolumeInfo& aVol,TInt aDrive=KDefaultDrive) const; |
|
1938 |
EFSRV_IMPORT_C void Volume(TVolumeInfo& aVol,TInt aDrive, TRequestStatus& aStat) const; |
|
1939 |
EFSRV_IMPORT_C TInt SetVolumeLabel(const TDesC& aName,TInt aDrive=KDefaultDrive); |
|
1940 |
EFSRV_IMPORT_C TInt Subst(TDes& aPath,TInt aDrive=KDefaultDrive) const; |
|
1941 |
EFSRV_IMPORT_C TInt SetSubst(const TDesC& aPath,TInt aDrive=KDefaultDrive); |
|
1942 |
EFSRV_IMPORT_C TInt RealName(const TDesC& aName,TDes& aResult) const; |
|
1943 |
EFSRV_IMPORT_C TInt GetMediaSerialNumber(TMediaSerialNumber& aSerialNum, TInt aDrive); |
|
1944 |
EFSRV_IMPORT_C TInt SessionPath(TDes& aPath) const; |
|
1945 |
EFSRV_IMPORT_C TInt SetSessionPath(const TDesC& aPath); |
|
1946 |
EFSRV_IMPORT_C TInt Parse(const TDesC& aName,TParse& aParse) const; |
|
1947 |
EFSRV_IMPORT_C TInt Parse(const TDesC& aName,const TDesC& aRelated,TParse& aParse) const; |
|
1948 |
EFSRV_IMPORT_C TInt MkDir(const TDesC& aPath); |
|
1949 |
EFSRV_IMPORT_C TInt MkDirAll(const TDesC& aPath); |
|
1950 |
EFSRV_IMPORT_C TInt RmDir(const TDesC& aPath); |
|
1951 |
EFSRV_IMPORT_C TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList) const; |
|
1952 |
EFSRV_IMPORT_C TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList) const; |
|
1953 |
EFSRV_IMPORT_C TInt GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey,CDir*& aFileList) const; |
|
1954 |
EFSRV_IMPORT_C TInt Delete(const TDesC& aName); |
|
1955 |
EFSRV_IMPORT_C TInt Rename(const TDesC& anOldName,const TDesC& aNewName); |
|
1956 |
EFSRV_IMPORT_C TInt Replace(const TDesC& anOldName,const TDesC& aNewName); |
|
1957 |
EFSRV_IMPORT_C TInt Att(const TDesC& aName,TUint& aAttValue) const; |
|
1958 |
EFSRV_IMPORT_C TInt SetAtt(const TDesC& aName,TUint aSetAttMask,TUint aClearAttMask); |
|
1959 |
EFSRV_IMPORT_C TInt Modified(const TDesC& aName,TTime& aTime) const; |
|
1960 |
EFSRV_IMPORT_C TInt SetModified(const TDesC& aName,const TTime& aTime); |
|
1961 |
EFSRV_IMPORT_C TInt Entry(const TDesC& aName,TEntry& anEntry) const; |
|
1962 |
EFSRV_IMPORT_C TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); |
|
1963 |
private: |
|
1964 |
EFSRV_IMPORT_C TInt ReadFileSection_RESERVED(const TDesC& aName,TInt aPos,TDes8& aDes,TInt aLength) const; |
|
1965 |
public: |
|
1966 |
EFSRV_IMPORT_C static TBool IsValidDrive(TInt aDrive); |
|
1967 |
EFSRV_IMPORT_C static TInt CharToDrive(TChar aChar,TInt& aDrive); |
|
1968 |
EFSRV_IMPORT_C static TInt DriveToChar(TInt aDrive,TChar& aChar); |
|
1969 |
EFSRV_IMPORT_C static TBool IsRomAddress(TAny* aAny); |
|
1970 |
EFSRV_IMPORT_C static TDriveNumber GetSystemDrive(); |
|
1971 |
EFSRV_IMPORT_C static TChar GetSystemDriveChar(); |
|
1972 |
EFSRV_IMPORT_C TInt SetSystemDrive(TDriveNumber aSystemDrive); |
|
1973 |
EFSRV_IMPORT_C void ResourceCountMarkStart() const; |
|
1974 |
EFSRV_IMPORT_C void ResourceCountMarkEnd() const; |
|
1975 |
EFSRV_IMPORT_C TInt ResourceCount() const; |
|
1976 |
EFSRV_IMPORT_C TInt IsFileOpen(const TDesC& aFile,TBool& anAnswer) const; |
|
1977 |
EFSRV_IMPORT_C TInt CheckDisk(const TDesC& aDrive) const; |
|
1978 |
EFSRV_IMPORT_C TInt ScanDrive(const TDesC& aDrive) const; |
|
1979 |
EFSRV_IMPORT_C TInt GetShortName(const TDesC& aLongName,TDes& aShortName) const; |
|
1980 |
EFSRV_IMPORT_C TInt GetLongName(const TDesC& aShortName,TDes& aLongName) const; |
|
1981 |
EFSRV_IMPORT_C TBool GetNotifyUser(); |
|
1982 |
EFSRV_IMPORT_C void SetNotifyUser(TBool aValue); |
|
1983 |
EFSRV_IMPORT_C TUint8* IsFileInRom(const TDesC& aFileName) const; |
|
1984 |
EFSRV_IMPORT_C TBool IsValidName(const TDesC& anEntryName) const; |
|
1985 |
EFSRV_IMPORT_C TBool IsValidName(const TDesC& aFileName,TText& aBadChar) const; |
|
1986 |
EFSRV_IMPORT_C TInt GetDriveName(TInt aDrive,TDes& aDriveName) const; |
|
1987 |
EFSRV_IMPORT_C TInt SetDriveName(TInt aDrive,const TDesC& aDriveName); |
|
1988 |
EFSRV_IMPORT_C TInt LoaderHeapFunction(TInt aFunction, TAny *aArg1=NULL, TAny *aArg2=NULL); |
|
1989 |
IMPORT_C TInt SetErrorCondition(TInt anError,TInt aCount=0); |
|
1990 |
EFSRV_IMPORT_C TInt SetDebugRegister(TInt aVal); |
|
1991 |
EFSRV_IMPORT_C TInt SetAllocFailure(TInt aAllocNum); |
|
1992 |
EFSRV_IMPORT_C void DebugNotify(TInt aDrive,TUint aNotifyType,TRequestStatus& aStat); |
|
1993 |
EFSRV_IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand); |
|
1994 |
EFSRV_IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TDes8& aParam1); |
|
1995 |
EFSRV_IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TDes8& aParam1,TDes8& aParam2); |
|
1996 |
EFSRV_IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TAny* aParam1,TAny* aParam2); |
|
1997 |
EFSRV_IMPORT_C TInt LockDrive(TInt aDrv, const TMediaPassword &aOld, const TMediaPassword &aNew, TBool aStr); |
|
1998 |
EFSRV_IMPORT_C TInt UnlockDrive(TInt aDrv, const TMediaPassword &Pswd, TBool aStr); |
|
1999 |
EFSRV_IMPORT_C TInt ClearPassword(TInt aDrv, const TMediaPassword &aPswd); |
|
2000 |
EFSRV_IMPORT_C TInt ErasePassword(TInt aDrv); |
|
2001 |
EFSRV_IMPORT_C TInt SetSessionToPrivate(TInt aDrive); |
|
2002 |
EFSRV_IMPORT_C TInt PrivatePath(TDes& aPath); |
|
2003 |
EFSRV_IMPORT_C TInt CreatePrivatePath(TInt aDrive); |
|
2004 |
EFSRV_IMPORT_C void StartupInitComplete(TRequestStatus& aStat); |
|
2005 |
EFSRV_IMPORT_C TInt SetLocalDriveMapping(const TDesC8& aMapping); |
|
2006 |
||
2007 |
EFSRV_IMPORT_C TInt FinaliseDrives(); |
|
2008 |
||
2009 |
/** specifies drive finalisation modes */ |
|
2010 |
enum TFinaliseDrvMode |
|
2011 |
{ |
|
2012 |
EFinal_RW, ///< after successful finalisation the drive remains writable and will become "not finalised" after the first write operation. |
|
2013 |
EFinal_RO, ///< after successful finalisation the drive becomes read-only |
|
2014 |
EForceUnfinalise///< @internalComponent mark the drive as "not finalised" can result in KErrAbort if the dive is in inconsistent state. |
|
2015 |
}; |
|
2016 |
||
2017 |
EFSRV_IMPORT_C TInt FinaliseDrive(TInt aDriveNo, TFinaliseDrvMode aMode) const; |
|
2018 |
||
2019 |
EFSRV_IMPORT_C TInt SwapFileSystem(const TDesC& aOldFileSystemName,const TDesC& aNewFileSystemName,TInt aDrive) const; |
|
2020 |
EFSRV_IMPORT_C TInt ReserveDriveSpace(TInt aDriveNo, TInt aSpace); |
|
2021 |
EFSRV_IMPORT_C TInt GetReserveAccess(TInt aDriveNo); |
|
2022 |
EFSRV_IMPORT_C TInt ReleaseReserveAccess(TInt aDriveNo); |
|
2023 |
||
2024 |
EFSRV_IMPORT_C TInt AddPlugin(const TDesC& aFileName) const; |
|
2025 |
EFSRV_IMPORT_C TInt RemovePlugin(const TDesC& aPluginName) const; |
|
2026 |
EFSRV_IMPORT_C TInt PluginName(TDes& aPluginName,TInt aDrive,TInt aPos); |
|
2027 |
||
2028 |
EFSRV_IMPORT_C TInt MountPlugin(const TDesC& aPluginName) const; |
|
2029 |
EFSRV_IMPORT_C TInt MountPlugin(const TDesC& aPluginName,TInt aDrive) const; |
|
2030 |
EFSRV_IMPORT_C TInt MountPlugin(const TDesC& aPluginName,TInt aDrive, TInt aPos) const; |
|
2031 |
||
2032 |
EFSRV_IMPORT_C TInt DismountPlugin(const TDesC& aPluginName) const; |
|
2033 |
EFSRV_IMPORT_C TInt DismountPlugin(const TDesC& aPluginName,TInt aDrive) const; |
|
2034 |
EFSRV_IMPORT_C TInt DismountPlugin(const TDesC& aPluginName,TInt aDrive,TInt aPos) const; |
|
2035 |
||
2036 |
EFSRV_IMPORT_C void NotifyDismount(TInt aDrive, TRequestStatus& aStat, TNotifyDismountMode aMode=EFsDismountRegisterClient) const; |
|
2037 |
EFSRV_IMPORT_C void NotifyDismountCancel(TRequestStatus& aStat) const; |
|
2038 |
EFSRV_IMPORT_C void NotifyDismountCancel() const; |
|
2039 |
EFSRV_IMPORT_C TInt AllowDismount(TInt aDrive) const; |
|
2040 |
EFSRV_IMPORT_C TInt SetStartupConfiguration(TInt aCommand,TAny* aParam1,TAny* aParam2) const; |
|
2041 |
EFSRV_IMPORT_C TInt AddCompositeMount(const TDesC& aFileSystemName,TInt aLocalDriveToMount,TInt aCompositeDrive, TBool aSync) const; |
|
2042 |
EFSRV_IMPORT_C TInt SetNotifyChange(TBool aNotifyChange); |
|
2043 |
EFSRV_IMPORT_C TInt QueryVolumeInfoExt(TInt aDrive, TQueryVolumeInfoExtCmd aCommand, TDes8& aInfo) const; |
|
2044 |
EFSRV_IMPORT_C TInt VolumeIOParam(TInt aDriveNo, TVolumeIOParamInfo& aParamInfo) const; |
|
2045 |
EFSRV_IMPORT_C TInt FileSystemSubType(TInt aDriveNo, TDes& aName) const; |
|
2046 |
EFSRV_IMPORT_C TInt InitialisePropertiesFile(const TPtrC8& aPtr) const; |
|
2047 |
||
2048 |
IMPORT_C TInt AddProxyDrive(const TDesC& aFileName); |
|
2049 |
IMPORT_C TInt RemoveProxyDrive(const TDesC& aDriveName); |
|
2050 |
||
2051 |
template <class T0,class T1> inline TInt MountProxyDrive(const TUint aDrive, const TDesC& aName, T0 a0, T1 a1) |
|
2052 |
{ return(DoMountProxyDrive(TIpcArgs(aDrive, &aName, a0, a1))); }; |
|
2053 |
IMPORT_C TInt DismountProxyDrive(const TUint aDrive); |
|
2054 |
||
2055 |
TInt Unclamp(const RFileClamp& aHandle); |
|
2056 |
||
2057 |
EFSRV_IMPORT_C TInt ReadFileSection(const TDesC& aName,TInt64 aPos,TDes8& aDes,TInt aLength) const; |
|
2058 |
||
2059 |
/** |
|
2060 |
This class is used to for returning meaningful error code values to users of RFs::IsValidName(const TDesC& ,TNameValidParam& ) |
|
2061 |
@see TError |
|
2062 |
*/ |
|
2063 |
class TNameValidParam |
|
2064 |
{ |
|
2065 |
public: |
|
2066 |
/** Initialises the members of the class. By default iUseSessionPath is set to EFalse, however one could set it to ETrue.*/ |
|
2067 |
inline TNameValidParam(TBool aUseSessionPath = EFalse); |
|
2068 |
||
2069 |
/** possible error codes */ |
|
2070 |
enum TError |
|
2071 |
{ |
|
2072 |
ErrNone, ///< no error. |
|
2073 |
ErrBadCharacter, ///< aName contains a bad character; and its position is in iInvalidCharPos. |
|
2074 |
ErrBadName, ///< aName isn't a valid file or directory name. |
|
2075 |
ErrNameTooLong ///< aName length or aName + session path length (see iUseSessionPath) is longer than 256 characters. |
|
2076 |
}; |
|
2077 |
||
2078 |
inline TError ErrorCode() const; |
|
2079 |
inline void UseSessionPath(TBool aUseSessionPath); |
|
2080 |
inline TUint InvalidCharPos() const; |
|
2081 |
friend class TFsIsValidName; |
|
2082 |
private: |
|
2083 |
TError iError; ///< the reason why aName is invalid, see TError |
|
2084 |
TBool iUseSessionPath; ///< if ETrue, and if aName isn't fully specified, missing parts will be taken from the session path |
|
2085 |
TUint iInvalidCharPos; ///< may contain invalid character position if error is ErrBadCharacter,else 0. |
|
2086 |
}; |
|
2087 |
EFSRV_IMPORT_C TBool IsValidName(const TDesC& aName, TNameValidParam& aParam ); |
|
2088 |
||
2089 |
/** Special enumerator values for the SupportedFileSystemName() API */ |
|
2090 |
enum |
|
2091 |
{ |
|
2092 |
KRootFileSystem = 0x00800000, ///< specifies "root" file system. The result will be the same as for FileSystemName() API call |
|
2093 |
KFirstChildFileSystem = 0 ///< specifies the first child file system number, the second will be KFirstChildFileSystem+1 etc. |
|
2094 |
}; |
|
2095 |
||
2096 |
EFSRV_IMPORT_C TInt SupportedFileSystemName(TDes& aName, TInt aDrive, TInt aFsEnumerator) const; |
|
2097 |
||
2098 |
protected: |
|
2099 |
TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; |
|
2100 |
||
2101 |
private: |
|
2102 |
void GetDirL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList,RDir& aDir) const; |
|
2103 |
void GetDirL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const; |
|
2104 |
void GetDirL(const TDesC& aMatchName,const TUidType& aUidType,TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const; |
|
2105 |
void DoGetDirL(TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const; |
|
2106 |
TInt GetOpenFileList(TInt& aSessionNum,TInt& aLocalPos,TThreadId& aThreadId,TEntryArray& anArray) const; |
|
2107 |
||
2108 |
IMPORT_C TInt DoMountProxyDrive(const TIpcArgs& ipcArgs); |
|
2109 |
||
2110 |
friend class TOpenFileScan; |
|
2111 |
friend class RFsPlugin; |
|
2112 |
}; |
|
2113 |
||
2114 |
||
2115 |
//------------------------------------------------------------------------------------------------------------------- |
|
2116 |
||
2117 |
/** |
|
2118 |
||
2119 |
Base class for volume formatting parameters. This class package buffer, TVolFormatParamBuf or |
|
2120 |
packaged buffer of the derived class can be passed to the RFormat::Open() in order to provide |
|
2121 |
file system-specific formatting parameters. |
|
2122 |
Each file system that supports such formatting parameters shall have this class specialisation (e.g. TVolFormatParam_FAT) |
|
2123 |
All classes, derived from this one must have the same size as the base class. |
|
2124 |
In order to use formatting parameters the format mode shall have ESpecialFormat bit flag set. |
|
2125 |
||
2126 |
||
2127 |
@see RFormat::Open(RFs&,const TDesC&,TUint,TInt& ,const TDesC8& anInfo); |
|
2128 |
@see TVolFormatParamBuf |
|
2129 |
||
2130 |
@publishedAll |
|
2131 |
@released |
|
2132 |
*/ |
|
2133 |
class TVolFormatParam |
|
2134 |
{ |
|
2135 |
public: |
|
2136 |
inline TVolFormatParam(); |
|
2137 |
inline void Init(); |
|
2138 |
||
2139 |
inline void SetFileSystemName(const TDesC& aFsName); |
|
2140 |
||
2141 |
static inline TUint32 CalcFSNameHash(const TDesC& aFsName); |
|
2142 |
inline TUint32 FSNameHash() const; |
|
2143 |
||
2144 |
inline TBool SomeParamsSet() const; |
|
2145 |
||
2146 |
||
2147 |
protected: |
|
2148 |
||
2149 |
||
2150 |
enum {KMaxDataSlots = 64}; ///< the size of data array iData |
|
2151 |
||
2152 |
inline void SetVal(TUint aIndex, TUint32 aVal); |
|
2153 |
inline TUint32 GetVal(TUint aIndex) const; |
|
2154 |
||
2155 |
||
2156 |
public: |
|
2157 |
enum {KUId = 0x820116A2}; ///< this value shell be in iUid field to identify this class object |
|
2158 |
||
2159 |
/** |
|
2160 |
This class tree UID. Used to distinguish the object of this class from TLDFormatInfo and other possible data structures. |
|
2161 |
For this and derived classes this field must be KUId. This field offset in the class must be 0 |
|
2162 |
*/ |
|
2163 |
const TUint32 iUId; |
|
2164 |
||
2165 |
private: |
|
2166 |
TUint32 iFSysNameHash; ///< Up-cased file system name hash (crc32) used to designate the file system. 0 means "not set" |
|
2167 |
TBool iParamsSet : 1; ///< ETrue if any parameter was set (SetVal() called). Gets reset to EFalse by Init() |
|
2168 |
TUint32 iData[KMaxDataSlots]; ///< used as a pool for various data. The derived classes are free to use it by SetVal()/GetVal() |
|
2169 |
}; |
|
2170 |
||
2171 |
__ASSERT_COMPILE(_FOFF(TVolFormatParam, iUId) == 0); |
|
2172 |
||
2173 |
||
2174 |
/** package buffer for the objects of class TVolFormatParamBuf */ |
|
2175 |
typedef TPckgBuf<TVolFormatParam> TVolFormatParamBuf; |
|
2176 |
||
2177 |
||
2178 |
||
2179 |
||
2180 |
#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
2181 |
/** |
|
2182 |
@publishedAll |
|
2183 |
@released |
|
2184 |
||
2185 |
Creates and opens a file, and performs all operations on a single open file. |
|
2186 |
||
2187 |
These include: |
|
2188 |
||
2189 |
- reading from and writing to the file |
|
2190 |
||
2191 |
- seeking to a position within the file |
|
2192 |
||
2193 |
- locking and unlocking within the file |
|
2194 |
||
2195 |
- setting file attributes |
|
2196 |
||
2197 |
Before using any of these services, a connection to a file server session must |
|
2198 |
have been made, and the file must be open. |
|
2199 |
||
2200 |
Opening Files: |
|
2201 |
||
2202 |
- use Open() to open an existing file for reading or writing; an error is |
|
2203 |
returned if it does not already exist. |
|
2204 |
To open an existing file for reading only, use Open() with an access mode of |
|
2205 |
EFileRead, and a share mode of EFileShareReadersOnly. |
|
2206 |
||
2207 |
- use Create() to create and open a new file for writing; an error is returned |
|
2208 |
if it already exists. |
|
2209 |
||
2210 |
- use Replace() to open a file for writing, replacing any existing file of |
|
2211 |
the same name if one exists, or creating a new file if one does not exist. |
|
2212 |
Note that if a file exists, its length is reset to zero. |
|
2213 |
||
2214 |
- use Temp() to create and open a temporary file with a unique name, |
|
2215 |
for writing and reading. |
|
2216 |
||
2217 |
When opening a file, you must specify the file server session to use for |
|
2218 |
operations with that file. If you do not close the file explicitly, it is |
|
2219 |
closed when the server session associated with it is closed. |
|
2220 |
||
2221 |
Reading and Writing: |
|
2222 |
||
2223 |
There are several variants of both Read() and Write(). |
|
2224 |
The basic Read(TDes8& aDes) and Write(const TDesC8& aDes) are supplemented |
|
2225 |
by variants allowing the descriptor length to be overridden, or the seek |
|
2226 |
position of the first byte to be specified, or asynchronous completion, |
|
2227 |
or any combination. |
|
2228 |
||
2229 |
Reading transfers data from a file to a descriptor, and writing transfers |
|
2230 |
data from a descriptor to a file. In all cases, the file data is treated |
|
2231 |
as binary and byte descriptors are used (TDes8, TDesC8). |
|
2232 |
||
2233 |
@see TDes8 |
|
2234 |
@see TDesC8 |
|
2235 |
*/ |
|
2236 |
#else |
|
2237 |
/** |
|
2238 |
@publishedAll |
|
2239 |
@released |
|
2240 |
||
2241 |
Creates and opens a file, and performs all operations on a single open file. |
|
2242 |
||
2243 |
These include: |
|
2244 |
||
2245 |
- reading from and writing to the file |
|
2246 |
||
2247 |
- seeking to a position within the file |
|
2248 |
||
2249 |
- locking and unlocking within the file |
|
2250 |
||
2251 |
- setting file attributes |
|
2252 |
||
2253 |
Before using any of these services, a connection to a file server session must |
|
2254 |
have been made, and the file must be open. |
|
2255 |
||
2256 |
Opening Files: |
|
2257 |
||
2258 |
- use Open() to open an existing file for reading or writing; an error is |
|
2259 |
returned if it does not already exist. |
|
2260 |
To open an existing file for reading only, use Open() with an access mode of |
|
2261 |
EFileRead, and a share mode of EFileShareReadersOnly. |
|
2262 |
||
2263 |
- use Create() to create and open a new file for writing; an error is returned |
|
2264 |
if it already exists. |
|
2265 |
||
2266 |
- use Replace() to open a file for writing, replacing any existing file of |
|
2267 |
the same name if one exists, or creating a new file if one does not exist. |
|
2268 |
Note that if a file exists, its length is reset to zero. |
|
2269 |
||
2270 |
- use Temp() to create and open a temporary file with a unique name, |
|
2271 |
for writing and reading. |
|
2272 |
||
2273 |
When opening a file, you must specify the file server session to use for |
|
2274 |
operations with that file. If you do not close the file explicitly, it is |
|
2275 |
closed when the server session associated with it is closed. |
|
2276 |
||
2277 |
Reading and Writing: |
|
2278 |
||
2279 |
There are several variants of both Read() and Write(). |
|
2280 |
The basic Read(TDes8& aDes) and Write(const TDesC8& aDes) are supplemented |
|
2281 |
by variants allowing the descriptor length to be overridden, or the seek |
|
2282 |
position of the first byte to be specified, or asynchronous completion, |
|
2283 |
or any combination. |
|
2284 |
||
2285 |
Reading transfers data from a file to a descriptor, and writing transfers |
|
2286 |
data from a descriptor to a file. In all cases, the file data is treated |
|
2287 |
as binary and byte descriptors are used (TDes8, TDesC8). |
|
2288 |
||
2289 |
RFile class supports operations on files of size less than or equal to 2GB - 1. |
|
2290 |
If the file size is greater than 2GB - 1 (large file), use of class RFile64 is |
|
2291 |
recommended for following operations: |
|
2292 |
1. Opening a large file |
|
2293 |
2. Creating a file which can grow beyond 2GB - 1 by size |
|
2294 |
3. Creating a temporary file which can grow beyond 2GB - 1 by size |
|
2295 |
4. Replacing an existing file after which it can grow beyond 2GB - 1 by size |
|
2296 |
5. Adopting a large file handle from client |
|
2297 |
6. Adopting a large file handle from server |
|
2298 |
7. Adopting a large file handle from another process |
|
2299 |
8. Read from a position greater than 2GB - 1 |
|
2300 |
9. Writing to a file by which the size can grow beyond 2GB - 1 |
|
2301 |
10. Seek to a position greater than 2GB - 1 |
|
2302 |
11. Setting a size greater than 2GB - 1 |
|
2303 |
12. Querying the file size (greater than 2GB - 1) |
|
2304 |
13. Locking and unlocking a position and length that is beyond 2GB - 1 |
|
2305 |
||
2306 |
@see TDes8 |
|
2307 |
@see TDesC8 |
|
2308 |
||
2309 |
@see RFile64 |
|
2310 |
||
2311 |
*/ |
|
2312 |
||
2313 |
#endif |
|
2314 |
||
2315 |
||
2316 |
class RFile : public RSubSessionBase |
|
2317 |
{ |
|
2318 |
public: |
|
2319 |
EFSRV_IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFileMode); |
|
2320 |
EFSRV_IMPORT_C void Close(); |
|
2321 |
EFSRV_IMPORT_C TInt Create(RFs& aFs,const TDesC& aName,TUint aFileMode); |
|
2322 |
EFSRV_IMPORT_C TInt Replace(RFs& aFs,const TDesC& aName,TUint aFileMode); |
|
2323 |
EFSRV_IMPORT_C TInt Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode); |
|
2324 |
EFSRV_IMPORT_C TInt Read(TDes8& aDes) const; |
|
2325 |
EFSRV_IMPORT_C void Read(TDes8& aDes,TRequestStatus& aStatus) const; |
|
2326 |
EFSRV_IMPORT_C TInt Read(TDes8& aDes,TInt aLength) const; |
|
2327 |
EFSRV_IMPORT_C void Read(TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const; |
|
2328 |
EFSRV_IMPORT_C TInt Read(TInt aPos,TDes8& aDes) const; |
|
2329 |
EFSRV_IMPORT_C void Read(TInt aPos,TDes8& aDes,TRequestStatus& aStatus) const; |
|
2330 |
EFSRV_IMPORT_C TInt Read(TInt aPos,TDes8& aDes,TInt aLength) const; |
|
2331 |
EFSRV_IMPORT_C void Read(TInt aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const; |
|
2332 |
EFSRV_IMPORT_C void ReadCancel(TRequestStatus& aStatus) const; |
|
2333 |
EFSRV_IMPORT_C void ReadCancel() const; |
|
2334 |
EFSRV_IMPORT_C TInt Write(const TDesC8& aDes); |
|
2335 |
EFSRV_IMPORT_C void Write(const TDesC8& aDes,TRequestStatus& aStatus); |
|
2336 |
EFSRV_IMPORT_C TInt Write(const TDesC8& aDes,TInt aLength); |
|
2337 |
EFSRV_IMPORT_C void Write(const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); |
|
2338 |
EFSRV_IMPORT_C TInt Write(TInt aPos,const TDesC8& aDes); |
|
2339 |
EFSRV_IMPORT_C void Write(TInt aPos,const TDesC8& aDes,TRequestStatus& aStatus); |
|
2340 |
EFSRV_IMPORT_C TInt Write(TInt aPos,const TDesC8& aDes,TInt aLength); |
|
2341 |
EFSRV_IMPORT_C void Write(TInt aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); |
|
2342 |
EFSRV_IMPORT_C TInt Lock(TInt aPos,TInt aLength) const; |
|
2343 |
EFSRV_IMPORT_C TInt UnLock(TInt aPos,TInt aLength) const; |
|
2344 |
EFSRV_IMPORT_C TInt Seek(TSeek aMode,TInt& aPos) const; |
|
2345 |
EFSRV_IMPORT_C TInt Flush(); |
|
2346 |
EFSRV_IMPORT_C void Flush(TRequestStatus& aStatus); |
|
2347 |
EFSRV_IMPORT_C TInt Size(TInt& aSize) const; |
|
2348 |
EFSRV_IMPORT_C TInt SetSize(TInt aSize); |
|
2349 |
EFSRV_IMPORT_C TInt Att(TUint& aAttValue) const; |
|
2350 |
EFSRV_IMPORT_C TInt SetAtt(TUint aSetAttMask,TUint aClearAttMask); |
|
2351 |
EFSRV_IMPORT_C TInt Modified(TTime& aTime) const; |
|
2352 |
EFSRV_IMPORT_C TInt SetModified(const TTime& aTime); |
|
2353 |
EFSRV_IMPORT_C TInt Set(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); |
|
2354 |
EFSRV_IMPORT_C TInt ChangeMode(TFileMode aNewMode); |
|
2355 |
EFSRV_IMPORT_C TInt Rename(const TDesC& aNewName); |
|
2356 |
EFSRV_IMPORT_C TInt Drive(TInt &aDriveNumber, TDriveInfo &aDriveInfo) const; |
|
2357 |
EFSRV_IMPORT_C TInt Adopt(RFs& aFs, TInt aHandle); |
|
2358 |
EFSRV_IMPORT_C TInt AdoptFromClient(const RMessage2& aMsg, TInt aFsHandleIndex, TInt aFileHandleIndex); |
|
2359 |
EFSRV_IMPORT_C TInt AdoptFromServer(TInt aFsHandle, TInt aFileHandle); |
|
2360 |
EFSRV_IMPORT_C TInt AdoptFromCreator(TInt aFsIndex, TInt aFileHandleIndex); |
|
2361 |
EFSRV_IMPORT_C TInt Name(TDes& aName) const; |
|
2362 |
EFSRV_IMPORT_C TInt TransferToServer(TIpcArgs& aIpcArgs, TInt aFsHandleIndex, TInt aFileHandleIndex) const; |
|
2363 |
EFSRV_IMPORT_C TInt TransferToClient(const RMessage2& aMsg, TInt aFileHandleIndex) const; |
|
2364 |
EFSRV_IMPORT_C TInt TransferToProcess(RProcess& aProcess, TInt aFsHandleIndex, TInt aFileHandleIndex) const; |
|
2365 |
EFSRV_IMPORT_C TInt Duplicate(const RFile& aFile, TOwnerType aType=EOwnerProcess); |
|
2366 |
EFSRV_IMPORT_C TInt FullName(TDes& aName) const; |
|
2367 |
EFSRV_IMPORT_C TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos=-1, TInt aBlockMapusage=EBlockMapUsagePaging) const; |
|
2368 |
TInt Clamp(RFileClamp& aHandle); |
|
2369 |
||
2370 |
protected: |
|
2371 |
// RSubSessionBase overrides |
|
2372 |
TInt CreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs); |
|
2373 |
void CloseSubSession(TInt aFunction); |
|
2374 |
TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; |
|
2375 |
||
2376 |
TInt DuplicateHandle(TInt& aSubSessionHandle) const; |
|
2377 |
||
2378 |
friend class RFilePlugin; |
|
2379 |
}; |
|
2380 |
||
2381 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
2382 |
#include <f32file64.h> |
|
2383 |
#endif |
|
2384 |
||
2385 |
class RDir : public RSubSessionBase |
|
2386 |
/** |
|
2387 |
@publishedAll |
|
2388 |
@released |
|
2389 |
||
2390 |
Reads the entries contained in a directory. |
|
2391 |
||
2392 |
You must first open the directory, specifying an attribute mask which is used |
|
2393 |
by Read() calls to filter the entry types required. Then, use one of |
|
2394 |
the Read() functions to read the filtered entries. When the operation |
|
2395 |
is complete, the directory should be closed using Close() |
|
2396 |
||
2397 |
There are two types of Read(): one works with a single entry at a time, |
|
2398 |
requiring programs to iterate through the entries explicitly. |
|
2399 |
The other works with an entire TEntryArray, allowing multiple entries to be |
|
2400 |
read in one call. |
|
2401 |
As well as making application program logic somewhat simpler, this type |
|
2402 |
uses fewer calls to the server, and is more efficient. |
|
2403 |
||
2404 |
Each type of Read() can be performed either synchronously or asynchronously. |
|
2405 |
||
2406 |
It may be more convenient to use RFs::GetDir() than the Read() calls supported |
|
2407 |
by this class. |
|
2408 |
RFs::GetDir() has the advantage that it allows a directory’s entries to be |
|
2409 |
sorted in various ways. |
|
2410 |
However, it does not provide asynchronous as well as synchronous variants |
|
2411 |
and does not allow entries to be read individually. |
|
2412 |
||
2413 |
@see RFs |
|
2414 |
*/ |
|
2415 |
{ |
|
2416 |
public: |
|
2417 |
EFSRV_IMPORT_C TInt Open(RFs& aFs,const TDesC& aMatchName,const TUidType& aUidType); |
|
2418 |
EFSRV_IMPORT_C TInt Open(RFs& aFs,const TDesC& aMatchName,TUint anAttMask); |
|
2419 |
EFSRV_IMPORT_C void Close(); |
|
2420 |
EFSRV_IMPORT_C TInt Read(TEntryArray& anArray) const; |
|
2421 |
EFSRV_IMPORT_C void Read(TEntryArray& anArray,TRequestStatus& aStatus) const; |
|
2422 |
EFSRV_IMPORT_C TInt Read(TEntry& anEntry) const; |
|
2423 |
EFSRV_IMPORT_C void Read(TPckg<TEntry>& anEntry,TRequestStatus& aStatus) const; |
|
2424 |
||
2425 |
private: |
|
2426 |
// RSubSessionBase overrides |
|
2427 |
TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; |
|
2428 |
||
2429 |
friend class RDirPlugin; |
|
2430 |
}; |
|
2431 |
||
2432 |
||
2433 |
class RFormat : public RSubSessionBase |
|
2434 |
/** |
|
2435 |
@publishedAll |
|
2436 |
@released |
|
2437 |
||
2438 |
Formats a device, one step at a time. |
|
2439 |
||
2440 |
RFormat must first be opened on a device before formatting each |
|
2441 |
track using Next(). |
|
2442 |
||
2443 |
There is also an asynchronous version of Next() which, if encapsulated into |
|
2444 |
a suitable active object, can be used to implement a |
|
2445 |
user-interruptible formatting process. |
|
2446 |
*/ |
|
2447 |
{ |
|
2448 |
public: |
|
2449 |
IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount); |
|
2450 |
IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount,const TDesC8& anInfo); |
|
2451 |
IMPORT_C void Close(); |
|
2452 |
IMPORT_C TInt Next(TInt& aStep); |
|
2453 |
IMPORT_C void Next(TPckgBuf<TInt>& aStep,TRequestStatus& aStatus); |
|
2454 |
}; |
|
2455 |
||
2456 |
||
2457 |
||
2458 |
||
2459 |
class RRawDisk : public RSubSessionBase |
|
2460 |
/** |
|
2461 |
@publishedAll |
|
2462 |
@released |
|
2463 |
||
2464 |
Enables direct disk access. |
|
2465 |
||
2466 |
No other resources can access the disk while direct access to it is in effect. |
|
2467 |
||
2468 |
This class is not intended for user derivation. |
|
2469 |
*/ |
|
2470 |
{ |
|
2471 |
public: |
|
2472 |
IMPORT_C TInt Open(RFs& aFs,TInt aDrive); |
|
2473 |
IMPORT_C void Close(); |
|
2474 |
IMPORT_C TInt Read(TInt64 aPos,TDes8& aDes); |
|
2475 |
IMPORT_C TInt Write(TInt64 aPos,TDesC8& aDes); |
|
2476 |
private: |
|
2477 |
TInt iDrive; |
|
2478 |
}; |
|
2479 |
||
2480 |
||
2481 |
||
2482 |
||
2483 |
class CDirStack; |
|
2484 |
NONSHARABLE_CLASS(CDirScan) : public CBase |
|
2485 |
/** |
|
2486 |
@publishedAll |
|
2487 |
@released |
|
2488 |
||
2489 |
Scans a directory structure. |
|
2490 |
||
2491 |
The scan moves from directory to directory through the hierarchy, returning |
|
2492 |
a list of the entries contained in each. The order in which the directories |
|
2493 |
are scanned is determined by a sort key which is specified when setting up |
|
2494 |
the scan. The base directory to be scanned and the entry types of interest |
|
2495 |
must also be specified before performing the scan. |
|
2496 |
||
2497 |
This class is not intended for user derivation |
|
2498 |
*/ |
|
2499 |
{ |
|
2500 |
public: |
|
2501 |
/** |
|
2502 |
Defines the scan direction. |
|
2503 |
*/ |
|
2504 |
enum TScanDirection |
|
2505 |
{ |
|
2506 |
/** |
|
2507 |
Scan upwards from the lowest level directory in the hierarchy to |
|
2508 |
the top level directory. |
|
2509 |
*/ |
|
2510 |
EScanUpTree, |
|
2511 |
||
2512 |
/** |
|
2513 |
Scan downwards from the top level directory in the hierarchy to |
|
2514 |
the bottom level directory. |
|
2515 |
*/ |
|
2516 |
EScanDownTree |
|
2517 |
}; |
|
2518 |
public: |
|
2519 |
IMPORT_C static CDirScan* NewL(RFs& aFs); |
|
2520 |
IMPORT_C static CDirScan* NewLC(RFs& aFs); |
|
2521 |
IMPORT_C ~CDirScan(); |
|
2522 |
IMPORT_C void SetScanDataL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortMask,TScanDirection aScanDir=EScanDownTree); |
|
2523 |
IMPORT_C void NextL(CDir*& aDirEntries); |
|
2524 |
IMPORT_C TPtrC AbbreviatedPath(); |
|
2525 |
IMPORT_C TPtrC FullPath(); |
|
2526 |
protected: |
|
2527 |
CDirScan(RFs& aFs); |
|
2528 |
private: |
|
2529 |
inline RFs& Fs(); |
|
2530 |
void UpdateAbbreviatedPath(); |
|
2531 |
void ScanUpTreeL(CDir*& aDirEntries); |
|
2532 |
void ScanDownTreeL(CDir*& aDirEntries); |
|
2533 |
void GetDirEntriesL(CDir*& aDirEntries); |
|
2534 |
private: |
|
2535 |
RFs* const iFs; |
|
2536 |
TParse iFullPath; |
|
2537 |
TPtrC iAbbreviatedPath; |
|
2538 |
TInt iAbbreviatedPathPos; |
|
2539 |
TUint iEntryAttMask; |
|
2540 |
TUint iEntrySortMask; |
|
2541 |
TBool iScanning; |
|
2542 |
TScanDirection iScanDir; |
|
2543 |
CDirStack* iStack; |
|
2544 |
}; |
|
2545 |
||
2546 |
||
2547 |
||
2548 |
||
2549 |
enum TFileManError |
|
2550 |
/** |
|
2551 |
@publishedAll |
|
2552 |
@released |
|
2553 |
||
2554 |
A list of CFileMan error codes. |
|
2555 |
||
2556 |
@see CFileMan |
|
2557 |
*/ |
|
2558 |
{ |
|
2559 |
/** |
|
2560 |
No additional error information is available, either because |
|
2561 |
the latest CFileMan operation did not return an error, or if it did, |
|
2562 |
the error was not one for which additional information is available. |
|
2563 |
*/ |
|
2564 |
ENoExtraInformation, |
|
2565 |
||
2566 |
||
2567 |
/** |
|
2568 |
A leave occurred while setting up the initial scan. |
|
2569 |
||
2570 |
This indicates that the operation did not begin. |
|
2571 |
||
2572 |
@see CDirScan. |
|
2573 |
*/ |
|
2574 |
EInitializationFailed, |
|
2575 |
||
2576 |
||
2577 |
/** |
|
2578 |
A leave occurred while scanning the next directory in the course of a file |
|
2579 |
management function. |
|
2580 |
||
2581 |
This indicates that the operation did begin. |
|
2582 |
||
2583 |
@see CDirScan. |
|
2584 |
*/ |
|
2585 |
EScanNextDirectoryFailed, |
|
2586 |
||
2587 |
||
2588 |
/** |
|
2589 |
Error occurred when attempting to open the source file for a file copy |
|
2590 |
or move. |
|
2591 |
*/ |
|
2592 |
ESrcOpenFailed, |
|
2593 |
||
2594 |
||
2595 |
/** |
|
2596 |
Error occurred while attempting to create, or, if overwriting is in effect, |
|
2597 |
replace the target file for a file copy or move. |
|
2598 |
*/ |
|
2599 |
ETrgOpenFailed, |
|
2600 |
||
2601 |
||
2602 |
/** |
|
2603 |
The operation completed without processing any files because no matching |
|
2604 |
files were found. |
|
2605 |
*/ |
|
2606 |
ENoFilesProcessed |
|
2607 |
}; |
|
2608 |
||
2609 |
||
2610 |
||
2611 |
||
2612 |
class MFileManObserver |
|
2613 |
/** |
|
2614 |
@publishedAll |
|
2615 |
@released |
|
2616 |
||
2617 |
Provides notification of the progress of synchronous or asynchronous |
|
2618 |
file management operations. |
|
2619 |
||
2620 |
It should be inherited by classes which implement this protocol. |
|
2621 |
||
2622 |
The enquiry functions provided by CFileBase and CFileMan may be used by |
|
2623 |
the observer to display information about the progress of the operation |
|
2624 |
such as error messages, the names of the target and destination files, |
|
2625 |
and the number of bytes transferred during a copy operation. |
|
2626 |
Notification may take place before or after an entry has been processed, |
|
2627 |
or during a file copy or move. |
|
2628 |
Each notification function returns a value which can be used to enable |
|
2629 |
the user to control the progress of the operation, for example to cancel |
|
2630 |
a long-running multiple file copy. |
|
2631 |
To use this class, pass a pointer to an instance of the class to |
|
2632 |
the CFileMan constructor, or use SetObserver(), defined in CFileBase. |
|
2633 |
*/ |
|
2634 |
{ |
|
2635 |
public: |
|
2636 |
/** |
|
2637 |
Control for the current CFileMan operation. |
|
2638 |
*/ |
|
2639 |
enum TControl |
|
2640 |
{ |
|
2641 |
/** |
|
2642 |
Proceed with the current or the next entry. |
|
2643 |
*/ |
|
2644 |
EContinue, |
|
2645 |
||
2646 |
||
2647 |
/** |
|
2648 |
Retry processing the previous entry. |
|
2649 |
*/ |
|
2650 |
ERetry, |
|
2651 |
||
2652 |
||
2653 |
/** |
|
2654 |
Abort operation, causes function to return KErrCancel. |
|
2655 |
*/ |
|
2656 |
EAbort, |
|
2657 |
||
2658 |
||
2659 |
/** |
|
2660 |
Cancel processing the current entry. |
|
2661 |
*/ |
|
2662 |
ECancel |
|
2663 |
}; |
|
2664 |
public: |
|
2665 |
IMPORT_C virtual TControl NotifyFileManStarted(); |
|
2666 |
IMPORT_C virtual TControl NotifyFileManOperation(); |
|
2667 |
IMPORT_C virtual TControl NotifyFileManEnded(); |
|
2668 |
}; |
|
2669 |
||
2670 |
||
2671 |
||
2672 |
||
2673 |
class CFileBase : public CBase |
|
2674 |
/** |
|
2675 |
@publishedAll |
|
2676 |
@released |
|
2677 |
||
2678 |
Abstract base class for file management. |
|
2679 |
||
2680 |
It provides functions to set an observer for the derived class |
|
2681 |
CFileMan, and to get information about the entry being processed. |
|
2682 |
||
2683 |
@see CFileMan |
|
2684 |
*/ |
|
2685 |
{ |
|
2686 |
public: |
|
2687 |
IMPORT_C void SetObserver(MFileManObserver* anObserver); |
|
2688 |
public: |
|
2689 |
IMPORT_C const TEntry& CurrentEntry(); |
|
2690 |
IMPORT_C TPtrC AbbreviatedPath(); |
|
2691 |
IMPORT_C TPtrC FullPath(); |
|
2692 |
IMPORT_C TInt GetLastError(); |
|
2693 |
IMPORT_C TFileManError GetMoreInfoAboutError(); |
|
2694 |
protected: |
|
2695 |
IMPORT_C CFileBase(RFs& anFs); |
|
2696 |
IMPORT_C void ConstructL(); |
|
2697 |
IMPORT_C ~CFileBase(); |
|
2698 |
IMPORT_C void RunL(); |
|
2699 |
IMPORT_C void RunInSeparateThreadL(TThreadFunction aThreadFunction); |
|
2700 |
// virtual |
|
2701 |
/** |
|
2702 |
Called from RunL to perform tidy up after an operation. |
|
2703 |
||
2704 |
@see CFileMan |
|
2705 |
@see CFileBase::RunL |
|
2706 |
*/ |
|
2707 |
virtual void CompleteOperationL() {}; |
|
2708 |
||
2709 |
//pure virtual |
|
2710 |
/** |
|
2711 |
Called from RunL to perform the requested operation. |
|
2712 |
||
2713 |
@see CFileMan |
|
2714 |
@see CFileBase::RunL |
|
2715 |
*/ |
|
2716 |
virtual void DoOperationL() = 0; |
|
2717 |
protected: |
|
2718 |
RFs iFs; |
|
2719 |
RFs iFsOld; |
|
2720 |
RThread iFManThread; |
|
2721 |
RSemaphore iSynchronizer; |
|
2722 |
CDirScan* iScanner; |
|
2723 |
CDir* iDirList; |
|
2724 |
TInt iCurrentEntry; |
|
2725 |
TUint iMatchEntry; |
|
2726 |
TUint iSwitches; |
|
2727 |
TParse iSrcFile; |
|
2728 |
MFileManObserver* iObserver; |
|
2729 |
TInt iLastError; |
|
2730 |
TFileManError iErrorInfo; |
|
2731 |
TRequestStatus* iStatus; |
|
2732 |
HBufC* iSessionPath; |
|
2733 |
TInt iNumberOfFilesProcessed; |
|
2734 |
||
2735 |
||
2736 |
||
2737 |
||
2738 |
friend void DoFManBaseOperationL(TAny* aPtr); |
|
2739 |
friend TInt FManBaseThreadFunction(TAny* aPtr); |
|
2740 |
}; |
|
2741 |
||
2742 |
||
2743 |
||
2744 |
||
2745 |
NONSHARABLE_CLASS(CFileMan) : public CFileBase |
|
2746 |
/** |
|
2747 |
@publishedAll |
|
2748 |
@released |
|
2749 |
||
2750 |
Offers file management services which accept the use of wildcards; |
|
2751 |
synchronous and asynchronous. |
|
2752 |
||
2753 |
It also provides enquiry functions, which, like those provided by |
|
2754 |
the base class CFileBase, may be used by an observer class object |
|
2755 |
to provide the user with information about the progress of the operation. |
|
2756 |
||
2757 |
All of the file management functions provided by this class accept the use of |
|
2758 |
wildcards, and may operate either synchronously or asynchronously. |
|
2759 |
When CFileMan is operating asynchronously, the operation takes place in |
|
2760 |
a separate thread from the calling code. |
|
2761 |
||
2762 |
A file notification observer (an instance of a class deriving |
|
2763 |
from MFileManObserver) may optionally be used by CFileMan when operating |
|
2764 |
synchronously or asynchronously. If provided, the appropriate notification |
|
2765 |
function is called before or after each entry has been processed, |
|
2766 |
or during a file copy or move. |
|
2767 |
This notification can be used to provide information about the state of |
|
2768 |
the operation, such as the number of bytes transferred during a |
|
2769 |
large-scale file copy. It can also be used to allow the user to cancel, |
|
2770 |
retry or continue processing an entry, or to abort the whole operation. |
|
2771 |
If such notification is required, specify an object deriving from |
|
2772 |
MFileManObserver class in the constructor, or call SetObserver(), |
|
2773 |
defined in the base class, CFileBase. |
|
2774 |
||
2775 |
All of the file manipulation functions except Rename() may operate recursively, |
|
2776 |
and all can operate non-recursively. When operating recursively, |
|
2777 |
these functions will act on all matching files located throughout |
|
2778 |
the source directory’s hierarchy. When operating non-recursively, |
|
2779 |
these functions act upon files contained in the single top level source |
|
2780 |
directory only. Recursion is set or unset using the switch parameter to |
|
2781 |
these functions. |
|
2782 |
||
2783 |
This class is not intended for user derivation. |
|
2784 |
||
2785 |
Note: |
|
2786 |
||
2787 |
To support wildcard, CFileMan needs to store the entire directory entry |
|
2788 |
information. Therefore, in a extreme condition, if a directory contains |
|
2789 |
a huge number of files (e.g. more than 15000 files with 10 characters' long file |
|
2790 |
names), user may encounter KErrNoMemory errors. Developers who have a need to handle |
|
2791 |
this rare case should increase the heap size limitation of their applications. |
|
2792 |
||
2793 |
For more information about heap size configuration, please refer following |
|
2794 |
section in Symbian Developer Library: |
|
2795 |
Symbian OS build guide >> Build Tools Reference >> MMP file syntax >> epocheapsize |
|
2796 |
||
2797 |
@see MFileManObserver |
|
2798 |
*/ |
|
2799 |
{ |
|
2800 |
public: |
|
2801 |
/** |
|
2802 |
An enumeration that identifies CFileMan tasks. This enumeration is used |
|
2803 |
by CurrentAction() to identify which task currently being carried out. |
|
2804 |
||
2805 |
@see CFileMan::CurrentAction |
|
2806 |
*/ |
|
2807 |
enum TAction |
|
2808 |
{ |
|
2809 |
/** |
|
2810 |
Inactive |
|
2811 |
*/ |
|
2812 |
ENone, |
|
2813 |
||
2814 |
||
2815 |
/** |
|
2816 |
Setting attributes |
|
2817 |
*/ |
|
2818 |
EAttribs, |
|
2819 |
||
2820 |
||
2821 |
/** |
|
2822 |
Copying files |
|
2823 |
*/ |
|
2824 |
ECopy, |
|
2825 |
||
2826 |
||
2827 |
/** |
|
2828 |
Deleting files |
|
2829 |
*/ |
|
2830 |
EDelete, |
|
2831 |
||
2832 |
||
2833 |
/** |
|
2834 |
Moving files |
|
2835 |
*/ |
|
2836 |
EMove, |
|
2837 |
||
2838 |
||
2839 |
/** |
|
2840 |
Renaming files |
|
2841 |
*/ |
|
2842 |
ERename, |
|
2843 |
||
2844 |
||
2845 |
/** |
|
2846 |
Deleting a directory and all contents |
|
2847 |
*/ |
|
2848 |
ERmDir, |
|
2849 |
||
2850 |
||
2851 |
/** |
|
2852 |
Renaming component to VFAT short name (guaranteed to be unique) |
|
2853 |
*/ |
|
2854 |
ERenameInvalidEntry, |
|
2855 |
||
2856 |
/** |
|
2857 |
Copying file from open file handle |
|
2858 |
*/ |
|
2859 |
ECopyFromHandle, |
|
2860 |
}; |
|
2861 |
||
2862 |
||
2863 |
/** |
|
2864 |
Overwriting and recursion switch. |
|
2865 |
||
2866 |
Used in CFileMan functions to set whether operations are applied to |
|
2867 |
the specified directory and all directories below it, or |
|
2868 |
the specified directory only. |
|
2869 |
*/ |
|
2870 |
enum TSwitch |
|
2871 |
{ |
|
2872 |
/** |
|
2873 |
Any files in the destination directory that have the same name as |
|
2874 |
the source files in a rename, move or copy operation, will |
|
2875 |
be overwritten. |
|
2876 |
*/ |
|
2877 |
EOverWrite=1, |
|
2878 |
||
2879 |
||
2880 |
/** |
|
2881 |
Recursive operation. |
|
2882 |
*/ |
|
2883 |
ERecurse=2 |
|
2884 |
}; |
|
2885 |
public: |
|
2886 |
IMPORT_C static CFileMan* NewL(RFs& aFs); |
|
2887 |
IMPORT_C static CFileMan* NewL(RFs& aFs,MFileManObserver* anObserver); |
|
2888 |
~CFileMan(); |
|
2889 |
IMPORT_C TAction CurrentAction(); |
|
2890 |
IMPORT_C void GetCurrentTarget(TFileName& aFile); |
|
2891 |
IMPORT_C void GetCurrentSource(TFileName& aFile); |
|
2892 |
IMPORT_C TInt BytesTransferredByCopyStep(); |
|
2893 |
public: |
|
2894 |
IMPORT_C TInt Attribs(const TDesC& aName,TUint aSetMask,TUint aClearMask,const TTime& aTime,TUint aSwitch=0); |
|
2895 |
IMPORT_C TInt Attribs(const TDesC& aName,TUint aSetMask,TUint aClearMask,const TTime& aTime,TUint aSwitch,TRequestStatus& aStatus); |
|
2896 |
IMPORT_C TInt Copy(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); |
|
2897 |
IMPORT_C TInt Copy(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus); |
|
2898 |
IMPORT_C TInt Delete(const TDesC& aName,TUint aSwitch=0); |
|
2899 |
IMPORT_C TInt Delete(const TDesC& aName,TUint aSwitch,TRequestStatus& aStatus); |
|
2900 |
IMPORT_C TInt Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); |
|
2901 |
IMPORT_C TInt Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus); |
|
2902 |
IMPORT_C TInt Rename(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); |
|
2903 |
IMPORT_C TInt Rename(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus); |
|
2904 |
IMPORT_C TInt RmDir(const TDesC& aDirName); |
|
2905 |
IMPORT_C TInt RmDir(const TDesC& aDirName,TRequestStatus& aStatus); |
|
2906 |
IMPORT_C TInt Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches=EOverWrite); |
|
2907 |
IMPORT_C TInt Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches,TRequestStatus& aStatus); |
|
2908 |
protected: |
|
2909 |
CFileMan(RFs& aFs); |
|
2910 |
TInt RenameInvalidEntry(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); |
|
2911 |
private: |
|
2912 |
/** |
|
2913 |
This is an internal enumeration for CFileMan implementation. |
|
2914 |
THis enumeration is mapped into TAction when user wants to identify the current |
|
2915 |
task of CFileMan by CurrentAction(). |
|
2916 |
||
2917 |
@see CFileMan::TAction |
|
2918 |
@see CFileMan::CurrentAction |
|
2919 |
*/ |
|
2920 |
enum TInternalAction |
|
2921 |
{ |
|
2922 |
/** |
|
2923 |
Internal indicator for None operation. |
|
2924 |
This is mapped to CFileMan::ENone. |
|
2925 |
*/ |
|
2926 |
EInternalNone, |
|
2927 |
||
2928 |
/** |
|
2929 |
Internal indicator for Attribs() operation. |
|
2930 |
This is mapped to CFileMan::EAttribs. |
|
2931 |
*/ |
|
2932 |
EInternalAttribs, |
|
2933 |
||
2934 |
/** |
|
2935 |
Internal indicator for Copy() operation. |
|
2936 |
This is mapped to CFileMan::ECopy. |
|
2937 |
*/ |
|
2938 |
EInternalCopy, |
|
2939 |
||
2940 |
/** |
|
2941 |
Internal indicator for Delete() operation. |
|
2942 |
This is mapped to CFileMan::EDelete. |
|
2943 |
*/ |
|
2944 |
EInternalDelete, |
|
2945 |
||
2946 |
/** |
|
2947 |
Internal indicator for Move() operation on different drives. |
|
2948 |
This is mapped to CFileMan::Move. |
|
2949 |
*/ |
|
2950 |
EInternalCopyForMove, |
|
2951 |
||
2952 |
/** |
|
2953 |
Internal indicator for Move() operation on the same drive. |
|
2954 |
This is mapped to CFileMan::Rename. |
|
2955 |
Note for compatibility reasons, it is not mapped to CFileMan::Move. |
|
2956 |
*/ |
|
2957 |
EInternalRenameForMove, |
|
2958 |
||
2959 |
/** |
|
2960 |
Internal indicator for Rename() operation. |
|
2961 |
This is mapped to CFileMan::ERename. |
|
2962 |
*/ |
|
2963 |
EInternalRename, |
|
2964 |
||
2965 |
/** |
|
2966 |
Internal indicator for RmDir() operation. |
|
2967 |
This is mapped to CFileMan::ERmDir. |
|
2968 |
*/ |
|
2969 |
EInternalRmDir, |
|
2970 |
||
2971 |
/** |
|
2972 |
Internal indicator for RenameInvalidEntry() operation. |
|
2973 |
This is mapped to CFileMan::ERenameInvalidEntry. |
|
2974 |
*/ |
|
2975 |
EInternalRenameInvalidEntry, |
|
2976 |
||
2977 |
/** |
|
2978 |
Internal indicator for CopyFromHandle() operation. |
|
2979 |
This is mapped to CFileMan::ECopyFromHandle. |
|
2980 |
*/ |
|
2981 |
EInternalCopyFromHandle, |
|
2982 |
}; |
|
2983 |
||
2984 |
void CompleteOperationL(); |
|
2985 |
void DoOperationL(); |
|
2986 |
void CheckForDirectory(); |
|
2987 |
void SetFlags(TBool aOverWrite,TBool aRecurse,TBool aScanDirection,TBool aMoveRename); |
|
2988 |
void GetSrcAndTrg(TParse& aSrcName,TFileName& aTrgName); |
|
2989 |
void DoSynchronize(TInt aRetVal); |
|
2990 |
TInt CheckRenameAllowed(const TDesC& aSrcName,const TDesC& aTrgName); |
|
2991 |
TInt SetupMoveOnSameDrive(TUint aSwitches, TBool& aComplete); |
|
2992 |
TInt SetupMoveAcrossDrives(TUint aSwitches); |
|
2993 |
TInt SetupTargetDirectory(TBool aOverWrite, TBool& aComplete); |
|
2994 |
TBool SrcTrgDrivesIdentical(); |
|
2995 |
TInt SetupDirectoryForMove(TBool& aSrcIsDir); |
|
2996 |
private: |
|
2997 |
void DoAttribsL(); |
|
2998 |
void DoCopyOrMoveL(); |
|
2999 |
void DoDeleteL(); |
|
3000 |
void DoRenameL(); |
|
3001 |
void DoRmDirL(); |
|
3002 |
void DoCopyFromHandleL(); |
|
3003 |
#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
3004 |
TInt DoCopy(const RFile& aSrcFile, RFile& aDstFile, TInt& aRet); |
|
3005 |
#else |
|
3006 |
TInt DoCopy(const RFile64& aSrcFile, RFile64& aDstFile, TInt& aRet); |
|
3007 |
#endif |
|
3008 |
private: |
|
3009 |
TParse iTrgFile; |
|
3010 |
TInternalAction iAction; |
|
3011 |
TUint iSetMask; |
|
3012 |
TUint iClearMask; |
|
3013 |
TTime iTime; |
|
3014 |
TInt iBytesTransferred; |
|
3015 |
#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
3016 |
RFile iSrcFileHandle; |
|
3017 |
#else |
|
3018 |
RFile64 iSrcFileHandle; |
|
3019 |
#endif |
|
3020 |
TBool iMovingContents; |
|
3021 |
TEntry iTmpEntry; |
|
3022 |
TParse iTmpParse; |
|
3023 |
TFileName iTmpName1; |
|
3024 |
TFileName iTmpName2; |
|
3025 |
||
3026 |
friend void RenameInvalidEntryL(RFs& aFs,TParse& aSrcFile); |
|
3027 |
}; |
|
3028 |
||
3029 |
||
3030 |
||
3031 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
3032 |
|
0 | 3033 |
/** |
3034 |
@publishedAll |
|
3035 |
@released |
|
3036 |
||
3037 |
Searches for files and directories. |
|
3038 |
||
3039 |
Each function has a variant which searches for multiple files/directories, |
|
3040 |
using one or more wildcard characters in the filename. |
|
3041 |
If an initial search is successful, further searches can be carried out |
|
3042 |
using Find() or FindWild(). |
|
3043 |
You can also retrieve the fully qualified file specification, |
|
3044 |
and manipulate and interrogate it using the TParse class (or related classes). |
|
3045 |
||
3046 |
Note that when specifying the path of a directory to search, the path should |
|
3047 |
always end with a backslash character.When trailing backslash is not present |
|
3048 |
then it is considered as file. And path will be taken till last backslash. |
|
3049 |
The client must have appropriate capabilities for the directory to be searched. |
|
3050 |
For example without ALL FILES Capability, it is not possible to successfully |
|
3051 |
find any files under \sys\bin directory. |
|
3052 |
||
3053 |
By default if the file is not found in the current drive the rest of the drives, |
|
3054 |
excluding the remote ones, will be searched. Using function SetFindMask it is |
|
3055 |
possible to specify a combination of drive attributes(aMask) that the drives to |
|
3056 |
be searched must match. |
|
3057 |
||
3058 |
*/ |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
3059 |
class TFindFile |
0 | 3060 |
{ |
3061 |
public: |
|
3062 |
IMPORT_C TFindFile(RFs& aFs); |
|
3063 |
IMPORT_C TInt FindByPath(const TDesC& aFileName,const TDesC* aPathList); |
|
3064 |
IMPORT_C TInt FindByDir(const TDesC& aFileName,const TDesC& aDirPath); |
|
3065 |
IMPORT_C TInt Find(); |
|
3066 |
IMPORT_C TInt FindWildByPath(const TDesC& aFileName,const TDesC* aPathList,CDir*& aDirList); |
|
3067 |
IMPORT_C TInt FindWildByDir(const TDesC& aFileName,const TDesC& aDirPath,CDir*& aDir); |
|
3068 |
IMPORT_C TInt FindWild(CDir*& aDirList); |
|
3069 |
IMPORT_C TInt SetFindMask(TUint aMask); |
|
3070 |
inline const TDesC& File() const; |
|
3071 |
private: |
|
3072 |
TInt DoFind(); |
|
3073 |
TInt DoFindByPath(const TDesC& aFileName,const TDesC* aPathList); |
|
3074 |
TInt DoFindByDir(const TDesC& aFileName,const TDesC& aDir); |
|
3075 |
TInt DoFindInDir(); |
|
3076 |
TInt DoFindNextInPath(); |
|
3077 |
TInt DoFindNextInDriveList(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
3078 |
TInt CallSafe(TInt aResult); |
0 | 3079 |
private: |
3080 |
RFs* const iFs; |
|
3081 |
TParse iFile; |
|
3082 |
TInt iPathPos; |
|
3083 |
TInt iCurrentDrive; |
|
3084 |
TInt iMode; |
|
3085 |
const TDesC* iPath; |
|
3086 |
TDriveList iDrvList; |
|
3087 |
CDir** iDir; |
|
3088 |
TUint32 iMatchMask; |
|
3089 |
}; |
|
3090 |
||
3091 |
||
3092 |
||
3093 |
||
3094 |
/** |
|
3095 |
@publishedAll |
|
3096 |
@released |
|
3097 |
||
3098 |
Contains a list of entries for the files which were opened in |
|
3099 |
a file server session. |
|
3100 |
||
3101 |
@see CDir |
|
3102 |
*/ |
|
3103 |
typedef CDir CFileList; |
|
3104 |
||
3105 |
||
3106 |
||
3107 |
||
3108 |
class TOpenFileScan |
|
3109 |
/** |
|
3110 |
@publishedAll |
|
3111 |
@released |
|
3112 |
||
3113 |
Scans open files to get a list of the entries for all files which are currently |
|
3114 |
open in a particular file server session. |
|
3115 |
||
3116 |
NextL() creates a list of the files opened by the session. |
|
3117 |
The ID of the thread which opened the files listed may be obtained by calling ThreadId(). |
|
3118 |
If multiple sessions are in use, repeatedly calling NextL() will return a list |
|
3119 |
of open files in each session. |
|
3120 |
*/ |
|
3121 |
{ |
|
3122 |
public: |
|
3123 |
IMPORT_C TOpenFileScan(RFs& aFs); |
|
3124 |
IMPORT_C void NextL(CFileList*& aFileList); |
|
3125 |
IMPORT_C TThreadId ThreadId() const; |
|
3126 |
private: |
|
3127 |
RFs* iFs; |
|
3128 |
TThreadId iThreadId; |
|
3129 |
TInt iScanPos; |
|
3130 |
TInt iEntryListPos; |
|
3131 |
}; |
|
3132 |
||
3133 |
||
3134 |
||
3135 |
||
3136 |
class TFileText |
|
3137 |
/** |
|
3138 |
@publishedAll |
|
3139 |
@released |
|
3140 |
||
3141 |
Reads and writes single lines of text to or from a Unicode file. |
|
3142 |
*/ |
|
3143 |
{ |
|
3144 |
private: |
|
3145 |
enum TFileState |
|
3146 |
{ |
|
3147 |
EStartOfFile, |
|
3148 |
ENormal, |
|
3149 |
EReverse |
|
3150 |
}; |
|
3151 |
public: |
|
3152 |
IMPORT_C TFileText(); |
|
3153 |
IMPORT_C void Set(RFile& aFile); |
|
3154 |
IMPORT_C TInt Read(TDes& aDes); |
|
3155 |
IMPORT_C TInt Write(const TDesC& aDes); |
|
3156 |
IMPORT_C TInt Seek(TSeek aMode); |
|
3157 |
private: |
|
3158 |
void NextRecord(); |
|
3159 |
TInt CheckForTerminator(TBool& anAnswer); |
|
3160 |
TInt FillBuffer(); |
|
3161 |
private: |
|
3162 |
const TText* iNext; |
|
3163 |
const TText* iEnd; |
|
3164 |
TFileState iState; |
|
3165 |
#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
3166 |
RFile iFile; |
|
3167 |
#else |
|
3168 |
RFile64 iFile; |
|
3169 |
#endif |
|
3170 |
TBuf8<0x100> iReadBuf; |
|
3171 |
}; |
|
3172 |
||
3173 |
||
3174 |
||
3175 |
||
3176 |
/** |
|
3177 |
@publishedAll |
|
3178 |
@released |
|
3179 |
*/ |
|
3180 |
IMPORT_C TBool FileNamesIdentical(const TDesC& aFileName1,const TDesC& aFileName2); |
|
3181 |
||
3182 |
/** |
|
3183 |
@publishedAll |
|
3184 |
@released |
|
3185 |
||
3186 |
The UID of the File Server process |
|
3187 |
*/ |
|
3188 |
const TInt KFileServerUidValue = 0x100039e3; |
|
3189 |
||
3190 |
||
3191 |
#include <f32file.inl> |
|
3192 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
3193 |
#include <f32file64.inl> |
|
3194 |
#endif |
|
3195 |
||
3196 |
#ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION |
|
3197 |
#include <f32notification.h> |
|
3198 |
#endif |
|
3199 |
||
3200 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
3201 |
#include <f32file_private.h> |
|
3202 |
#endif |
|
3203 |
||
3204 |
#endif |