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

Dir class. More...

#include <Dir.h>

Inheritance diagram for Dir:
DirHandle NonCopyable< DirHandle >

Public Member Functions

 Dir ()
 Create an uninitialized directory. More...
 
 Dir (FileSystem *fs, const char *path)
 Open a directory on a filesystem. More...
 
virtual ~Dir ()
 Destroy a file. More...
 
virtual int open (FileSystem *fs, const char *path)
 Open a directory on the filesystem. More...
 
virtual int close ()
 Close a directory. More...
 
virtual ssize_t read (struct dirent *ent)
 Read the next directory entry. More...
 
virtual void seek (off_t offset)
 Set the current position of the directory. More...
 
virtual off_t tell ()
 Get the current position of the directory. More...
 
virtual void rewind ()
 Rewind the current position to the beginning of the directory. More...
 
virtual size_t size ()
 Get the sizeof the directory. More...
 
virtual int closedir ()
 Closes the directory. More...
 
virtual struct direntreaddir ()
 Returns the directory entry at the current position, and advances the position to the next entry. More...
 
virtual void rewinddir ()
 Resets the position to the beginning of the directory. More...
 
virtual off_t telldir ()
 Returns the current position of the DirHandle. More...
 
virtual void seekdir (off_t location)
 Sets the position of the DirHandle. More...
 

Detailed Description

Dir class.

Definition at line 30 of file Dir.h.

Constructor & Destructor Documentation

Dir ( )

Create an uninitialized directory.

Must call open to initialize the directory on a file system

Dir ( FileSystem fs,
const char *  path 
)

Open a directory on a filesystem.

Parameters
fsFilesystem as target for a directory
pathName of the directory to open
virtual ~Dir ( )
virtual

Destroy a file.

Closes file if the file is still open

Member Function Documentation

virtual int close ( )
virtual

Close a directory.

Returns
0 on success, negative error code on failure

Implements DirHandle.

virtual int closedir ( )
virtualinherited

Closes the directory.

Returns
0 on success, -1 on error.
Deprecated:
Replaced by `int DirHandle::close()'

Definition at line 117 of file DirHandle.h.

virtual int open ( FileSystem fs,
const char *  path 
)
virtual

Open a directory on the filesystem.

Parameters
fsFilesystem as target for a directory
pathName of the directory to open
Returns
0 on success, negative error code on failure
virtual ssize_t read ( struct dirent ent)
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

Implements DirHandle.

virtual struct dirent* readdir ( )
virtualinherited

Returns 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)

Definition at line 132 of file DirHandle.h.

virtual void rewind ( )
virtual

Rewind the current position to the beginning of the directory.

Implements DirHandle.

virtual void rewinddir ( )
virtualinherited

Resets the position to the beginning of the directory.

Deprecated:
Replaced by `void DirHandle::rewind()'

Definition at line 142 of file DirHandle.h.

virtual void seek ( off_t  offset)
virtual

Set the current position of the directory.

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

Implements DirHandle.

virtual void seekdir ( off_t  location)
virtualinherited

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)'

Definition at line 166 of file DirHandle.h.

virtual size_t size ( )
virtual

Get the sizeof the directory.

Returns
Number of files in the directory

Reimplemented from DirHandle.

virtual off_t tell ( )
virtual

Get the current position of the directory.

Returns
Position of the directory that can be passed to rewind

Implements DirHandle.

virtual off_t telldir ( )
virtualinherited

Returns the current position of the DirHandle.

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

Definition at line 155 of file DirHandle.h.

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.