A class for handling file names. More...
#include <fileName.H>


Public Types | |
| enum | Type { UNDEFINED = 0 , FILE = 1 , DIRECTORY = 2 , SYMLINK = 4 , LINK = SYMLINK } |
| Enumerations to handle directory entry types. More... | |
Public Member Functions | |
| fileName ()=default | |
| Default construct. | |
| fileName (const fileName &)=default | |
| Copy construct. | |
| fileName (fileName &&)=default | |
| Move construct. | |
| fileName (const word &s) | |
| Copy construct from word. | |
| fileName (word &&s) | |
| Move construct from word. | |
| fileName (const string &s, bool doStrip=true) | |
| Copy construct from string. | |
| fileName (string &&s, bool doStrip=true) | |
| Move construct from string. | |
| fileName (const std::string &s, bool doStrip=true) | |
| Copy construct from std::string. | |
| fileName (std::string &&s, bool doStrip=true) | |
| Move construct from std::string. | |
| fileName (const char *s, bool doStrip=true) | |
| Copy construct from character array. | |
| fileName (const UList< word > &list) | |
| Construct by concatenating elements of wordList separated by '/'. | |
| fileName (std::initializer_list< word > list) | |
| Construct by concatenating words separated by '/'. | |
| fileName (Istream &is) | |
| Construct from Istream. | |
| bool | assign (const token &tok) |
| Assign from word or string token. | |
| void | stripInvalid () |
| Strip invalid characters. | |
| bool | clean () |
| Cleanup filename (inplace). | |
| Type | type (bool followLink=true, bool checkGzip=false) const |
| Return the directory entry type: UNDEFINED, FILE, DIRECTORY (or SYMLINK). | |
| bool | isAbsolute () const |
| Return true if filename is absolute, which means it starts with a '/' or '\' or (windows-only) with a filesystem-root. | |
| fileName & | toAbsolute () |
| Convert from relative to absolute. | |
| bool | isBackup () const |
| Return true if file name ends with "~", ".bak", ".old", ".save". | |
| fileName | path () const |
| Return directory path name (part before last /). | |
| bool | has_path () const |
| True if it contains a '/' character. | |
| word | name () const |
| Return basename (part beyond last /), including its extension. | |
| fileName & | replace_name (const word &newName) |
| Replace basename (part beyond last /) with a new name. | |
| word | stem () const |
| Return basename, without extension. | |
| word | ext () const |
| Return file name extension (part after last .). | |
| fileName & | ext (const word &ending) |
| Append a '.' and the ending, and return the object. | |
| fileName & | replace_ext (const word &ending) |
| Remove extension (if any) and append a new one. | |
| fileName | lessExt () const |
| Return file name without extension (part before last .). | |
| fileName | relative (const fileName &parent, const bool caseTag=false) const |
| Return a relative name by stripping off the parent directory where possible. | |
| wordList | components (const char delim='/') const |
| Return path components as wordList. | |
| word | component (const size_type cmpt, const char delim='/') const |
| Return a single component of the path or empty if out of range. | |
| fileName & | operator= (const fileName &str) |
| Copy assignment, no character validation required. | |
| fileName & | operator= (fileName &&str) |
| Move assignment, no character validation required. | |
| fileName & | operator= (const word &str) |
| Copy assignment, no character validation required. | |
| fileName & | operator= (word &&str) |
| Move assignment, no character validation required. | |
| fileName & | operator= (const string &str) |
| Copy assignment, stripping invalid characters. | |
| fileName & | operator= (string &&str) |
| Move assignment, stripping invalid characters. | |
| fileName & | operator= (const std::string &str) |
| Copy assignment, stripping invalid characters. | |
| fileName & | operator= (std::string &&str) |
| Move assignment, stripping invalid characters. | |
| fileName & | operator= (const char *str) |
| Copy, stripping invalid characters. | |
| fileName & | operator/= (const string &other) |
| Append a path element with '/' separator. | |
| bool | hasPath () const |
| Same as has_path(). | |
| bool | removePath () |
| Same as remove_path(). | |
| bool | hasExt () const |
| Same as has_ext(). | |
| bool | hasExt (const std::string &s) const |
| Same as has_ext(). | |
| bool | removeExt () |
| Same as remove_ext(). | |
| word | nameLessExt () const |
| Same as stem(). | |
| word | name (const bool noExt) const |
| Deprecated(2017-03) return basename, optionally without extension. | |
| bool | remove_path () |
| Remove leading path, return true if string changed. | |
| bool | remove_ext () |
| Remove extension, returning true if string changed. | |
| bool | has_ext () const |
| Various checks for extensions. | |
| bool | has_ext (const char *ending) const |
| Various checks for extensions. | |
| bool | has_ext (const std::string &ending) const |
| Various checks for extensions. | |
| bool | has_ext (const wordRe &ending) const |
| Various checks for extensions. | |
| Public Member Functions inherited from string | |
| string ()=default | |
| Default construct. | |
| string (const std::string &str) | |
| Copy construct from std::string. | |
| string (std::string &&str) | |
| Move construct from std::string. | |
| string (const char *str) | |
| Construct as copy of character array. | |
| string (const char *str, const size_type len) | |
| Construct as copy with a maximum number of characters. | |
| string (const char c) | |
| Construct from a single character. | |
| string (const size_type len, const char c) | |
| Construct fill copies of a single character. | |
| string (Istream &is) | |
| Construct from Istream. | |
| bool | match (const std::string &text) const |
| Test for equality. | |
| string & | replace (const std::string &s1, const std::string &s2, size_type pos=0) |
| Replace first occurrence of sub-string s1 with s2, beginning at pos. | |
| string & | replaceAll (const std::string &s1, const std::string &s2, size_type pos=0) |
| Replace all occurrences of sub-string s1 with s2, beginning at pos in the string. | |
| string & | replaceAny (const std::string &s1, const char c2, size_type pos=0) |
| Replace any occurrence of s1 characters with c2, beginning at pos in the string. | |
| string & | expand (const bool allowEmpty=false) |
| Inplace expand initial tags, tildes, and all occurrences of environment variables as per stringOps::expand. | |
| bool | removeRepeated (const char character) |
| Remove repeated characters. | |
| bool | removeStart (const std::string &text) |
| Remove the given text from the start of the string. | |
| bool | removeStart (const char c) |
| Remove leading character, unless string is a single character. | |
| bool | removeEnd (const std::string &text) |
| Remove the given text from the end of the string. | |
| bool | removeEnd (const char c) |
| Remove trailing character, unless string is a single character. | |
| void | swap (std::string &str) |
| Swap contents. Self-swapping is a no-op. | |
| bool | operator() (const std::string &text) const |
| Test for equality. Allows use as a predicate. | |
| bool | contains (char c) const noexcept |
| True if string contains given character (cf. C++23). | |
| bool | contains (const std::string &s) const noexcept |
| True if string contains given [string view] substring (cf. C++23). | |
| bool | contains (const char *s) const |
| True if string contains given substring (cf. C++23). | |
| bool | starts_with (char c) const |
| True if string starts with given character (cf. C++20). | |
| bool | starts_with (const std::string &s) const |
| True if string starts with given [string view] prefix (C++20). | |
| bool | starts_with (const char *s) const |
| True if string starts with given prefix (C++20). | |
| bool | ends_with (char c) const |
| True if string ends with given character (cf. C++20). | |
| bool | ends_with (const std::string &s) const |
| True if string ends with given [string view] suffix (cf. C++20). | |
| bool | ends_with (const char *s) const |
| True if string ends with given suffix (cf. C++20). | |
| size_type | count (const char c) const |
| Count the number of occurrences of the specified character in the string. | |
| bool | startsWith (const std::string &s) const |
| Deprecated(2019-11). | |
| bool | endsWith (const std::string &s) const |
| Deprecated(2019-11). | |
| bool | removeTrailing (const char c) |
| Deprecated(2019-11). | |
Static Public Member Functions | |
| static bool | valid (char c) |
| Is this character valid for a fileName? | |
| static fileName | validate (const std::string &, const bool doClean=true) |
| Construct fileName without invalid characters, possibly applying other transformations such as changing the path separator, removing duplicate or trailing slashes, etc. | |
| static fileName | concat (const std::string &s1, const std::string &s2, const char delim='/') |
| Join two strings with a path separator ('/' by default). | |
| static bool | equals (const std::string &s1, const std::string &s2) |
| This is a specialized (possibly slower) version of compare() that ignores duplicate or trailing slashes. | |
| static bool | clean (std::string &str) |
| Cleanup filename string, possibly applies other transformations such as changing the path separator etc. | |
| static bool | isAbsolute (const std::string &str) |
| Return true if filename starts with a '/' or '\' or (windows-only) with a filesystem-root. | |
| static bool | isBackup (const std::string &str) |
| Return true if string ends with "~", ".bak", ".old", ".save". | |
| static std::string | path (const std::string &str) |
| Return directory path name (part before last /). | |
| static std::string | name (const std::string &str) |
| Return basename (part beyond last /), including its extension. | |
| static std::string | stem (const std::string &str) |
| Return the basename, without extension. | |
| static std::string | nameLessExt (const std::string &s) |
| Same as stem(). | |
| Static Public Member Functions inherited from string | |
| static std::string::size_type | length (const char *s) |
| Length of the character sequence (with nullptr protection). | |
| static std::string::size_type | length (const std::string &s) |
| The length of the string. | |
| template<class StringType> | |
| static bool | valid (const std::string &str) |
| Does the string contain valid characters only? | |
| template<class StringType> | |
| static bool | stripInvalid (std::string &str) |
| Strip invalid characters from the given string. | |
| template<class StringType> | |
| static StringType | validate (const std::string &str) |
| Return a valid String from the given string. | |
Static Public Attributes | |
| static const char *const | typeName = "fileName" |
| The typeName. | |
| static int | debug |
| Debugging. | |
| static int | allowSpaceInFileName |
| Allow space character in fileName. To be used with caution. | |
| static const fileName | null |
| An empty fileName. | |
| Static Public Attributes inherited from string | |
| static const char *const | typeName = "string" |
| The type name "string". | |
| static int | debug |
| The debug flag. | |
| static const string | null |
| An empty string. | |
Additional Inherited Members | |
| Protected Member Functions inherited from string | |
| std::string::size_type | find_ext () const |
| Find position of a file extension dot, return npos on failure. | |
| word | ext () const |
| Return file name extension (part after last .). | |
| bool | ext (const word &ending) |
| Append a '.' and the ending. | |
| bool | has_ext () const |
| Return true if it has an extension or simply ends with a '.'. | |
| bool | has_ext (const char *ending) const |
| Return true if the extension is the same as the given ending. | |
| bool | has_ext (const std::string &ending) const |
| Return true if the extension is the same as the given ending. | |
| bool | has_ext (const wordRe &ending) const |
| Return true if the extension matches the given ending. | |
| bool | remove_path () |
| Remove leading path, return true if string changed. | |
| bool | remove_ext () |
| Remove extension, return true if string changed. | |
| Static Protected Member Functions inherited from string | |
| static std::string::size_type | find_ext (const std::string &str) |
| Find position of a file extension dot, return npos on failure. | |
| template<class PrimitiveType> | |
| static std::string::size_type | string_printf (std::string &output, const char *fmt, const PrimitiveType &val) |
| A printf-style formatter for a primitive. | |
| template<class PrimitiveType> | |
| static std::string::size_type | string_printf (std::string &output, const std::string &fmt, const PrimitiveType &val) |
| A printf-style formatter for a primitive. | |
A class for handling file names.
A fileName is a string of characters without whitespace or quotes. A fileName can be
The string::expand() method expands environment variables, etc,
Definition at line 72 of file fileName.H.
| enum Type |
Enumerations to handle directory entry types.
| Enumerator | |
|---|---|
| UNDEFINED | Undefined type. |
| FILE | A regular file. |
| DIRECTORY | A directory. |
| SYMLINK | A symbolic link. |
| LINK | Same as symlink. |
Definition at line 81 of file fileName.H.
|
default |
Default construct.
Referenced by concat(), FileName::FileName(), FileName::FileName(), FileName::FileName(), fileName(), fileName(), operator/=(), FileName::operator=(), operator=(), operator=(), relative(), toAbsolute(), and validate().

|
default |
|
default |
Move construct.
References fileName(), string::has_ext(), string::remove_ext(), string::remove_path(), and s().

|
inline |
Copy construct from word.
Definition at line 26 of file fileNameI.H.
References s(), and string::string().

|
inline |
Move construct from word.
Definition at line 32 of file fileNameI.H.
References s(), and string::string().

|
inline |
Copy construct from string.
Definition at line 38 of file fileNameI.H.
References s(), string::string(), and stripInvalid().

|
inline |
Move construct from string.
Definition at line 49 of file fileNameI.H.
References s(), string::string(), and stripInvalid().

|
inline |
Copy construct from std::string.
Definition at line 60 of file fileNameI.H.
References s(), string::string(), and stripInvalid().

|
inline |
Move construct from std::string.
Definition at line 71 of file fileNameI.H.
References s(), string::string(), and stripInvalid().

|
inline |
Copy construct from character array.
Definition at line 82 of file fileNameI.H.
References s(), string::string(), and stripInvalid().

Construct by concatenating elements of wordList separated by '/'.
Definition at line 310 of file fileName.C.
References string::length(), and reserve().

|
explicit |
Construct by concatenating words separated by '/'.
Definition at line 330 of file fileName.C.
References string::length(), and reserve().

|
explicit |
Construct from Istream.
Definition at line 27 of file fileNameIO.C.
| bool assign | ( | const token & | tok | ) |
Assign from word or string token.
Definition at line 35 of file fileNameIO.C.
References assign(), token::isQuotedString(), token::isWord(), token::stringToken(), stripInvalid(), and token::wordToken().
Referenced by assign(), operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), Foam::operator>>(), and replace_name().


|
inlinestatic |
Is this character valid for a fileName?
Definition at line 95 of file fileNameI.H.
References allowSpaceInFileName, and Foam::isspace().
Referenced by FileName::valid().


|
static |
Construct fileName without invalid characters, possibly applying other transformations such as changing the path separator, removing duplicate or trailing slashes, etc.
Definition at line 198 of file fileName.C.
References fileName().
Referenced by Foam::argList::get< Foam::fileName >(), Foam::argList::get< Foam::fileName >(), and Foam::readDir().


|
static |
Join two strings with a path separator ('/' by default).
No separator is added if either argument is an empty string or if the arguments already had the path separator at the junction. Invalid characters are not stripped (ie, retained).
Definition at line 210 of file fileName.C.
References fileName().
Referenced by dictionary::add(), dictionary::changeKeyword(), dictionary::dictionary(), primitiveEntry::primitiveEntry(), and Foam::rmDir().


|
static |
This is a specialized (possibly slower) version of compare() that ignores duplicate or trailing slashes.
Definition at line 238 of file fileName.C.
|
inline |
Strip invalid characters.
Definition at line 106 of file fileNameI.H.
References debug, string::removeEnd(), string::removeRepeated(), and string::stripInvalid().
Referenced by assign(), fileName(), fileName(), fileName(), fileName(), fileName(), operator=(), operator=(), operator=(), operator=(), and operator=().


|
static |
Cleanup filename string, possibly applies other transformations such as changing the path separator etc.
Changes back-slash to forward-slash path separator, while preserving windows UNC:
* \\server\abc\def --> \\server/abc/def *
Removes trailing slash:
* / --> / * /abc/ --> /abc *
Removes repeated slashes, but preserves UNC:
* /abc////def --> /abc/def * \\server\abc////def --> \\server/abc/def *
Removes "/./" (current directory), except for leading one:
* /abc/def/./ghi/. --> /abc/def/ghi * abc/def/./ --> abc/def * ./abc/ --> ./abc *
Removes "/../" (parent directory), except for leading one:
* /abc/def/../ghi/jkl/nmo/.. --> /abc/ghi/jkl * abc/../def/ghi/../jkl --> abc/../def/jkl *
Definition at line 192 of file fileName.C.
Referenced by writeFile::baseFileDir(), IOobject::fileNameComponents(), averageNeighbourFvGeometryScheme::movePoints(), argList::parse(), MapFieldConstraint< Type >::read(), shortestPathSet::shortestPathSet(), and mappedPatchBase::subRegistry().

| bool clean | ( | ) |
Cleanup filename (inplace).
Definition at line 385 of file fileName.C.
References clean().
Referenced by clean(), dictionary::makeScopedDict(), and entry::New().


| Foam::fileName::Type type | ( | bool | followLink = true, |
| bool | checkGzip = false ) const |
Return the directory entry type: UNDEFINED, FILE, DIRECTORY (or SYMLINK).
| followLink | when false it will return SYMLINK for a symlink rather than following it. |
| checkGzip | add an additional test for a gzip FILE |
Definition at line 352 of file fileName.C.
References Foam::type(), and UNDEFINED.
Referenced by Foam::broadcastFile_recursive(), Foam::cp(), and Foam::mv().


|
inlinestatic |
Return true if filename starts with a '/' or '\' or (windows-only) with a filesystem-root.
Definition at line 129 of file fileNameI.H.
Referenced by pointNoise::calculate(), surfaceNoise::calculate(), chemkinReader::chemkinReader(), argList::envRelativePath(), Foam::ln(), loadLibrary(), argList::parse(), surfaceFormatsCore::relativeFilePath(), includeEtcEntry::resolveEtcFile(), includeEntry::resolveFile(), collatedFileOperation::writeObject(), and triSurfaceMesh::writeObject().

|
inline |
Return true if filename is absolute, which means it starts with a '/' or '\' or (windows-only) with a filesystem-root.
Definition at line 151 of file fileNameI.H.
References isAbsolute().
Referenced by isAbsolute().


| Foam::fileName & toAbsolute | ( | ) |
Convert from relative to absolute.
As a side-effect, always performs a clean() to remove "/./" etc
Definition at line 370 of file fileName.C.
References Foam::cwd(), f(), and fileName().
Referenced by Time::NewGlobalTime(), Time::NewGlobalTime(), and boundaryDataSurfaceReader::readPoints().


|
static |
Return true if string ends with "~", ".bak", ".old", ".save".
Definition at line 279 of file fileName.C.
References Foam::dot(), string::find_ext(), and s().
Referenced by isBackup(), and Foam::readDir().


|
inline |
Return true if file name ends with "~", ".bak", ".old", ".save".
Definition at line 157 of file fileNameI.H.
References isBackup().

|
inlinestatic |
Return directory path name (part before last /).
The result normally corresponds to a Foam::fileName
Behaviour compared to /usr/bin/dirname:
* input path() dirname * ----- ------ ------- * "" "." "." * "abc" "." "." * "/" "/" "/" * "/abc" "/" "/" * "abc/def" "abc" "abc" * "/abc/def" "/abc" "/abc" * "/abc/def/" "/abc/def" "/abc" * "/abc/../def" "/abc/.." "/abc/.." *
Definition at line 169 of file fileNameI.H.
Referenced by fileMonitorWatcher::addWatch(), Foam::broadcastFile_single(), dynamicCode::copyOrCreateFiles(), Foam::cp(), dynamicCode::createMakeFiles(), dynamicCode::createMakeOptions(), includeEntry::execute(), includeEntry::execute(), Foam::mkDir(), entry::New(), Time::New(), Time::NewGlobalTime(), Time::NewGlobalTime(), sceneWriter::open(), fileOperation::processorsPath(), scene::write(), nastranWriter::write(), proxyWriter::write(), rawWriter::write(), starcdWriter::write(), x3dWriter::write(), csvWriter::writeBuffered(), gnuplotWriter::writeBuffered(), rawWriter::writeBuffered(), ensightWriter::writeCollated(), ensightWriter::writeCollated(), dynamicCode::writeDigest(), dynamicCode::writeDigest(), isoAdvection::writeIsoFaces(), distributedTriSurfaceMesh::writeObject(), fileOperation::writeObject(), triSurfaceMesh::writeObject(), abaqusWriter::writeTemplate(), abaqusWriter::writeTemplate(), abaqusWriter::writeTemplate(), csvWriter::writeTemplate(), gnuplotWriter::writeTemplate(), nastranWriter::writeTemplate(), nastranWriter::writeTemplate(), nastranWriter::writeTemplate(), rawWriter::writeTemplate(), rawWriter::writeTemplate(), xmgraceWriter::writeTemplate(), xmgraceWriter::writeTemplate(), boundaryDataWriter::writeTemplate(), debugWriter::writeTemplate(), foamWriter::writeTemplate(), starcdWriter::writeTemplate(), x3dWriter::writeTemplate(), ensightWriter::writeUncollated(), and ensightWriter::writeUncollated().
|
inline |
Return directory path name (part before last /).
Definition at line 186 of file fileNameI.H.
References path().
Referenced by path().


|
inline |
True if it contains a '/' character.
Definition at line 163 of file fileNameI.H.
References string::contains().
Referenced by Foam::dlOpen(), and hasPath().


|
inlinestatic |
Return basename (part beyond last /), including its extension.
The result normally corresponds to a Foam::word
Behaviour compared to /usr/bin/basename:
* input name() basename * ----- ------ -------- * "" "" "" * "abc" "abc" "abc" * "/" "" "/" * "/abc" "abc" "abc" * "abc/def" "def" "def" * "/abc/def" "def" "def" * "/abc/def/" "" "def" * "/abc/../def" "def" "def" *
Definition at line 192 of file fileNameI.H.
Referenced by fileMonitorWatcher::addWatch(), seriesWriter::append(), seriesWriter::append(), dynamicCode::copyOrCreateFiles(), Foam::cp(), Foam::mv(), Time::New(), writeFile::newFile(), Time::NewGlobalTime(), Time::NewGlobalTime(), processorPolyPatch::order(), fileOperation::processorsPath(), ensightCase::setTime(), scene::write(), ensightWriter::writeCollated(), ensightWriter::writeCollated(), nastranWriter::writeTemplate(), ensightWriter::writeUncollated(), and ensightWriter::writeUncollated().

|
inline |
Return basename (part beyond last /), including its extension.
Definition at line 205 of file fileNameI.H.
References name().
Referenced by name(), name(), and entry::New().


| Foam::fileName & replace_name | ( | const word & | newName | ) |
Replace basename (part beyond last /) with a new name.
Definition at line 419 of file fileName.C.
References assign(), string::length(), and string::replace().

|
static |
Return the basename, without extension.
The result normally corresponds to a Foam::word
Definition at line 391 of file fileName.C.
References Foam::dot().
Referenced by dlLibraryTable::basename(), surfaceNoise::calculate(), pointNoise::processData(), gnuplotWriter::writeBuffered(), gnuplotWriter::writeTemplate(), nastranWriter::writeTemplate(), and nastranWriter::writeTemplate().


|
inline |
Return basename, without extension.
Definition at line 217 of file fileNameI.H.
References stem().
Referenced by name(), nameLessExt(), nameLessExt(), and stem().


|
inline |
Return file name extension (part after last .).
Definition at line 211 of file fileNameI.H.
References string::ext().
Referenced by coordSetWriter::getExpectedPath(), coordSetWriter::getFieldPrefixedPath(), FIREMeshWriter::write(), nastranWriter::write(), proxyWriter::write(), rawWriter::write(), starcdWriter::write(), vtkWriter::write(), x3dWriter::write(), abaqusWriter::writeTemplate(), nastranWriter::writeTemplate(), rawWriter::writeTemplate(), starcdWriter::writeTemplate(), and x3dWriter::writeTemplate().


|
inline |
Append a '.' and the ending, and return the object.
The '.' and ending will not be added when the ending is empty, or when the file name is empty or ended with a '/'.
Definition at line 223 of file fileNameI.H.
References string::ext().

|
inline |
Remove extension (if any) and append a new one.
Definition at line 230 of file fileNameI.H.
References string::ext(), and string::remove_ext().
Referenced by Foam::dlOpen(), sceneWriter::open(), scene::write(), and scene::write().


|
inline |
Return file name without extension (part before last .).
Definition at line 238 of file fileNameI.H.
References string::find_ext().
Referenced by STARCDedgeFormat::read(), STARCDsurfaceFormat< Face >::read(), STARCDedgeFormat::write(), STARCDsurfaceFormat< Face >::write(), abaqusWriter::writeTemplate(), abaqusWriter::writeTemplate(), and abaqusWriter::writeTemplate().


| Foam::fileName relative | ( | const fileName & | parent, |
| const bool | caseTag = false ) const |
Return a relative name by stripping off the parent directory where possible.
| parent | the parent directory |
| caseTag | replace the parent with <case> for later use with expand(), or prefix <case> if the file name was not an absolute location |
Definition at line 442 of file fileName.C.
References f(), fileName(), and string::length().
Referenced by argList::envRelativePath(), argList::relativePath(), and TimePaths::relativePath().


| Foam::wordList components | ( | const char | delim = '/' | ) | const |
Return path components as wordList.
Behaviour:
* input components()
* ----- ------------
* "" ()
* "." (".")
* "abc" ("abc")
* "/abc" ("abc")
* "abc/def" ("abc", "def")
* "/abc/def" ("abc", "def")
* "/abc/def/" ("abc", "def")
*
Definition at line 532 of file fileName.C.
References Foam::stringOps::split().
Referenced by mappedPatchBase::subRegistry().


| Foam::word component | ( | const size_type | cmpt, |
| const char | delim = '/' ) const |
Return a single component of the path or empty if out of range.
The location npos returns the last component
Definition at line 551 of file fileName.C.
References Foam::stringOps::split().

|
inline |
Copy assignment, no character validation required.
Self-assignment is a no-op.
Definition at line 253 of file fileNameI.H.
References assign(), and fileName().

|
inline |
Move assignment, no character validation required.
Self-assignment is a no-op.
Definition at line 264 of file fileNameI.H.
References assign(), and fileName().

|
inline |
Copy assignment, no character validation required.
Definition at line 275 of file fileNameI.H.
References assign().

|
inline |
Move assignment, no character validation required.
Definition at line 282 of file fileNameI.H.
References assign().

|
inline |
Copy assignment, stripping invalid characters.
Definition at line 289 of file fileNameI.H.
References assign(), and stripInvalid().

|
inline |
Move assignment, stripping invalid characters.
Definition at line 297 of file fileNameI.H.
References assign(), and stripInvalid().

|
inline |
Copy assignment, stripping invalid characters.
Definition at line 305 of file fileNameI.H.
References assign(), and stripInvalid().

|
inline |
Move assignment, stripping invalid characters.
Definition at line 313 of file fileNameI.H.
References assign(), and stripInvalid().

|
inline |
Copy, stripping invalid characters.
Definition at line 321 of file fileNameI.H.
References assign(), and stripInvalid().

| Foam::fileName & operator/= | ( | const string & | other | ) |
Append a path element with '/' separator.
No '/' separator is added if this or the argument are empty.
Definition at line 577 of file fileName.C.
References fileName(), and s().

|
inline |
Same as has_path().
Definition at line 556 of file fileName.H.
References has_path().

|
inline |
Same as remove_path().
Definition at line 561 of file fileName.H.
References remove_path().

|
inline |
Same as has_ext().
Definition at line 566 of file fileName.H.
References has_ext().

|
inline |
Same as has_ext().
Definition at line 571 of file fileName.H.
References has_ext(), and s().

|
inline |
Same as remove_ext().
Definition at line 576 of file fileName.H.
References remove_ext().

|
inlinestatic |
Same as stem().
Definition at line 581 of file fileName.H.
Referenced by abaqusWriter::writeTemplate().


|
inline |
Same as stem().
Definition at line 589 of file fileName.H.
References stem().

|
inline |
Deprecated(2017-03) return basename, optionally without extension.
Definition at line 597 of file fileName.H.
References name(), and stem().

|
inline |
Remove leading path, return true if string changed.
Definition at line 157 of file stringI.H.
Referenced by removePath().

|
inline |
Remove extension, returning true if string changed.
Definition at line 162 of file stringI.H.
Referenced by removeExt(), and FIREMeshWriter::write().

|
inline |
Various checks for extensions.
Definition at line 135 of file stringI.H.
References string::string().
Referenced by Foam::dlOpen(), hasExt(), hasExt(), STLCore::isBinaryName(), and NURBS3DSurface::writeVTK().


|
inline |
Various checks for extensions.
Definition at line 142 of file stringI.H.
References string::string().

|
inline |
| bool has_ext | ( | const wordRe & | ending | ) | const |
Various checks for extensions.
Definition at line 152 of file string.C.
References Foam::pos().

|
static |
The typeName.
Definition at line 96 of file fileName.H.
|
static |
|
static |
Allow space character in fileName. To be used with caution.
Definition at line 106 of file fileName.H.
Referenced by valid().
|
static |
An empty fileName.
Definition at line 111 of file fileName.H.
Referenced by Foam::checkData(), Time::dbDir(), functionObjectList::findDict(), UPstream::File::name(), regionProperties::objectRelPath(), masterUncollatedFileOperation::fileOrNullOp::operator()(), writer::operator=(), argList::parse(), sceneWriter::path(), syncObjects::read(), mappedPatchBase::readDatabase(), chemkinReader::TypeName(), CSV< Type >::TypeName(), mappedPatchBase::write(), meshWriter::write(), nullWriter::write(), proxyWriter::write(), coordSetWriter::writeTemplate(), coordSetWriter::writeTemplate(), abaqusWriter::writeTemplate(), abaqusWriter::writeTemplate(), csvWriter::writeTemplate(), csvWriter::writeTemplate(), ensightWriter::writeTemplate(), ensightWriter::writeTemplate(), gltfWriter::writeTemplate(), gltfWriter::writeTemplate(), gnuplotWriter::writeTemplate(), gnuplotWriter::writeTemplate(), nastranWriter::writeTemplate(), nastranWriter::writeTemplate(), rawWriter::writeTemplate(), rawWriter::writeTemplate(), xmgraceWriter::writeTemplate(), xmgraceWriter::writeTemplate(), surfaceWriter::writeTemplate(), FIREMeshWriter::~FIREMeshWriter(), and STARCDMeshWriter::~STARCDMeshWriter().