Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions
mbed::DirHandle Class Referenceabstract

#include <DirHandle.h>

Inheritance diagram for mbed::DirHandle:
mbed::NonCopyable< DirHandle > mbed::Dir

Public Member Functions

virtual ssize_t read (struct dirent *ent)=0
 
virtual int close ()=0
 
virtual void seek (off_t offset)=0
 
virtual off_t tell ()=0
 
virtual void rewind ()=0
 
virtual size_t size ()
 
virtual int closedir ()
 
virtual struct direntreaddir ()
 
virtual void rewinddir ()
 
virtual off_t telldir ()
 
virtual void seekdir (off_t location)
 

Detailed Description

Represents a directory stream. Objects of this type are returned by an opendir function. The core functions are read and seek, but only a subset needs to be provided.

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 FileHandle and FileSystem objects, so the DIR* returned by opendir("/") will reflect this.

Note
to create a directory,
See also
Dir
Note
Synchronization level: Set by subclass

Member Function Documentation

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

Close a directory

Returns
0 on success, negative error code on failure

Implemented in mbed::Dir.

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

Closes the directory.

Returns
0 on success, -1 on error.
Deprecated:
Replaced by `int DirHandle::close()'
virtual ssize_t mbed::DirHandle::read ( struct dirent ent)
pure virtual

Read the next directory entry

Parameters
entThe directory entry to fill out
Returns
1 on reading a filename, 0 at end of directory, negative error on failure

Implemented in mbed::Dir.

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

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.
Deprecated:
Replaced by `ssize_t DirHandle::read(struct dirent *ent)
virtual void mbed::DirHandle::rewind ( )
pure virtual

Rewind the current position to the beginning of the directory

Implemented in mbed::Dir.

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

Resets the position to the beginning of the directory.

Deprecated:
Replaced by `void DirHandle::rewind()'
virtual void mbed::DirHandle::seek ( off_t  offset)
pure virtual

Set the current position of the directory

Parameters
offsetOffset of the location to seek to, must be a value returned from tell

Implemented in mbed::Dir.

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.
Deprecated:
Replaced by `void DirHandle::seek(off_t offset)'
virtual size_t mbed::DirHandle::size ( )
inlinevirtual

Get the sizeof the directory

Returns
Number of files in the directory

Reimplemented in mbed::Dir.

virtual off_t mbed::DirHandle::tell ( )
pure virtual

Get the current position of the directory

Returns
Position of the directory that can be passed to rewind

Implemented in mbed::Dir.

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

Returns the current position of the DirHandle.

Returns
the current position, -1 on error.
Deprecated:
Replaced by `off_t DirHandle::tell()'

The documentation for this class was generated from the following file:
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.