DCMTK
Version 3.6.6
OFFIS DICOM Toolkit
|
A class representing paths on a filesystem. More...
Public Member Functions | |
OFpath () | |
Construct an empty path. More... | |
OFpath (const OFpath &rhs) | |
Copy construct a path. More... | |
OFpath (OFrvalue_ref(OFpath) rhs) | |
Move construct a path. More... | |
OFpath (const char *const cstr) | |
Construct an OFpath from a const char*. More... | |
OFpath (const OFString &string) | |
Constructs an OFpath from an OFString. More... | |
OFpath & | operator= (const OFpath &rhs) |
Copy-assign another OFpath to this one. More... | |
OFpath & | operator= (OFrvalue_ref(OFpath) rhs) |
Move-assign another OFpath to this one. More... | |
OFBool | empty () const |
Test whether the path is empty. More... | |
OFBool | is_absolute () const |
Test whether the path is absolute, i.e. refers to a certain location unaffected by which directory is set as the current working directory. More... | |
OFBool | is_relative () const |
Test whether the path is relative, e.g. needs to be concatenated to another path before it refers to a filesystem location. More... | |
OFBool | has_root_name () const |
Test whether the path contains a root name. More... | |
OFBool | has_root_directory () const |
Test whether the path contains a root directory. More... | |
OFBool | has_filename () const |
Test whether the path contains a filename. More... | |
OFBool | has_extension () const |
Test whether the path contains a filename extension. More... | |
const OFString & | native () const |
Retrieve the underlying native string. More... | |
const char * | c_str () const |
Retrieve a native character pointer. More... | |
OFrvalue< OFpath > | root_name () const |
Return the root name contained in the path (if any) or an empty path. More... | |
OFrvalue< OFpath > | filename () const |
Return the filename contained in the path (if any) or an empty path. More... | |
OFrvalue< OFpath > | extension () const |
Return the filename extension contained in the path (if any) or an empty path. More... | |
OFpath & | operator/= (const OFpath &rhs) |
Append another path to this one, handling various special cases. More... | |
Static Public Attributes | |
static const char | preferred_separator = PATH_SEPARATOR |
The path separator used in the native path syntax, i.e. '\' on Windows and '/' everywhere else. | |
Related Definitions | |
Global types, methods and objects that are somehow related | |
OFrvalue< OFpath > | operator/ (const OFpath &lhs, const OFpath &rhs) |
Append two paths. More... | |
STD_NAMESPACE ostream & | operator<< (STD_NAMESPACE ostream &out, const OFpath &rhs) |
Print a path to an output stream. More... | |
OFBool | operator< (const OFpath &lhs, const OFpath &rhs) |
Lexicographically compare two paths. More... | |
OFBool | operator> (const OFpath &lhs, const OFpath &rhs) |
Lexicographically compare two paths. More... | |
OFBool | operator<= (const OFpath &lhs, const OFpath &rhs) |
Lexicographically compare two paths. More... | |
OFBool | operator>= (const OFpath &lhs, const OFpath &rhs) |
Lexicographically compare two paths. More... | |
OFBool | operator== (const OFpath &lhs, const OFpath &rhs) |
Lexicographically compare two paths. More... | |
OFBool | operator!= (const OFpath &lhs, const OFpath &rhs) |
Lexicographically compare two paths. More... | |
A class representing paths on a filesystem.
OFpath implements a subset of the functionality described as std::filesystem::path, see http://en.cppreference.com/w/cpp/filesystem/path for more information.
OFpath::OFpath | ( | ) |
Construct an empty path.
An empty path refers to the same location as the path "." on most systems.
OFpath::OFpath | ( | const OFpath & | rhs | ) |
Copy construct a path.
rhs | another OFpath object that this one will be constructed from. |
OFpath::OFpath | ( | OFrvalue_ref(OFpath) | rhs | ) |
Move construct a path.
rhs | another OFpath object that this one will be constructed from. |
OFpath::OFpath | ( | const char *const | cstr | ) |
Construct an OFpath from a const char*.
cstr | a plain old C character string. |
OFpath::OFpath | ( | const OFString & | string | ) |
Constructs an OFpath from an OFString.
string | an OFString. |
const char* OFpath::c_str | ( | ) | const |
OFBool OFpath::empty | ( | ) | const |
Return the filename extension contained in the path (if any) or an empty path.
The filename extension is the part of the filename beginning at (and containing) the last '.', e.g. ".txt" for a file named "readme.txt". Special filenames like ".", ".." and hidden files like ".hidden" will be handled in a special way. The names ".", ".." and ".hidden" will give an empty string result, whereas ".hidden.txt" will give ".txt".
Return the filename contained in the path (if any) or an empty path.
The filename is the substring after the last path separator, and, for multi root filesystems also after the root name.
OFBool OFpath::has_extension | ( | ) | const |
Test whether the path contains a filename extension.
OFBool OFpath::has_filename | ( | ) | const |
Test whether the path contains a filename.
OFBool OFpath::has_root_directory | ( | ) | const |
Test whether the path contains a root directory.
OFBool OFpath::has_root_name | ( | ) | const |
Test whether the path contains a root name.
OFBool OFpath::is_absolute | ( | ) | const |
Test whether the path is absolute, i.e. refers to a certain location unaffected by which directory is set as the current working directory.
OFBool OFpath::is_relative | ( | ) | const |
Test whether the path is relative, e.g. needs to be concatenated to another path before it refers to a filesystem location.
const OFString& OFpath::native | ( | ) | const |
Retrieve the underlying native string.
Referenced by operator!=(), operator<(), operator<<(), operator<=(), operator==(), operator>(), and operator>=().
Append another path to this one, handling various special cases.
rhs | another OFpath object to append to this one. |
This operator will append another path to the existing one, always doing the right thing. There are many special cases it accounts for, for details see (http://en.cppreference.com/w/cpp/filesystem/path/append) In short: you can trust it to turn "path" / "file" into "path\file" on Windows and "path/file" everywhere else, while also ensuring "path/" / "file" will become "path/file" and not "path//file" and many more.
OFpath& OFpath::operator= | ( | OFrvalue_ref(OFpath) | rhs | ) |
Return the root name contained in the path (if any) or an empty path.
The root name is a concept used in multi root filesystems (Windows) to identify the root (e.g. C:).
Lexicographically compare two paths.
lhs | the left hand side path for the operation. |
rhs | the right hand side path for the operation. |
References native().
Append two paths.
lhs | the left hand side path for the operation. |
rhs | the right hand side path for the operation. |
Lexicographically compare two paths.
lhs | the left hand side path for the operation. |
rhs | the right hand side path for the operation. |
References native().
|
related |
Print a path to an output stream.
The parameters and return value are as usual for the output stream operator, the only thing worth mentioning is that the path will be put into double quotes, i.e. it will print "rhs.native()".
out | the stream. |
rhs | the path |
References native().
Lexicographically compare two paths.
lhs | the left hand side path for the operation. |
rhs | the right hand side path for the operation. |
References native().
Lexicographically compare two paths.
lhs | the left hand side path for the operation. |
rhs | the right hand side path for the operation. |
References native().
Lexicographically compare two paths.
lhs | the left hand side path for the operation. |
rhs | the right hand side path for the operation. |
References native().
Lexicographically compare two paths.
lhs | the left hand side path for the operation. |
rhs | the right hand side path for the operation. |
References native().