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
 Default construct. 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...
 
bool assign (const token &tok)
 Assign from word or string token. More...
 
void stripInvalid ()
 Strip invalid characters. More...
 
bool clean ()
 Cleanup filename (inplace) More...
 
Type type (bool followLink=true, bool checkGzip=false) const
 
bool isAbsolute () const
 
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...
 
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 or empty if out of range. 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...
 
bool hasExt () const
 Various checks for extensions. More...
 
bool hasExt (const char *ending) const
 Various checks for extensions. More...
 
bool hasExt (const std::string &ending) const
 Various checks for extensions. More...
 
bool hasExt (const wordRe &ending) const
 Various checks for extensions. More...
 
bool removeExt ()
 Remove extension, returning true if string changed. More...
 
- Public Member Functions inherited from string
 string ()=default
 Default construct. 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...
 

Static Public Member Functions

static bool valid (char c)
 Is this character valid for a fileName? More...
 
static fileName validate (const std::string &, 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)
 
static bool isAbsolute (const std::string &str)
 
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 StringType >
static bool valid (const std::string &str)
 Does the string contain valid characters only? More...
 
template<class StringType >
static bool stripInvalid (std::string &str)
 Strip invalid characters from the given string. More...
 
template<class StringType >
static StringType validate (const std::string &str)
 Return a valid String 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 char *ending) const
 Return true if the extension is the same as the given ending. More...
 
bool hasExt (const std::string &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 73 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 80 of file fileName.H.

Constructor & Destructor Documentation

◆ fileName() [1/13]

fileName ( )
default

Default construct.

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

◆ fileName() [12/13]

fileName ( std::initializer_list< word list)
explicit

Construct by concatenating words separated by '/'.

Definition at line 337 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

◆ assign()

bool assign ( const token tok)

Assign from word or string token.

Returns
false if the token was the incorrect type

Definition at line 42 of file fileNameIO.C.

References Foam::FieldOps::assign(), token::isQuotedString(), token::isWord(), token::stringToken(), and token::wordToken().

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

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

◆ 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 &  str,
const bool  doClean = true 
)
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 206 of file fileName.C.

Referenced by Foam::argList::get< Foam::fileName >().

Here is the caller graph for this function:

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

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

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 245 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().

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

◆ clean() [1/2]

bool clean ( std::string &  str)
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
Returns
True if the content changed

Definition at line 199 of file fileName.C.

Referenced by 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/2]

bool clean ( )

Cleanup filename (inplace)

Returns
True if the content changed

Definition at line 390 of file fileName.C.

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

Here is the caller 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 360 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 filename starts with a '/' or '\' or (windows-only) with a filesystem-root

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 filename is absolute, which means it starts with a '/' or '\' or (windows-only) with a filesystem-root

Definition at line 158 of file fileNameI.H.

◆ toAbsolute()

Foam::fileName & toAbsolute ( )

Convert from relative to absolute.

Definition at line 377 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 286 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 164 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 199 of file fileNameI.H.

Referenced by fileMonitorWatcher::addWatch(), seriesWriter::append(), argList::argList(), dynamicCode::copyOrCreateFiles(), Foam::cp(), Foam::mv(), Time::New(), processorPolyPatch::order(), probes::prepare(), 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 212 of file fileNameI.H.

Referenced by entry::New(), and scene::write().

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

References Foam::dot().

Referenced by dlLibraryTable::basename(), surfaceNoise::calculate(), seriesWriter::print(), and seriesWriter::scan().

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 224 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 286 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 176 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(), starcdWriter::write(), foamWriter::write(), rawWriter::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(), starcdWriter::writeTemplate(), boundaryDataWriter::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 193 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 170 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 243 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 425 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 230 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 218 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(), starcdWriter::write(), rawWriter::write(), vtkWriter::write(), abaqusWriter::write(), nastranWriter::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 249 of file fileNameI.H.

References string::ext().

Here is the call 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 461 of file fileName.C.

Referenced by dictionary::cfindScopedDict(), and mappedPatchBase::subRegistry().

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 or empty if out of range.

The location npos returns the last component

Definition at line 481 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 258 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 269 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 280 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 287 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 294 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 302 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 310 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 318 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 326 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 506 of file fileName.C.

References s.

◆ hasExt() [1/4]

bool hasExt
inline

Various checks for extensions.

Definition at line 56 of file stringI.H.

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

Here is the caller graph for this function:

◆ hasExt() [2/4]

bool hasExt
inline

Various checks for extensions.

Definition at line 62 of file stringI.H.

◆ hasExt() [3/4]

bool hasExt
inline

Various checks for extensions.

Definition at line 68 of file stringI.H.

◆ hasExt() [4/4]

bool hasExt

Various checks for extensions.

Definition at line 81 of file string.C.

◆ removeExt()

bool removeExt
inline

Remove extension, returning true if string changed.

Definition at line 96 of file stringI.H.

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

Here is the caller graph for this function:

Member Data Documentation

◆ typeName

const char *const typeName = "fileName"
static

The typeName.

Definition at line 92 of file fileName.H.

◆ debug

int debug
static

Debugging.

Definition at line 95 of file fileName.H.

◆ allowSpaceInFileName

int allowSpaceInFileName
static

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

Definition at line 98 of file fileName.H.

◆ null


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