mbed-drivers
Public Member Functions | List of all members
mbed::DirHandle Class Referenceabstract

#include <DirHandle.h>

Inheritance diagram for mbed::DirHandle:
mbed::BaseDirHandle

Public Member Functions

virtual int closedir ()=0
 
virtual struct direntreaddir ()=0
 
virtual void rewinddir ()=0
 
virtual off_t telldir ()
 
virtual void seekdir (off_t location)
 

Detailed Description

Represents a directory stream. Objects of this type are returned by a FileSystemLike's opendir method. Implementations must define at least closedir, readdir and rewinddir.

If a FileSystemLike class defines the opendir method, then the directories of an object of that type can be accessed by DIR *d = opendir("/example/directory") (or opendir("/example") to open the root of the filesystem), and then using readdir(d) etc.

The root directory is considered to contain all FileLike and FileSystemLike objects, so the DIR* returned by opendir("/") will reflect this.

Member Function Documentation

virtual int mbed::DirHandle::closedir ( )
pure virtual

Closes the directory.

Returns
0 on success, -1 on error.

Implemented in mbed::BaseDirHandle.

virtual struct dirent* mbed::DirHandle::readdir ( )
pure virtual

Return the directory entry at the current position, and advances the position to the next entry.

Returns
A pointer to a dirent structure representing the directory entry at the current position, or NULL on reaching end of directory or error.

Implemented in mbed::BaseDirHandle.

virtual void mbed::DirHandle::rewinddir ( )
pure virtual

Resets the position to the beginning of the directory.

Implemented in mbed::BaseDirHandle.

virtual void mbed::DirHandle::seekdir ( off_t  location)
inlinevirtual

Sets the position of the DirHandle.

Parameters
locationThe location to seek to. Must be a value returned by telldir.

Reimplemented in mbed::BaseDirHandle.

virtual off_t mbed::DirHandle::telldir ( )
inlinevirtual

Returns the current position of the DirHandle.

Returns
the current position, -1 on error.

Reimplemented in mbed::BaseDirHandle.


The documentation for this class was generated from the following file: