fileName Class Reference

A class for handling file names. More...

Inheritance diagram for fileName:
[legend]
Collaboration diagram for fileName:
[legend]

Public Types

enum  Type { UNDEFINED = 0, FILE = 1, DIRECTORY = 2, LINK = 4 }
 Enumerations to handle directory entry types. More...
 

Public Member Functions

 fileName ()=default
 Construct null. More...
 
 fileName (const fileName &)=default
 Copy construct. More...
 
 fileName (fileName &&)=default
 Move construct. More...
 
 fileName (const word &s)
 Copy construct from word. More...
 
 fileName (word &&s)
 Move construct from word. More...
 
 fileName (const string &s, bool doStrip=true)
 Copy construct from string. More...
 
 fileName (string &&s, bool doStrip=true)
 Move construct from string. More...
 
 fileName (const std::string &s, bool doStrip=true)
 Copy construct from std::string. More...
 
 fileName (std::string &&s, bool doStrip=true)
 Move construct from std::string. More...
 
 fileName (const char *s, bool doStrip=true)
 Copy construct from character array. More...
 
 fileName (const UList< word > &list)
 Construct by concatenating elements of wordList separated by '/'. More...
 
 fileName (std::initializer_list< word > list)
 Construct by concatenating words separated by '/'. More...
 
 fileName (Istream &is)
 Construct from Istream. More...
 
void stripInvalid ()
 Strip invalid characters. More...
 
bool clean ()
 Cleanup filename inplace. More...
 
fileName clean () const
 Cleanup filename. More...
 
Type type (bool followLink=true, bool checkGzip=false) const
 
bool isAbsolute () const
 Return true if file name is absolute (starts with a '/') More...
 
fileNametoAbsolute ()
 Convert from relative to absolute. More...
 
bool isBackup () const
 Return true if file name ends with "~", ".bak", ".old", ".save". More...
 
word name () const
 Return basename (part beyond last /), including its extension. More...
 
word nameLessExt () const
 Return basename, without extension. More...
 
word name (const bool noExt) const
 Deprecated(2017-03) return basename, optionally without extension. More...
 
fileName path () const
 Return directory path name (part before last /) More...
 
bool hasPath () const
 Return true if it contains a '/' character. More...
 
bool removePath ()
 Remove leading path, returning true if string changed. More...
 
fileName relative (const fileName &parent, const bool caseTag=false) const
 
fileName lessExt () const
 Return file name without extension (part before last .) More...
 
word ext () const
 Return file name extension (part after last .) More...
 
fileNameext (const word &ending)
 Append a '.' and the ending, and return the object. More...
 
bool hasExt () const
 Return true if it has an extension or simply ends with a '.'. More...
 
bool hasExt (const word &ending) const
 Return true if the extension is the same as the given ending. More...
 
bool hasExt (const wordRe &ending) const
 Return true if the extension matches the given ending. More...
 
bool removeExt ()
 Remove extension, returning true if string changed. More...
 
wordList components (const char delim='/') const
 Return path components as wordList. More...
 
word component (const size_type cmpt, const char delim='/') const
 Return a single component of the path. More...
 
fileNameoperator= (const fileName &str)
 Copy assignment, no character validation required. More...
 
fileNameoperator= (fileName &&str)
 Move assignment, no character validation required. More...
 
fileNameoperator= (const word &str)
 Copy assignment, no character validation required. More...
 
fileNameoperator= (word &&str)
 Move assignment, no character validation required. More...
 
fileNameoperator= (const string &str)
 Copy assignment, stripping invalid characters. More...
 
fileNameoperator= (string &&str)
 Move assignment, stripping invalid characters. More...
 
fileNameoperator= (const std::string &str)
 Copy assignment, stripping invalid characters. More...
 
fileNameoperator= (std::string &&str)
 Move assignment, stripping invalid characters. More...
 
fileNameoperator= (const char *str)
 Copy, stripping invalid characters. More...
 
fileNameoperator/= (const string &other)
 Append a path element with '/' separator. More...
 
- Public Member Functions inherited from string
 string ()=default
 Construct null. More...
 
 string (const std::string &str)
 Copy construct from std::string. More...
 
 string (std::string &&str)
 Move construct from std::string. More...
 
 string (const char *str)
 Construct as copy of character array. More...
 
 string (const char *str, const size_type len)
 Construct as copy with a maximum number of characters. More...
 
 string (const char c)
 Construct from a single character. More...
 
 string (const size_type len, const char c)
 Construct fill copies of a single character. More...
 
 string (Istream &is)
 Construct from Istream. More...
 
bool match (const std::string &text) const
 Test for equality. More...
 
stringreplace (const std::string &s1, const std::string &s2, size_type pos=0)
 
stringreplaceAll (const std::string &s1, const std::string &s2, size_type pos=0)
 
stringreplaceAny (const std::string &s1, const char c2, size_type pos=0)
 
stringexpand (const bool allowEmpty=false)
 
bool removeRepeated (const char character)
 Remove repeated characters. More...
 
bool removeStart (const std::string &text)
 Remove the given text from the start of the string. More...
 
bool removeStart (const char c)
 Remove leading character, unless string is a single character. More...
 
bool removeEnd (const std::string &text)
 Remove the given text from the end of the string. More...
 
bool removeEnd (const char c)
 Remove trailing character, unless string is a single character. More...
 
void swap (std::string &str)
 Swap contents. Self-swapping is a no-op. More...
 
bool operator() (const std::string &text) const
 Test for equality. Allows use as a predicate. More...
 
bool starts_with (const std::string &s) const
 True if string starts with the given prefix (cf. C++20) More...
 
bool starts_with (const char c) const
 True if string starts with the given character (cf. C++20) More...
 
bool ends_with (const std::string &s) const
 True if string ends with the given suffix (cf. C++20) More...
 
bool ends_with (const char c) const
 True if string ends with the given character (cf. C++20) More...
 
size_type count (const char c) const
 
bool startsWith (const std::string &s) const
 Deprecated(2019-11) More...
 
bool endsWith (const std::string &s) const
 Deprecated(2019-11) More...
 
bool removeTrailing (const char c)
 Deprecated(2019-11) More...
 
template<class String >
Foam::string quotemeta (const std::string &str, const char quote)
 

Static Public Member Functions

static bool valid (char c)
 Is this character valid for a fileName? More...
 
static fileName validate (const std::string &s, const bool doClean=true)
 
static fileName concat (const std::string &s1, const std::string &s2, const char delim='/')
 Join two strings with a path separator ('/' by default). More...
 
static bool equals (const std::string &s1, const std::string &s2)
 
static bool clean (std::string &str)
 Cleanup filename. More...
 
static bool isAbsolute (const std::string &str)
 Return true if string starts with a '/'. More...
 
static bool isBackup (const std::string &str)
 Return true if string ends with "~", ".bak", ".old", ".save". More...
 
static std::string name (const std::string &str)
 Return basename (part beyond last /), including its extension. More...
 
static std::string nameLessExt (const std::string &str)
 Return basename, without extension. More...
 
static std::string path (const std::string &str)
 Return directory path name (part before last /) More...
 
- Static Public Member Functions inherited from string
template<class String >
static bool valid (const std::string &str)
 Does the string contain valid characters only? More...
 
template<class String >
static bool meta (const std::string &str, const char quote='\\')
 Does this string contain meta-characters? More...
 
template<class String >
static bool stripInvalid (std::string &str)
 Strip invalid characters from the given string. More...
 
template<class String >
static String validate (const std::string &str)
 Return a valid String from the given string. More...
 
template<class String >
static string quotemeta (const std::string &str, const char quote='\\')
 Return a String with quoted meta-characters from the given string. More...
 

Static Public Attributes

static const char *const typeName = "fileName"
 The typeName. More...
 
static int debug
 Debugging. More...
 
static int allowSpaceInFileName
 Allow space character in fileName. To be used with caution. More...
 
static const fileName null
 An empty fileName. More...
 
- Static Public Attributes inherited from string
static const char *const typeName = "string"
 The type name "string". More...
 
static int debug
 The debug flag. More...
 
static const string null
 An empty string. More...
 

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. More...
 
word ext () const
 Return file name extension (part after last .) More...
 
bool ext (const word &ending)
 Append a '.' and the ending. More...
 
bool hasPath () const
 Return true if it contains a '/' character. More...
 
bool hasExt () const
 Return true if it has an extension or simply ends with a '.'. More...
 
bool hasExt (const word &ending) const
 Return true if the extension is the same as the given ending. More...
 
bool hasExt (const wordRe &ending) const
 Return true if the extension matches the given ending. More...
 
bool removeExt ()
 Remove extension, returning true if string changed. More...
 
bool removePath ()
 Remove leading path, returning true if string changed. More...
 
- 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. More...
 
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. More...
 
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. More...
 

Detailed Description

A class for handling file names.

A fileName is a string of characters without whitespace or quotes. A fileName can be

  • constructed from a char*, a string or a word
  • concatenated by adding a '/' separator
  • decomposed into the path, name or component list
  • interrogated for type and access mode

The string::expand() method expands environment variables, etc,

Source files

Definition at line 69 of file fileName.H.

Member Enumeration Documentation

◆ Type

enum Type

Enumerations to handle directory entry types.

Enumerator
UNDEFINED 

Undefined type.

FILE 

A file.

DIRECTORY 

A directory.

LINK 

A symlink.

Definition at line 76 of file fileName.H.

Constructor & Destructor Documentation

◆ fileName() [1/13]

fileName ( )
default

Construct null.

◆ fileName() [2/13]

fileName ( const fileName )
default

Copy construct.

◆ fileName() [3/13]

fileName ( fileName &&  )
default

Move construct.

◆ fileName() [4/13]

fileName ( const word s)
inline

Copy construct from word.

Definition at line 33 of file fileNameI.H.

◆ fileName() [5/13]

fileName ( word &&  s)
inline

Move construct from word.

Definition at line 39 of file fileNameI.H.

◆ fileName() [6/13]

fileName ( const string s,
bool  doStrip = true 
)
inline

Copy construct from string.

Definition at line 45 of file fileNameI.H.

References fileName::stripInvalid().

Here is the call graph for this function:

◆ fileName() [7/13]

fileName ( string &&  s,
bool  doStrip = true 
)
inline

Move construct from string.

Definition at line 56 of file fileNameI.H.

References fileName::stripInvalid().

Here is the call graph for this function:

◆ fileName() [8/13]

fileName ( const std::string &  s,
bool  doStrip = true 
)
inline

Copy construct from std::string.

Definition at line 67 of file fileNameI.H.

References fileName::stripInvalid().

Here is the call graph for this function:

◆ fileName() [9/13]

fileName ( std::string &&  s,
bool  doStrip = true 
)
inline

Move construct from std::string.

Definition at line 78 of file fileNameI.H.

References fileName::stripInvalid().

Here is the call graph for this function:

◆ fileName() [10/13]

fileName ( const char *  s,
bool  doStrip = true 
)
inline

Copy construct from character array.

Definition at line 89 of file fileNameI.H.

References fileName::stripInvalid().

Here is the call graph for this function:

◆ fileName() [11/13]

fileName ( const UList< word > &  list)
explicit

Construct by concatenating elements of wordList separated by '/'.

Definition at line 225 of file fileName.C.

◆ fileName() [12/13]

fileName ( std::initializer_list< word list)
explicit

Construct by concatenating words separated by '/'.

Definition at line 245 of file fileName.C.

◆ fileName() [13/13]

fileName ( Istream is)
explicit

Construct from Istream.

Definition at line 34 of file fileNameIO.C.

Member Function Documentation

◆ valid()

bool valid ( char  c)
inlinestatic

Is this character valid for a fileName?

Definition at line 102 of file fileNameI.H.

References Foam::constant::universal::c, and Foam::isspace().

Referenced by FileName::valid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ validate()

Foam::fileName validate ( const std::string &  s,
const bool  doClean = true 
)
static

Construct fileName with no invalid characters, possibly applying other transformations such as changing the path separator, removing duplicate or trailing slashes, etc.

Definition at line 58 of file fileName.C.

References Foam::constant::universal::c, and s.

◆ concat()

Foam::fileName concat ( const std::string &  s1,
const std::string &  s2,
const char  delim = '/' 
)
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 126 of file fileName.C.

Referenced by dictionary::add(), and dictionary::dictionary().

Here is the caller graph for this function:

◆ equals()

bool equals ( const std::string &  s1,
const std::string &  s2 
)
static

This is a specialized (possibly slower) version of compare() that ignores duplicate or trailing slashes.

Definition at line 153 of file fileName.C.

◆ stripInvalid()

void stripInvalid ( )
inline

Strip invalid characters.

Definition at line 113 of file fileNameI.H.

References Foam::expressions::patchExpr::debug, Foam::endl(), and Foam::exit().

Referenced by fileName::fileName(), and Foam::operator>>().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clean() [1/3]

bool clean ( std::string &  str)
static

Cleanup filename.

Removes trailing /

    /                 -->   /
    /abc/             -->   /abc

Removes repeated slashes

    /abc////def        -->   /abc/def

Removes /./ (current directory)

    /abc/def/./ghi/.   -->   /abc/def/ghi
    abc/def/./         -->   abc/def
    ./abc/             -->   ./abc

Removes /../ (parent directory)

    /abc/def/../ghi/jkl/nmo/..   -->   /abc/ghi/jkl
    abc/../def/ghi/../jkl        -->   abc/../def/jkl
Returns
True if the content changed

Definition at line 298 of file fileName.C.

References Foam::constant::universal::c, and Foam::constant::physicoChemical::c1.

Referenced by writeFile::baseFileDir(), dictionary::cfindScopedDict(), externalFileCoupler::externalFileCoupler(), IOobject::fileNameComponents(), meshRefinement::findRegions(), averageNeighbourFvGeometryScheme::movePoints(), argList::parse(), probes::prepare(), abort::read(), shortestPathSet::shortestPathSet(), and mappedPatchBase::subRegistry().

Here is the caller graph for this function:

◆ clean() [2/3]

bool clean ( )

Cleanup filename inplace.

Returns
True if any contents changed

Definition at line 388 of file fileName.C.

Referenced by fileName::clean(), dictionary::makeScopedDict(), and entry::New().

Here is the caller graph for this function:

◆ clean() [3/3]

Foam::fileName clean ( ) const

Cleanup filename.

Returns
cleaned copy of fileName

Definition at line 394 of file fileName.C.

References fileName::clean().

Here is the call graph for this function:

◆ type()

Foam::fileName::Type type ( bool  followLink = true,
bool  checkGzip = false 
) const

Return the directory entry type: UNDEFINED, FILE, DIRECTORY (or LINK).

Parameters
followLinkwhen false it will return LINK for a symlink rather than following it.
checkGzipadd an additional test for a gzip FILE

Definition at line 268 of file fileName.C.

Referenced by Foam::cp(), Foam::mv(), and fvMeshDistribute::printFieldInfo().

Here is the caller graph for this function:

◆ isAbsolute() [1/2]

bool isAbsolute ( const std::string &  str)
inlinestatic

Return true if string starts with a '/'.

Definition at line 136 of file fileNameI.H.

Referenced by pointNoise::calculate(), surfaceNoise::calculate(), chemkinReader::chemkinReader(), uncollatedFileOperation::filePathInfo(), masterUncollatedFileOperation::filePathInfo(), argList::parse(), abort::read(), surfaceFormatsCore::relativeFilePath(), includeEtcEntry::resolveEtcFile(), includeEntry::resolveFile(), collatedFileOperation::writeObject(), and triSurfaceMesh::writeObject().

Here is the caller graph for this function:

◆ isAbsolute() [2/2]

bool isAbsolute ( ) const
inline

Return true if file name is absolute (starts with a '/')

Definition at line 156 of file fileNameI.H.

Referenced by dictionary::cfindScopedDict(), and dictionary::makeScopedDict().

Here is the caller graph for this function:

◆ toAbsolute()

Foam::fileName & toAbsolute ( )

Convert from relative to absolute.

Definition at line 285 of file fileName.C.

References Foam::cwd(), and f().

Here is the call graph for this function:

◆ isBackup() [1/2]

bool isBackup ( const std::string &  str)
static

Return true if string ends with "~", ".bak", ".old", ".save".

Definition at line 194 of file fileName.C.

References Foam::dot(), and s.

Here is the call graph for this function:

◆ isBackup() [2/2]

bool isBackup ( ) const
inline

Return true if file name ends with "~", ".bak", ".old", ".save".

Definition at line 162 of file fileNameI.H.

◆ name() [1/3]

std::string name ( const std::string &  str)
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 209 of file fileNameI.H.

Referenced by fileMonitorWatcher::addWatch(), seriesWriter::append(), collatedFileOperation::appendObject(), argList::argList(), dynamicCode::copyOrCreateFiles(), Foam::cp(), dictionary::dictName(), Foam::mv(), Time::New(), processorPolyPatch::order(), probes::prepare(), seriesWriter::print(), fileOperation::processorsPath(), ensightCase::setTime(), triSurface::triSurfInstance(), timeVaryingMappedFixedValuePointPatchField< Type >::updateCoeffs(), MappedFile< scalar >::value(), ensightSetWriter< Type >::write(), abaqusWriter::write(), ensightWriter::writeCollated(), nastranWriter::writeTemplate(), streamLineBase::writeToFile(), and ensightWriter::writeUncollated().

Here is the caller graph for this function:

◆ name() [2/3]

Foam::word name ( ) const
inline

Return basename (part beyond last /), including its extension.

Definition at line 222 of file fileNameI.H.

Referenced by entry::New().

Here is the caller graph for this function:

◆ nameLessExt() [1/2]

std::string nameLessExt ( const std::string &  str)
static

Return basename, without extension.

The result normally corresponds to a Foam::word

Definition at line 402 of file fileName.C.

References Foam::dot().

Referenced by dlLibraryTable::basename(), surfaceNoise::calculate(), seriesWriter::print(), seriesWriter::scan(), OBJsurfaceFormat< Face >::write(), OBJedgeFormat::write(), NASsurfaceFormat< Face >::write(), STARCDsurfaceFormatCore::writeCase(), and STARCDedgeFormat::writeCase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nameLessExt() [2/2]

Foam::word nameLessExt ( ) const
inline

Return basename, without extension.

Definition at line 234 of file fileNameI.H.

Referenced by vtmWriter::append().

Here is the caller graph for this function:

◆ name() [3/3]

word name ( const bool  noExt) const
inline

Deprecated(2017-03) return basename, optionally without extension.

Deprecated:
(2017-03) - use name() or nameLessExt() methods which describe their behaviour explicitly

Definition at line 268 of file fileName.H.

◆ path() [1/2]

std::string path ( const std::string &  str)
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 186 of file fileNameI.H.

Referenced by fileMonitorWatcher::addWatch(), timeVaryingMappedFixedValuePointPatchField< Type >::checkTable(), chemkinReader::chemkinReader(), dynamicCode::copyOrCreateFiles(), Foam::cp(), dynamicCode::createMakeFiles(), dynamicCode::createMakeOptions(), includeEntry::execute(), isoSurfacePoint::isoSurfacePoint(), seriesWriter::load(), Foam::mkDir(), Time::New(), pointHistory::pointHistory(), fileOperation::processorsPath(), surfMesh::removeFiles(), polyMesh::removeFiles(), seriesWriter::scan(), seriesWriter::write(), proxyWriter::write(), x3dWriter::write(), rawWriter::write(), starcdWriter::write(), foamWriter::write(), vtkWriter::write(), abaqusWriter::write(), nastranWriter::write(), vtmWriter::write(), ensightWriter::writeCollated(), dynamicCode::writeDigest(), isoAdvection::writeIsoFaces(), triSurfaceMesh::writeObject(), distributedTriSurfaceMesh::writeObject(), Foam::vtk::writePointSet(), abaqusWriter::writeTemplate(), rawWriter::writeTemplate(), nastranWriter::writeTemplate(), foamWriter::writeTemplate(), boundaryDataWriter::writeTemplate(), starcdWriter::writeTemplate(), x3dWriter::writeTemplate(), streamLineBase::writeToFile(), and ensightWriter::writeUncollated().

Here is the caller graph for this function:

◆ path() [2/2]

Foam::fileName path ( ) const
inline

Return directory path name (part before last /)

Definition at line 203 of file fileNameI.H.

References path().

Referenced by entry::New().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasPath()

bool hasPath ( ) const
inline

Return true if it contains a '/' character.

Definition at line 168 of file fileNameI.H.

References string::hasPath().

Here is the call graph for this function:

◆ removePath()

bool removePath ( )
inline

Remove leading path, returning true if string changed.

Definition at line 253 of file fileNameI.H.

References string::removePath().

Referenced by seriesWriter::append().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ relative()

Foam::fileName relative ( const fileName parent,
const bool  caseTag = false 
) const

Return a relative name by stripping off the parent directory where possible.

Parameters
parentthe parent directory
caseTagreplace the parent with <case> for later use with expand(), or prefix <case> if the file name was not an absolute location

Definition at line 431 of file fileName.C.

References f().

Here is the call graph for this function:

◆ lessExt()

Foam::fileName lessExt ( ) const
inline

Return file name without extension (part before last .)

Definition at line 240 of file fileNameI.H.

Referenced by Foam::dlOpen(), STARCDsurfaceFormat< Face >::read(), STARCDedgeFormat::read(), ensightSetWriter< Type >::write(), STARCDsurfaceFormat< Face >::write(), FIREMeshWriter::write(), STARCDedgeFormat::write(), Foam::vtk::writePointSet(), and abaqusWriter::writeTemplate().

Here is the caller graph for this function:

◆ ext() [1/2]

Foam::word ext ( ) const
inline

Return file name extension (part after last .)

Definition at line 228 of file fileNameI.H.

References string::ext().

Referenced by Foam::dlOpen(), seriesWriter::load(), seriesWriter::print(), edgeMesh::read(), extendedEdgeMesh::read(), seriesWriter::scan(), FIREMeshWriter::write(), proxyWriter::write(), x3dWriter::write(), rawWriter::write(), starcdWriter::write(), vtkWriter::write(), abaqusWriter::write(), nastranWriter::write(), vtkWrite::write(), abaqusWriter::writeTemplate(), rawWriter::writeTemplate(), nastranWriter::writeTemplate(), starcdWriter::writeTemplate(), x3dWriter::writeTemplate(), and NURBS3DSurface::writeVTK().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ext() [2/2]

Foam::fileName & ext ( const word ending)
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 265 of file fileNameI.H.

References string::ext().

Here is the call graph for this function:

◆ hasExt() [1/3]

bool hasExt ( ) const
inline

Return true if it has an extension or simply ends with a '.'.

Definition at line 174 of file fileNameI.H.

References string::hasExt().

Referenced by vtmWriter::append(), STLCore::isBinaryName(), seriesWriter::load(), Foam::printSourceFileAndLine(), seriesWriter::scan(), seriesWriter::write(), vtmWriter::write(), and Foam::vtk::writePointSet().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasExt() [2/3]

bool hasExt ( const word ending) const
inline

Return true if the extension is the same as the given ending.

Definition at line 180 of file fileNameI.H.

References string::hasExt().

Here is the call graph for this function:

◆ hasExt() [3/3]

bool hasExt ( const wordRe ending) const

Return true if the extension matches the given ending.

Definition at line 467 of file fileName.C.

References string::hasExt().

Here is the call graph for this function:

◆ removeExt()

bool removeExt ( )
inline

Remove extension, returning true if string changed.

Definition at line 259 of file fileNameI.H.

References string::removeExt().

Referenced by fileWriter::open(), and seriesWriter::scan().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ components()

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 473 of file fileName.C.

Referenced by dictionary::cfindScopedDict(), and Foam::cp().

Here is the caller graph for this function:

◆ component()

Foam::word component ( const size_type  cmpt,
const char  delim = '/' 
) const

Return a single component of the path.

Definition at line 493 of file fileName.C.

◆ operator=() [1/9]

Foam::fileName & operator= ( const fileName str)
inline

Copy assignment, no character validation required.

Self-assignment is a no-op.

Definition at line 274 of file fileNameI.H.

References Foam::FieldOps::assign().

Here is the call graph for this function:

◆ operator=() [2/9]

Foam::fileName & operator= ( fileName &&  str)
inline

Move assignment, no character validation required.

Self-assignment is a no-op.

Definition at line 285 of file fileNameI.H.

References Foam::FieldOps::assign().

Here is the call graph for this function:

◆ operator=() [3/9]

Foam::fileName & operator= ( const word str)
inline

Copy assignment, no character validation required.

Definition at line 296 of file fileNameI.H.

References Foam::FieldOps::assign().

Here is the call graph for this function:

◆ operator=() [4/9]

Foam::fileName & operator= ( word &&  str)
inline

Move assignment, no character validation required.

Definition at line 303 of file fileNameI.H.

References Foam::FieldOps::assign().

Here is the call graph for this function:

◆ operator=() [5/9]

Foam::fileName & operator= ( const string str)
inline

Copy assignment, stripping invalid characters.

Definition at line 310 of file fileNameI.H.

References Foam::FieldOps::assign().

Here is the call graph for this function:

◆ operator=() [6/9]

Foam::fileName & operator= ( string &&  str)
inline

Move assignment, stripping invalid characters.

Definition at line 318 of file fileNameI.H.

References Foam::FieldOps::assign().

Here is the call graph for this function:

◆ operator=() [7/9]

Foam::fileName & operator= ( const std::string &  str)
inline

Copy assignment, stripping invalid characters.

Definition at line 326 of file fileNameI.H.

References Foam::FieldOps::assign().

Here is the call graph for this function:

◆ operator=() [8/9]

Foam::fileName & operator= ( std::string &&  str)
inline

Move assignment, stripping invalid characters.

Definition at line 334 of file fileNameI.H.

References Foam::FieldOps::assign().

Here is the call graph for this function:

◆ operator=() [9/9]

Foam::fileName & operator= ( const char *  str)
inline

Copy, stripping invalid characters.

Definition at line 342 of file fileNameI.H.

References Foam::FieldOps::assign().

Here is the call graph for this function:

◆ operator/=()

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 511 of file fileName.C.

References s.

Member Data Documentation

◆ typeName

const char *const typeName = "fileName"
static

The typeName.

Definition at line 88 of file fileName.H.

◆ debug

int debug
static

Debugging.

Definition at line 91 of file fileName.H.

◆ allowSpaceInFileName

int allowSpaceInFileName
static

Allow space character in fileName. To be used with caution.

Definition at line 94 of file fileName.H.

◆ null


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