mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Embed: (wiki syntax)

« Back to documentation index

FileSystemLike Class Reference

FileSystemLike Class Reference

A filesystem-like object is one that can be used to open files though it by fopen("/name/filename", mode) More...

#include <FileSystemLike.h>

Inherits mbed::FileBase.

Inherited by LocalFileSystem.

Public Member Functions

 FileSystemLike (const char *name)
 FileSystemLike constructor.
virtual FileHandleopen (const char *filename, int flags)=0
 Opens a file from the filesystem.
virtual int remove (const char *filename)
 Remove a file from the filesystem.
virtual int rename (const char *oldname, const char *newname)
 Rename a file in the filesystem.
virtual DirHandleopendir (const char *name)
 Opens a directory in the filesystem and returns a DirHandle representing the directory stream.
virtual int mkdir (const char *name, mode_t mode)
 Creates a directory in the filesystem.

Detailed Description

A filesystem-like object is one that can be used to open files though it by fopen("/name/filename", mode)

Implementations must define at least open (the default definitions of the rest of the functions just return error values).

Definition at line 33 of file FileSystemLike.h.


Constructor & Destructor Documentation

FileSystemLike ( const char *  name )

FileSystemLike constructor.

Parameters:
nameThe name to use for the filesystem.

Definition at line 65 of file FileSystemLike.cpp.


Member Function Documentation

virtual int mkdir ( const char *  name,
mode_t  mode 
) [virtual]

Creates a directory in the filesystem.

Parameters:
nameThe name of the directory to create.
modeThe permissions to create the directory with.
Returns:
0 on success, -1 on failure.

Definition at line 97 of file FileSystemLike.h.

virtual FileHandle* open ( const char *  filename,
int  flags 
) [pure virtual]

Opens a file from the filesystem.

Parameters:
filenameThe name of the file to open.
flagsOne of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with zero or more of O_CREAT, O_TRUNC, or O_APPEND.
Returns:
A pointer to a FileHandle object representing the file on success, or NULL on failure.

Implemented in LocalFileSystem.

virtual DirHandle* opendir ( const char *  name ) [virtual]

Opens a directory in the filesystem and returns a DirHandle representing the directory stream.

Parameters:
nameThe name of the directory to open.
Returns:
A DirHandle representing the directory stream, or NULL on failure.

Reimplemented in LocalFileSystem.

Definition at line 86 of file FileSystemLike.h.

virtual int remove ( const char *  filename ) [virtual]

Remove a file from the filesystem.

Parameters:
filenamethe name of the file to remove.
returns0 on success, -1 on failure.

Reimplemented in LocalFileSystem.

Definition at line 64 of file FileSystemLike.h.

virtual int rename ( const char *  oldname,
const char *  newname 
) [virtual]

Rename a file in the filesystem.

Parameters:
oldnamethe name of the file to rename.
newnamethe name to rename it to.
Returns:
0 on success, -1 on failure.

Definition at line 75 of file FileSystemLike.h.