mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Embed: (wiki syntax)

« Back to documentation index

DirHandle Class Reference

Represents a directory stream. More...

#include <DirHandle.h>

Inherits NonCopyable< DirHandle >, and NonCopyable< DirHandle >.

Inherited by LocalDirHandle.

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.
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.

Private Member Functions

 MBED_DEPRECATED ("Invalid copy construction of a NonCopyable resource.") NonCopyable(const NonCopyable &)
 NonCopyable copy constructor.
 MBED_DEPRECATED ("Invalid copy assignment of a NonCopyable resource.") NonCopyable &operator
 NonCopyable copy assignment operator.
 MBED_DEPRECATED ("Invalid copy construction of a NonCopyable resource.") NonCopyable(const NonCopyable &)
 NonCopyable copy constructor.
 MBED_DEPRECATED ("Invalid copy assignment of a NonCopyable resource.") NonCopyable &operator
 NonCopyable copy assignment operator.

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 cmsis/BUILD/mbed/platform/DirHandle.h.


Member Function Documentation

virtual int close (  ) [pure virtual]

Close a directory.

Returns:
0 on success, negative error code on failure
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::tell"   
)

Returns the current position of the DirHandle.

Returns:
the current position, -1 on error.

Definition at line 155 of file platform/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 cmsis/BUILD/mbed/platform/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 cmsis/BUILD/mbed/platform/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 platform/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 platform/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 cmsis/BUILD/mbed/platform/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 platform/DirHandle.h.

MBED_DEPRECATED_SINCE ( "mbed-os-5.4"  ,
"Replaced by DirHandle::seek"   
)

Sets the position of the DirHandle.

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

Definition at line 166 of file cmsis/BUILD/mbed/platform/DirHandle.h.

MBED_DEPRECATED_SINCE ( "mbed-os-5.4"  ,
"Replaced by DirHandle::seek"   
)

Sets the position of the DirHandle.

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

Definition at line 166 of file platform/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 cmsis/BUILD/mbed/platform/DirHandle.h.

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
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
virtual void rewind (  ) [pure virtual]

Rewind the current position to the beginning of the directory.

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:
offsetOffset of the location to seek to, must be a value returned from tell
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
virtual size_t size (  ) [virtual]

Get the sizeof the directory.

Returns:
Number of files in the directory

Definition at line 94 of file platform/DirHandle.h.

virtual size_t size (  ) [virtual]

Get the sizeof the directory.

Returns:
Number of files in the directory

Definition at line 94 of file cmsis/BUILD/mbed/platform/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
virtual off_t tell (  ) [pure virtual]

Get the current position of the directory.

Returns:
Position of the directory that can be passed to rewind