Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: f32file.h
Link against: efsrv.lib

Class RDir

RDir

Support

Supported from 5.0

Description

Reads the entries contained in a directory.

You must first open the directory, specifying an attribute mask which is used by Read() calls to filter the entry types required. Then, use one of the Read() functions to read the filtered entries. When the operation is complete, the directory should be closed using Close(), defined in the base class RFsBase.

There are two types of Read(): one works with a single entry at a time, requiring programs to iterate through the entries explicitly. The other works with an entire TEntryArray, allowing multiple entries to be read in one call. As well as making application program logic somewhat simpler, this type uses fewer calls to the server, and is more efficient.

Each type of Read() can be performed either synchronously or asynchronously.

It may be more convenient to use RFs::GetDir() than the Read() calls supported by this class. RFs::GetDir() has the advantage that it allows a directory’s entries to be sorted in various ways. However, it does not provide asynchronous as well as synchronous variants and does not allow entries to be read individually.

Derivation

RDirReads the entries contained in a directory
RFsBaseBase class that provides a Close() function for file related clean-up
RSubSessionBaseClient-side handle to a sub-session

Defined in RDir:
Open(), Read()

Inherited from RFsBase:
Close()

Inherited from RSubSessionBase:
CloseSubSession(), CreateSubSession(), Send(), SendReceive(), SubSessionHandle(), operator=()


Opening and reading directories


Open()

TInt Open(RFs& aFs,const TDesC& aMatchName,TUint anEntryAttMask);

Description

Opens a directory using an attribute bitmask to filter the directory entry types which will subsequently be read. This function, or its overload, must be called before reading the entries in the directory.

Note:

Parameters

RFs& aFs

File server session

const TDesC& aMatchName

Name of the directory to open. Any path components which are not specified here will be taken from the session path.

TUint anEntryAttMask

Attribute mask used by the Read() calls to filter the entry types required. Only those entries with attributes specified here will be read. Also see KEntryAttNormal and the other file or directory attributes.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.


Open()

TInt Open(RFs& aFs,const TDesC& aMatchName,const TUidType& aUidType);

Description

Opens a directory using the specified UID type to filter the directory entry types which will subsequently be read. This function, or its overload, must be called before reading the entries in the directory.

Note:

Parameters

RFs& aFs

File server session

const TDesC& aMatchName

Name of the directory to open. Any path components which are not specified here will be taken from the session path.

const TUidType& aUidType

UID type used by the Read() calls to filter the entry types required. Only those entries with the UIDs specified here will be read.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.


Read()

TInt Read(TEntryArray& anArray) const;

Description

Reads all filtered directory entries into the array specified — synchronous overload.

Notes:

Parameters

TEntryArray& anArray

On return, contains filtered entries from the directory.

Return value

TInt

KErrNone if successful, KErrEof if all the entries in the directory have been read, otherwise another of the system-wide error codes.


Read()

void Read(TEntryArray& anArray,TRequestStatus& aStatus) const;

Description

Reads all filtered directory entries into the array specified — asynchronous overload.

Notes:

Parameters

TEntryArray& anArray

On return, contains filtered entries from the directory.

TRequestStatus& aStatus

Request status object. On completion, will contain an error code. KErrNone if successful, otherwise another of the system-wide error codes.


Read()

TInt Read(TEntry& anEntry) const;

Description

Reads a single directory entry — synchronous overload.

Notes:

Parameters

TEntry& anEntry

On return, contains a directory entry.

Return value

TInt

KErrNone if successful, KErrEof if all the entries in the directory have been read, otherwise another of the system-wide error codes.


Read()

void Read(TPckg<TEntry>& anEntry,TRequestStatus& aStatus) const;

Description

Reads a single directory entry — asynchronous overload.

Notes:

Parameters

TPckg<TEntry>& anEntry

On return, contains a directory entry.

TRequestStatus& aStatus

Request status object. KErrNone if successful, KErrEof if all the entries in the directory have been read, otherwise another of the system-wide error codes.