class CFileMan : public CFileBase |
Offers file management services which accept the use of wildcards; synchronous and asynchronous.
It also provides enquiry functions, which, like those provided by the base class CFileBase, may be used by an observer class object to provide the user with information about the progress of the operation.
All of the file management functions provided by this class accept the use of wildcards, and may operate either synchronously or asynchronously. When CFileMan is operating asynchronously, the operation takes place in a separate thread from the calling code.
A file notification observer (an instance of a class deriving from MFileManObserver) may optionally be used by CFileMan when operating synchronously or asynchronously. If provided, the appropriate notification function is called before or after each entry has been processed, or during a file copy or move. This notification can be used to provide information about the state of the operation, such as the number of bytes transferred during a large-scale file copy. It can also be used to allow the user to cancel, retry or continue processing an entry, or to abort the whole operation. If such notification is required, specify an object deriving from MFileManObserver class in the constructor, or call SetObserver(), defined in the base class, CFileBase.
All of the file manipulation functions except Rename() may operate recursively, and all can operate non-recursively. When operating recursively, these functions will act on all matching files located throughout the source directory s hierarchy. When operating non-recursively, these functions act upon files contained in the single top level source directory only. Recursion is set or unset using the switch parameter to these functions.
This class is not intended for user derivation.
Note:
To support wildcard, CFileMan needs to store the entire directory entry information. Therefore, in a extreme condition, if a directory contains a huge number of files (e.g. more than 15000 files with 10 characters' long file names), user may encounter KErrNoMemory errors. Developers who have a need to handle this rare case should increase the heap size limitation of their applications.
For more information about heap size configuration, please refer following section in Symbian Developer Library: Symbian OS build guide >> Build Tools Reference >> MMP file syntax >> epocheapsize
Protected Member Functions | |
---|---|
CFileMan(RFs &) | |
TInt | RenameInvalidEntry(const TDesC &, const TDesC &, TUint) |
Private Member Functions | |
---|---|
void | CheckForDirectory() |
TInt | CheckRenameAllowed(const TDesC &, const TDesC &) |
void | CompleteOperationL() |
void | DoAttribsL() |
TInt | DoCopy(const RFile &, RFile &, TInt &) |
void | DoCopyFromHandleL() |
void | DoCopyOrMoveL() |
void | DoDeleteL() |
void | DoOperationL() |
void | DoRenameL() |
void | DoRmDirL() |
void | DoSynchronize(TInt) |
void | GetSrcAndTrg(TParse &, TFileName &) |
void | SetFlags(TBool, TBool, TBool, TBool) |
TInt | SetupDirectoryForMove(TBool &) |
TInt | SetupMoveAcrossDrives(TUint) |
TInt | SetupMoveOnSameDrive(TUint, TBool &) |
TInt | SetupTargetDirectory(TBool, TBool &) |
TBool | SrcTrgDrivesIdentical() |
Public Member Enumerations | |
---|---|
enum | TAction { ENone, EAttribs, ECopy, EDelete, EMove, ERename, ERmDir, ERenameInvalidEntry, ECopyFromHandle } |
enum | TSwitch { EOverWrite = 1, ERecurse = 2 } |
Private Member Enumerations | |
---|---|
enum | TInternalAction { EInternalNone, EInternalAttribs, EInternalCopy, EInternalDelete, EInternalCopyForMove, EInternalRenameForMove, EInternalRename, EInternalRmDir, EInternalRenameInvalidEntry, EInternalCopyFromHandle } |
IMPORT_C TInt | Attribs | ( | const TDesC & | aName, |
TUint | aSetMask, | |||
TUint | aClearMask, | |||
const TTime & | aTime, | |||
TUint | aSwitch = 0 | |||
) |
IMPORT_C TInt | Attribs | ( | const TDesC & | aName, |
TUint | aSetMask, | |||
TUint | aClearMask, | |||
const TTime & | aTime, | |||
TUint | aSwitch, | |||
TRequestStatus & | aStatus | |||
) |
TInt | CheckRenameAllowed | ( | const TDesC & | aSrcName, |
const TDesC & | aTrgName | |||
) | [private] |
IMPORT_C TInt | Copy | ( | const TDesC & | anOld, |
const TDesC & | aNew, | |||
TUint | aSwitch = EOverWrite | |||
) |
IMPORT_C TInt | Copy | ( | const TDesC & | anOld, |
const TDesC & | aNew, | |||
TUint | aSwitch, | |||
TRequestStatus & | aStatus | |||
) |
const TDesC & anOld | |
const TDesC & aNew | |
TUint aSwitch | |
TRequestStatus & aStatus |
IMPORT_C TInt | Copy | ( | const RFile & | anOld, |
const TDesC & | aNew, | |||
TUint | aSwitches = EOverWrite | |||
) |
IMPORT_C TInt | Copy | ( | const RFile & | anOld, |
const TDesC & | aNew, | |||
TUint | aSwitches, | |||
TRequestStatus & | aStatus | |||
) |
const RFile & anOld | |
const TDesC & aNew | |
TUint aSwitches | |
TRequestStatus & aStatus |
IMPORT_C TInt | Delete | ( | const TDesC & | aName, |
TUint | aSwitch, | |||
TRequestStatus & | aStatus | |||
) |
const TDesC & aName | |
TUint aSwitch | |
TRequestStatus & aStatus |
TInt | DoCopy | ( | const RFile & | aSrcFile, |
RFile & | aDstFile, | |||
TInt & | aRet | |||
) | [private] |
IMPORT_C void | GetCurrentSource | ( | TFileName & | aFile | ) |
TFileName & aFile |
IMPORT_C void | GetCurrentTarget | ( | TFileName & | aFile | ) |
TFileName & aFile |
void | GetSrcAndTrg | ( | TParse & | aSrcName, |
TFileName & | aTrgName | |||
) | [private] |
IMPORT_C TInt | Move | ( | const TDesC & | anOld, |
const TDesC & | aNew, | |||
TUint | aSwitch = EOverWrite | |||
) |
IMPORT_C TInt | Move | ( | const TDesC & | anOld, |
const TDesC & | aNew, | |||
TUint | aSwitch, | |||
TRequestStatus & | aStatus | |||
) |
const TDesC & anOld | |
const TDesC & aNew | |
TUint aSwitch | |
TRequestStatus & aStatus |
IMPORT_C CFileMan * | NewL | ( | RFs & | aFs, |
MFileManObserver * | anObserver | |||
) | [static] |
RFs & aFs | |
MFileManObserver * anObserver |
IMPORT_C TInt | Rename | ( | const TDesC & | anOld, |
const TDesC & | aNew, | |||
TUint | aSwitch = EOverWrite | |||
) |
IMPORT_C TInt | Rename | ( | const TDesC & | anOld, |
const TDesC & | aNew, | |||
TUint | aSwitch, | |||
TRequestStatus & | aStatus | |||
) |
const TDesC & anOld | |
const TDesC & aNew | |
TUint aSwitch | |
TRequestStatus & aStatus |
TInt | RenameInvalidEntry | ( | const TDesC & | anOld, |
const TDesC & | aNew, | |||
TUint | aSwitch = EOverWrite | |||
) | [protected] |
IMPORT_C TInt | RmDir | ( | const TDesC & | aDirName, |
TRequestStatus & | aStatus | |||
) |
const TDesC & aDirName | |
TRequestStatus & aStatus |
void | SetFlags | ( | TBool | aOverWrite, |
TBool | aRecurse, | |||
TBool | aScanDirection, | |||
TBool | aMoveRename | |||
) | [private] |
TInt | SetupDirectoryForMove | ( | TBool & | aSrcIsDir | ) | [private] |
TBool & aSrcIsDir |
TInt | SetupMoveAcrossDrives | ( | TUint | aSwitches | ) | [private] |
TUint aSwitches |
TInt | SetupMoveOnSameDrive | ( | TUint | aSwitches, |
TBool & | aComplete | |||
) | [private] |
TInt | SetupTargetDirectory | ( | TBool | aOverWrite, |
TBool & | aComplete | |||
) | [private] |
An enumeration that identifies CFileMan tasks. This enumeration is used by CurrentAction() to identify which task currently being carried out.
ENone |
Inactive |
EAttribs |
Setting attributes |
ECopy |
Copying files |
EDelete |
Deleting files |
EMove |
Moving files |
ERename |
Renaming files |
ERmDir |
Deleting a directory and all contents |
ERenameInvalidEntry |
Renaming component to VFAT short name (guaranteed to be unique) |
ECopyFromHandle |
Copying file from open file handle |
This is an internal enumeration for CFileMan implementation. THis enumeration is mapped into TAction when user wants to identify the current task of CFileMan by CurrentAction().
EInternalNone |
Internal indicator for None operation. This is mapped to CFileMan::ENone. |
EInternalAttribs |
Internal indicator for Attribs() operation. This is mapped to CFileMan::EAttribs. |
EInternalCopy |
Internal indicator for Copy() operation. This is mapped to CFileMan::ECopy. |
EInternalDelete |
Internal indicator for Delete() operation. This is mapped to CFileMan::EDelete. |
EInternalCopyForMove |
Internal indicator for Move() operation on different drives. This is mapped to CFileMan::Move. |
EInternalRenameForMove |
Internal indicator for Move() operation on the same drive. This is mapped to CFileMan::Rename. Note for compatibility reasons, it is not mapped to CFileMan::Move. |
EInternalRename |
Internal indicator for Rename() operation. This is mapped to CFileMan::ERename. |
EInternalRmDir |
Internal indicator for RmDir() operation. This is mapped to CFileMan::ERmDir. |
EInternalRenameInvalidEntry |
Internal indicator for RenameInvalidEntry() operation. This is mapped to CFileMan::ERenameInvalidEntry. |
EInternalCopyFromHandle |
Internal indicator for CopyFromHandle() operation. This is mapped to CFileMan::ECopyFromHandle. |
Overwriting and recursion switch.
Used in CFileMan functions to set whether operations are applied to the specified directory and all directories below it, or the specified directory only.
EOverWrite = 1 |
Any files in the destination directory that have the same name as the source files in a rename, move or copy operation, will be overwritten. |
ERecurse = 2 |
Recursive operation. |