Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: f32file.h
Link against: efsrv.lib

Class CDirScan

CDirScan

Support

Supported from 5.0

Description

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

Derivation

CBaseBase class for all classes to be instantiated on the heap
CDirScanScans a directory structure

Defined in CDirScan:
AbbreviatedPath(), EScanDownTree, EScanUpTree, FullPath(), NewL(), NewLC(), NextL(), SetScanDataL(), TScanDirection, ~CDirScan()

Inherited from CBase:
operator new()

See also:


Construction and destruction


NewL()

static CDirScan* NewL(RFs& aFs);

Description

Constructs and allocates memory for a new CDirScan object.

Parameters

RFs& aFs

File server session.

Return value

CDirScan*

Pointer to the new directory scan object.


NewLC()

static CDirScan* NewLC(RFs& aFs);

Description

Constructs and allocates memory for a new CDirScan object — leaving object on cleanup stack. If construction is successful, the object is placed on the clean-up stack before the function returns.

Parameters

RFs& aFs

File server session

Return value

CDirScan*

Pointer to the new directory scan object.


~CDirScan()

~CDirScan();

Description

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

[Top]


Scanning functions


SetScanDataL()

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

Description

Initialises the scan. This involves specifying:

Whether the scan direction is upwards or downwards, the directories which 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, 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 which are not specified here are taken from the session path.

TUint anEntryAttMask

A bit mask which 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, 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. By default, downwards.

See also:


NextL()

void NextL(CDir*& aDirEntries);

Description

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:

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.

[Top]


Parsing paths


AbbreviatedPath()

TPtrC AbbreviatedPath();

Description

Returns the abbreviated path of the entry currently being scanned. The abbreviated path is the path relative to the top level directory in the scan.

Return value

TPtrC

A non modifiable pointer descriptor for the abbreviated path of the entry currently being scanned.


FullPath()

TPtrC FullPath();

Description

Returns the full path of the entry currently being scanned. The full path includes the drive letter.

Return value

TPtrC

A non modifiable pointer descriptor for the full path of the entry currently being scanned..

[Top]


Enumerations


Enum TScanDirection

TScanDirection

Description

Scan direction

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