update
DirHandle Class Reference
[DirHandle functions]
Represents a directory stream. More...
#include <DirHandle.h>
Public Member Functions | |
virtual ssize_t | read (struct dirent *ent)=0 |
Read the next directory entry. | |
virtual int | close ()=0 |
Close a directory. | |
virtual void | seek (off_t offset)=0 |
Set the current position of the directory. | |
virtual off_t | tell ()=0 |
Get the current position of the directory. | |
virtual void | rewind ()=0 |
Rewind the current position to the beginning of the directory. | |
virtual size_t | size () |
Get the sizeof the directory. | |
MBED_DEPRECATED_SINCE ("mbed-os-5.4","Replaced by DirHandle::close") virtual int closedir() | |
Closes the directory. | |
MBED_DEPRECATED_SINCE ("mbed-os-5.4","Replaced by DirHandle::read") virtual struct dirent *readdir() | |
Returns the directory entry at the current position, and advances the position to the next entry. | |
MBED_DEPRECATED_SINCE ("mbed-os-5.4","Replaced by DirHandle::rewind") virtual void rewinddir() | |
Resets the position to the beginning of the directory. | |
MBED_DEPRECATED_SINCE ("mbed-os-5.4","Replaced by DirHandle::tell") virtual off_t telldir() | |
Returns the current position of the DirHandle. | |
MBED_DEPRECATED_SINCE ("mbed-os-5.4","Replaced by DirHandle::seek") virtual void seekdir(off_t location) | |
Sets the position of the DirHandle. |
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 56 of file DirHandle.h.
Member Function Documentation
virtual int close | ( | ) | [pure virtual] |
Close a directory.
- Returns:
- 0 on success, negative error code on failure
MBED_DEPRECATED_SINCE | ( | "mbed-os-5.4" | , |
"Replaced by DirHandle::seek" | |||
) |
Sets the position of the DirHandle.
- Parameters:
-
location The location to seek to. Must be a value returned by telldir.
Definition at line 166 of file DirHandle.h.
MBED_DEPRECATED_SINCE | ( | "mbed-os-5.4" | , |
"Replaced by DirHandle::read" | |||
) |
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.
Definition at line 132 of file DirHandle.h.
MBED_DEPRECATED_SINCE | ( | "mbed-os-5.4" | , |
"Replaced by DirHandle::rewind" | |||
) |
Resets the position to the beginning of the directory.
Definition at line 142 of file DirHandle.h.
MBED_DEPRECATED_SINCE | ( | "mbed-os-5.4" | , |
"Replaced by DirHandle::tell" | |||
) |
Returns the current position of the DirHandle.
- Returns:
- the current position, -1 on error.
Definition at line 155 of file DirHandle.h.
MBED_DEPRECATED_SINCE | ( | "mbed-os-5.4" | , |
"Replaced by DirHandle::close" | |||
) |
Closes the directory.
- Returns:
- 0 on success, -1 on error.
Definition at line 117 of file DirHandle.h.
virtual ssize_t read | ( | struct dirent * | ent ) | [pure virtual] |
Read the next directory entry.
- Parameters:
-
ent The directory entry to fill out
- Returns:
- 1 on reading a filename, 0 at end of directory, negative error on failure
virtual void rewind | ( | ) | [pure virtual] |
Rewind the current position to the beginning of the directory.
virtual void seek | ( | off_t | offset ) | [pure virtual] |
Set the current position of the directory.
- Parameters:
-
offset Offset of the location to seek to, must be a value returned from tell
virtual size_t size | ( | ) | [virtual] |
Get the sizeof the directory.
- Returns:
- Number of files in the directory
Definition at line 94 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
Generated on Fri Jul 15 2022 12:20:01 by 1.7.2