Elm
1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/sys/Path.h>
Classes | |
class | PathIter |
Public Member Functions | |
Path (void) | |
Path (const char *path) | |
Path (CString path) | |
Path (const String &path) | |
Path (const Path &path) | |
Path | canonical (void) const |
Path | absolute (void) const |
Path | append (Path path) const |
Path | parent (void) const |
Path | setExtension (CString new_extension) const |
const String & | toString (void) const |
String | namePart (void) const |
sys::Path | dirPart (void) const |
Path | basePart (void) const |
String | extension (void) const |
bool | isAbsolute (void) const |
bool | isRelative (void) const |
bool | isHomeRelative (void) const |
bool | equals (Path &path) const |
bool | contains (Path &path) const |
bool | exists (void) const |
bool | isFile (void) const |
bool | isDir (void) const |
bool | isReadable (void) const |
bool | isWritable (void) const |
bool | isExecutable (void) const |
Path & | operator= (const char *str) |
Path & | operator= (CString str) |
Path & | operator= (const String &str) |
Path & | operator= (const Path &path) |
bool | operator== (Path path) const |
bool | operator!= (Path path) const |
Path | operator/ (const Path &path) const |
operator const String & (void) const | |
operator bool (void) const | |
const char * | operator& (void) const |
Static Public Member Functions | |
static bool | isSeparator (char c) |
static void | setCurrent (Path &path) |
static Path | current (void) |
static Path | home (void) |
Static Public Attributes | |
static const char | SEPARATOR = '/' |
static const char | PATH_SEPARATOR = ':' |
This class represents a file path in the current file system.
elm::sys::Path::Path | ( | void | ) |
elm::sys::Path::Path | ( | const char * | path | ) |
elm::sys::Path::Path | ( | CString | path | ) |
elm::sys::Path::Path | ( | const String & | path | ) |
elm::sys::Path::Path | ( | const Path & | path | ) |
Path elm::sys::Path::absolute | ( | void | ) | const |
Get the absolute path matching the current path.
References current(), home(), isAbsolute(), isHomeRelative(), Path(), and elm::String::substring().
Referenced by canonical().
Build a new path by appending two paths.
path | Path to append. |
References Path(), SEPARATOR, and elm::StringBuffer::toString().
Referenced by operator/().
Path elm::sys::Path::basePart | ( | void | ) | const |
Get the base part of the path, that is, the path without the extension of the file part.
References elm::String::lastIndexOf(), and elm::String::substring().
Path elm::sys::Path::canonical | ( | void | ) | const |
Get the canonical form of the current path. Usually, a relative path becomes an absolute one. Relative operators (.., .) are removed if it is possible.
References absolute(), isRelative(), and SEPARATOR.
Referenced by elm::sys::System::getUnitPath().
bool elm::sys::Path::contains | ( | Path & | path | ) | const |
Test if a path lexically contains another path.
References elm::String::startsWith().
|
static |
sys::Path elm::sys::Path::dirPart | ( | void | ) | const |
Return the directory part of the path.
References Path(), and elm::String::substring().
Referenced by elm::sys::evaluate().
bool elm::sys::Path::equals | ( | Path & | path | ) | const |
Test if two paths are lexically equals.
Referenced by operator!=(), and operator==().
bool elm::sys::Path::exists | ( | void | ) | const |
Test if the path matches a file, a directory or any file system object.
References toString().
String elm::sys::Path::extension | ( | void | ) | const |
Get the extension of the referenced file name.
References elm::String::lastIndexOf(), and elm::String::substring().
|
static |
Get the path of the home directory.
References Path().
Referenced by absolute().
bool elm::sys::Path::isAbsolute | ( | void | ) | const |
Test if the path is absolute.
References elm::String::length(), and SEPARATOR.
Referenced by absolute(), and isRelative().
bool elm::sys::Path::isDir | ( | void | ) | const |
Test if the path matches a directory.
References toString().
bool elm::sys::Path::isExecutable | ( | void | ) | const |
Test if the path matches an executable file system object.
References toString().
bool elm::sys::Path::isFile | ( | void | ) | const |
Test if the path matches a file.
References toString().
bool elm::sys::Path::isHomeRelative | ( | void | ) | const |
Test if the path is home-relative. On Unix, it is usually starting with "~".
References elm::String::length().
Referenced by absolute().
bool elm::sys::Path::isReadable | ( | void | ) | const |
Test if the path matches a readable file system object.
References toString().
bool elm::sys::Path::isRelative | ( | void | ) | const |
Test if the path is relative.
References isAbsolute().
Referenced by canonical().
|
static |
References SEPARATOR.
bool elm::sys::Path::isWritable | ( | void | ) | const |
Test if the path matches a writable file system object.
References toString().
String elm::sys::Path::namePart | ( | void | ) | const |
Return the name part of the path.
References elm::String::substring().
Referenced by elm::sys::Plugger::Iterator::item(), and elm::sys::FileItem::name().
elm::sys::Path::operator bool | ( | void | ) | const |
Test if the path is null.
elm::sys::Path::operator const String & | ( | void | ) | const |
References toString().
const char* elm::sys::Path::operator& | ( | void | ) | const |
Path& elm::sys::Path::operator= | ( | const char * | str | ) |
Path elm::sys::Path::parent | ( | void | ) | const |
Find the parent path of the current or an empty path if there is no parent.
References Path(), and elm::String::substring().
Referenced by elm::sys::FileItem::isDeletable(), and elm::sys::Plugger::plugFile().
|
static |
Change the current path.
path | New current path. |
Change the extension if there is some one or add the given extension.
new_extension | New extension to put in. |
References elm::String::lastIndexOf(), and elm::StringBuffer::toString().
Referenced by elm::sys::Plugger::plugFile().
String & elm::sys::Path::toString | ( | void | ) | const |
Convert the path to string.
Referenced by exists(), elm::sys::FileItem::isDeletable(), isDir(), isExecutable(), isFile(), elm::sys::FileItem::isReadable(), isReadable(), elm::sys::FileItem::isWritable(), isWritable(), elm::sys::Directory::Iterator::Iterator(), elm::sys::Directory::make(), operator const String &(), and elm::sys::operator<<().
|
static |
Referenced by elm::sys::Plugger::Plugger().
|
static |
Referenced by append(), canonical(), isAbsolute(), and isSeparator().