Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
FileItem Class Reference

#include <elm/sys/FileItem.h>

+ Inheritance diagram for FileItem:

Public Member Functions

virtual LockPtr< FiletoFile ()
 
virtual LockPtr< DirectorytoDirectory ()
 
String name ()
 
Pathpath ()
 
bool isReadable ()
 
bool isWritable ()
 
bool isDeletable ()
 
- Public Member Functions inherited from Lock
 Lock (int usage=0)
 
void lock (void)
 
void unlock (void)
 
int usage (void) const
 

Static Public Member Functions

static LockPtr< FileItemget (Path path)
 

Protected Member Functions

 FileItem (Path path, ino_t inode)
 
virtual ~FileItem ()
 

Protected Attributes

Directoryparent
 
Path _path
 
ino_t ino
 

Detailed Description

This class represents an item of the file systems. It is inheited from File and Directory classes.

Constructor & Destructor Documentation

◆ FileItem()

FileItem ( Path  path,
ino_t  inode 
)
protected

References FileItem::path().

Referenced by FileItem::get().

◆ ~FileItem()

~FileItem ( )
protectedvirtual

Member Function Documentation

◆ get()

LockPtr< FileItem > get ( Path  path)
static

Find a file by its name.

Parameters
pathPath of the looked file.
Returns
File matching the given path or null if file does not exists.
Exceptions
SystemExceptionIf there is a system error.

References Path::asSysString(), Path::canonical(), FileItem::FileItem(), elm::files, and FileItem::path().

Referenced by Directory::make().

◆ isDeletable()

bool isDeletable ( )

Test if the file may be deleted.

Returns
True if is deletable, false else.

References FileItem::_path, Path::asSysString(), and Path::parent().

◆ isReadable()

bool isReadable ( )

Test if the file is readble.

Returns
True if it is readable.

References FileItem::_path, and Path::asSysString().

◆ isWritable()

bool isWritable ( )

Test if the file is readble.

Returns
True if it is readable.

References FileItem::_path, and Path::asSysString().

◆ name()

String name ( )

Get the name of the file.

Returns
File name.

References FileItem::_path, and Path::namePart().

◆ path()

Path & path ( )

Get the path of the file.

Returns
File path.

References FileItem::_path.

Referenced by FileItem::FileItem(), FileItem::get(), elm::sys::isLibrary(), Directory::make(), File::size(), and FileItem::~FileItem().

◆ toDirectory()

LockPtr< Directory > toDirectory ( )
virtual

Convert the file item to directory if it is consistent.

Returns
Matching directory or null (if it is a regular file for example).

Reimplemented in Directory.

◆ toFile()

LockPtr< File > toFile ( )
virtual

Convert the file item to file if it is consistent.

Returns
Matching file or null (if it is a directory for example).

Reimplemented in File.

Member Data Documentation

◆ _path

◆ ino

ino_t ino
protected

Referenced by FileItem::~FileItem().

◆ parent

Directory* parent
protected

The documentation for this class was generated from the following files: