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

Represents a directory stream. More...

#include <DirHandle.h>

Inheritance diagram for DirHandle:
NonCopyable< DirHandle > Dir

Public Member Functions

virtual ssize_t read (struct dirent *ent)=0
 Read the next directory entry. More...
 
virtual int close ()=0
 Close a directory. More...
 
virtual void seek (off_t offset)=0
 Set the current position of the directory. More...
 
virtual off_t tell ()=0
 Get the current position of the directory. More...
 
virtual void rewind ()=0
 Rewind the current position to the beginning of the directory. More...
 
virtual size_t size ()
 Get the sizeof the directory. More...
 

Detailed Description

Represents a directory stream.

An opendir function returns objects of this type. The core functions are read and seek, but only a subset needs to be provided.

If a FileSystemLike class defines the opendir method, then you can access the directories of an object of that type by either:

DIR *d = opendir("/example/directory");

or

DIR *d = opendir("/example");

to open the root of the file system.

The root directory is considered to contain all FileHandle and FileSystem objects, so the DIR pointer returned by opendir("/") reflects this.

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

Definition at line 55 of file DirHandle.h.

Member Function Documentation

virtual int close ( )
pure virtual

Close a directory.

Returns
0 on success, negative error code on failure

Implemented in Dir.

virtual ssize_t 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 Dir.

virtual void rewind ( )
pure virtual

Rewind the current position to the beginning of the directory.

Implemented in Dir.

virtual void 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 Dir.

virtual size_t size ( )
virtual

Get the sizeof the directory.

Returns
Number of files in the directory

Reimplemented in Dir.

Definition at line 93 of file DirHandle.h.

virtual off_t tell ( )
pure virtual

Get the current position of the directory.

Returns
Position of the directory that can be passed to rewind

Implemented in Dir.

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.