OpendTect
6.6
|
Public Types | |
enum | Style { Local , Unix , Windows } |
Public Member Functions | |
FilePath (const char *fullinp=0) | |
FilePath (const char *p1, const char *p2, const char *p3=0, const char *p4=0, const char *p5=0) | |
FilePath (const FilePath &, const char *p2, const char *p3=0, const char *p4=0, const char *p5=0) | |
FilePath (const FilePath &fp) | |
FilePath & | add (const char *) |
at end More... | |
BufferString | baseName () const |
return name of file w/o path & ext More... | |
const OD::String & | dir (int nr=-1) const |
nr < 0 returns last dir name More... | |
BufferString | dirUpTo (int) const |
nr < 0 returns last dir, including prefix More... | |
bool | exists () const |
const char * | extension () const |
may return null More... | |
const OD::String & | fileName () const |
BufferString | fullPath (Style s=Local, bool cleanup=true) const |
FilePath & | insert (const char *) |
after prefix at start More... | |
bool | isAbsolute () const |
bool | isEmpty () const |
bool | isSubDirOf (const FilePath &, FilePath *reldir=0) const |
bool | makeCanonical () |
bool | makeRelativeTo (const FilePath &) |
int | nrLevels () const |
bool | operator!= (const char *fnm) const |
bool | operator!= (const FilePath &) const |
FilePath & | operator= (const char *fullinp) |
FilePath & | operator= (const FilePath &) |
bool | operator== (const char *fnm) const |
bool | operator== (const FilePath &) const |
BufferString | partitionName () const |
BufferString | pathOnly () const |
BufferString | pathOnly (Style) const |
const char * | prefix () const |
BufferString | rootPath () const |
FilePath & | set (const char *fullinp) |
void | setExtension (const char *, bool replace=true) |
!replace => add More... | |
void | setFileName (const char *) |
pass null to remove level More... | |
void | setPath (const char *) |
including prefix More... | |
BufferString | winDrive () const |
Static Public Member Functions | |
static const char * | dirSep (Style) |
static BufferString | getFullLongPath (const FilePath &) |
static BufferString | getTempDir () |
static BufferString | getTempFileName (const char *typ, const char *ext) |
static BufferString | getTempFullPath (const char *typ, const char *ext) |
static BufferString | getTempName (const char *ext=0) |
static BufferString | getTimeStampFileName (const char *ext) |
static BufferString | mkCleanPath (const char *path, Style fmt) |
Static Public Attributes | |
static const char * | sPrefSep |
Protected Member Functions | |
void | addPart (const char *) |
void | compress (int sl=0) |
void | trueDirIfLink () |
Protected Attributes | |
bool | isabs_ |
BufferStringSet | lvls_ |
BufferString | prefix_ |
File pathname tools.
This class splits a full filename (with path) into the separate parts: directories and possibly a filename (the last part does not have to be a file name). That makes it easy to change the file name, or the path only, or the extension, add directories, etc.
To get the result after manipulation, use the fullPath().
fileName() returns the last part, pathOnly() returns all but the last part. setFileName() replaces the last part, setPath() replaces all but the last part.
<>
enum FilePath::Style |
FilePath::FilePath | ( | const char * | fullinp = 0 | ) |
FilePath::FilePath | ( | const char * | p1, |
const char * | p2, | ||
const char * | p3 = 0 , |
||
const char * | p4 = 0 , |
||
const char * | p5 = 0 |
||
) |
|
inline |
FilePath::FilePath | ( | const FilePath & | , |
const char * | p2, | ||
const char * | p3 = 0 , |
||
const char * | p4 = 0 , |
||
const char * | p5 = 0 |
||
) |
FilePath& FilePath::add | ( | const char * | ) |
at end
|
protected |
BufferString FilePath::baseName | ( | ) | const |
return name of file w/o path & ext
|
protected |
const OD::String& FilePath::dir | ( | int | nr = -1 | ) | const |
nr < 0 returns last dir name
|
static |
BufferString FilePath::dirUpTo | ( | int | ) | const |
nr < 0 returns last dir, including prefix
bool FilePath::exists | ( | ) | const |
const char* FilePath::extension | ( | ) | const |
may return null
const OD::String& FilePath::fileName | ( | ) | const |
BufferString FilePath::fullPath | ( | Style | s = Local , |
bool | cleanup = true |
||
) | const |
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
|
static |
FilePath& FilePath::insert | ( | const char * | ) |
after prefix at start
bool FilePath::isAbsolute | ( | ) | const |
bool FilePath::isEmpty | ( | ) | const |
If reldir is set, it will be filled with the relative path.
bool FilePath::makeCanonical | ( | ) |
bool FilePath::makeRelativeTo | ( | const FilePath & | ) |
|
static |
int FilePath::nrLevels | ( | ) | const |
bool FilePath::operator!= | ( | const char * | fnm | ) | const |
bool FilePath::operator!= | ( | const FilePath & | ) | const |
FilePath& FilePath::operator= | ( | const char * | fullinp | ) |
bool FilePath::operator== | ( | const char * | fnm | ) | const |
bool FilePath::operator== | ( | const FilePath & | ) | const |
BufferString FilePath::partitionName | ( | ) | const |
BufferString FilePath::pathOnly | ( | ) | const |
BufferString FilePath::pathOnly | ( | Style | ) | const |
const char* FilePath::prefix | ( | ) | const |
BufferString FilePath::rootPath | ( | ) | const |
FilePath& FilePath::set | ( | const char * | fullinp | ) |
void FilePath::setExtension | ( | const char * | , |
bool | replace = true |
||
) |
!replace => add
void FilePath::setFileName | ( | const char * | ) |
pass null to remove level
void FilePath::setPath | ( | const char * | ) |
including prefix
|
protected |
BufferString FilePath::winDrive | ( | ) | const |
|
protected |
|
protected |
|
protected |
|
static |
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2022