CDirScan Class Reference

class CDirScan : public CBase

Scans a directory structure.

The scan moves from directory to directory through the hierarchy, returning a list of the entries contained in each. The order in which the directories are scanned is determined by a sort key which is specified when setting up the scan. The base directory to be scanned and the entry types of interest must also be specified before performing the scan.

This class is not intended for user derivation

Inherits from

Constructor & Destructor Documentation

CDirScan(RFs &)

CDirScan ( RFs & aFs ) [protected]

Parameters

RFs & aFs

~CDirScan()

IMPORT_C ~CDirScan ( )

Desctructor.

Frees all resources owned by the object, prior to its destruction.

Member Functions Documentation

AbbreviatedPath()

IMPORT_C TPtrC AbbreviatedPath ( )

Gets the abbreviated path of the entry currently being scanned.

The abbreviated path is the path relative to the top level directory in the scan.

Fs()

RFs & Fs ( ) [private, inline]

FullPath()

IMPORT_C TPtrC FullPath ( )

Gets the full path of the entry currently being scanned.

The full path includes the drive letter.

GetDirEntriesL(CDir *&)

void GetDirEntriesL ( CDir *& aDirEntries ) [private]

Parameters

CDir *& aDirEntries

NewL(RFs &)

IMPORT_C CDirScan * NewL ( RFs & aFs ) [static]

Constructs and allocates memory for a new CDirScan object.

Parameters

RFs & aFs The file server session.

NewLC(RFs &)

IMPORT_C CDirScan * NewLC ( RFs & aFs ) [static]

Constructs and allocates memory for a new CDirScan object, putting a pointer to the object onto the cleanup stack.

Parameters

RFs & aFs The file server session.

NextL(CDir *&)

IMPORT_C void NextL ( CDir *& aDirEntries )

Scans the next directory entry in the structure.

The order in which the structure is scanned is determined by the scan direction and the entry sort mask. These values are specified when setting up the scan. The type of entries retrieved by this function is determined by the entry attribute mask. This is also specified when setting up the scan.

Notes:

1. The function first sets aDirEntries to NULL, and then allocates memory for it before appending entries to it. Therefore, aDirEntries should have no memory allocated to it before this function is called, otherwise this memory will become orphaned.

2. The caller of this function is responsible for deleting aDirEntries after the function has returned.

Parameters

CDir *& aDirEntries On return, a pointer to an array containing filtered entries from the next directory in the structure. NULL if there are no more directories in the structure.

ScanDownTreeL(CDir *&)

void ScanDownTreeL ( CDir *& aDirEntries ) [private]

Parameters

CDir *& aDirEntries

ScanUpTreeL(CDir *&)

void ScanUpTreeL ( CDir *& aDirEntries ) [private]

Parameters

CDir *& aDirEntries

SetScanDataL(const TDesC &, TUint, TUint, TScanDirection)

IMPORT_C void SetScanDataL ( const TDesC & aMatchName,
TUint anEntryAttMask,
TUint anEntrySortMask,
TScanDirection aScanDir = EScanDownTree
)

Initialises the scan.

This involves specifying:

1. the directory at the top of the structure to be scanned

2. a filter for the entry types of interest

3. the order in which the entries in each directory in the structure are to be sorted

4. the scan direction.

Whether the scan direction is upwards or downwards, the directories that are scanned are those in the part of the hierarchy below the directory specified in aMatchName. By default, the scan direction is downwards. If the scan direction is set to CDirScan::EScanUpTree , then all branches of the tree are explored starting at the lowest level directory in the tree below aMatchName, and ending at aMatchName. This option is provided for deleting a directory structure.

Parameters

const TDesC & aMatchName The top level directory for the scan. Any path components that are not specified here are taken from the session path. Note that the trailing backslash is required to specify the directory. I.e. path x:\dir1\dir2\ means that the scan will start from dir2, while path x:\dir1\dir2 assumes scan starting from x:\dir1\
TUint anEntryAttMask A bit mask that filters the entry types which should be returned by NextL(). The mask works as follows: To match files only, specify KEntryAttNormal. To match both files and directories, specify KEntryAttDir. To match directories only, specify KEntryAttDir|KEntryAttMatchExclusive. To match files with a specific attribute, then OR the attribute involved with KEntryAttMatchExclusive. For example, to match read-only files, specify KEntryAttReadOnly|KEntryAttMatchExclusive. For more information, see KEntryAttNormal or the other file/directory attributes.
TUint anEntrySortMask The order in which the directories are scanned by NextL(). This flag is defined in TEntryKey.
TScanDirection aScanDir = EScanDownTree The direction of the scan. The default is downwards.

UpdateAbbreviatedPath()

void UpdateAbbreviatedPath ( ) [private]

Member Enumerations Documentation

Enum TScanDirection

Defines the scan direction.

Enumerators

EScanUpTree

Scan upwards from the lowest level directory in the hierarchy to the top level directory.

EScanDownTree

Scan downwards from the top level directory in the hierarchy to the bottom level directory.

Member Data Documentation

TPtrC iAbbreviatedPath

TPtrC iAbbreviatedPath [private]

TInt iAbbreviatedPathPos

TInt iAbbreviatedPathPos [private]

TUint iEntryAttMask

TUint iEntryAttMask [private]

TUint iEntrySortMask

TUint iEntrySortMask [private]

RFs *const iFs

RFs *const iFs [private]

TParse iFullPath

TParse iFullPath [private]

TScanDirection iScanDir

TScanDirection iScanDir [private]

TBool iScanning

TBool iScanning [private]

CDirStack * iStack

CDirStack * iStack [private]