49#ifndef Foam_fileName_H
50#define Foam_fileName_H
63template<
class T>
class List;
64template<
class T>
class UList;
125 inline fileName(
const string&
s,
bool doStrip=
true);
128 inline fileName(
string&&
s,
bool doStrip=
true);
131 inline fileName(
const std::string&
s,
bool doStrip=
true);
134 inline fileName(std::string&&
s,
bool doStrip=
true);
137 inline fileName(
const char*
s,
bool doStrip=
true);
143 explicit fileName(std::initializer_list<word> list);
152 using string::assign;
159 inline static bool valid(
char c);
172 const std::string& s1,
173 const std::string& s2,
174 const char delim =
'/'
179 static bool equals(
const std::string& s1,
const std::string& s2);
220 static bool clean(std::string& str);
235 Type type(
bool followLink=
true,
bool checkGzip=
false)
const;
239 inline static bool isAbsolute(
const std::string& str);
251 static bool isBackup(
const std::string& str);
275 inline static std::string
path(
const std::string& str);
303 inline static std::string
name(
const std::string& str);
313 static std::string
stem(
const std::string& str);
350 const bool caseTag =
false
445 word
name(
const bool noExt)
const
graph_traits< Graph >::vertices_size_type size_type
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
A class for handling file names.
wordList components(const char delim='/') const
Return path components as wordList.
fileName relative(const fileName &parent, const bool caseTag=false) const
Return a relative name by stripping off the parent directory where possible.
bool isAbsolute() const
Return true if filename is absolute, which means it starts with a '/' or '\' or (windows-only) with a...
static fileName validate(const std::string &, const bool doClean=true)
Construct fileName without invalid characters, possibly applying other transformations such as changi...
bool assign(const token &tok)
Assign from word or string token.
bool clean()
Cleanup filename (inplace).
fileName & replace_ext(const word &ending)
Remove extension (if any) and append a new one.
Type
Enumerations to handle directory entry types.
@ SYMLINK
A symbolic link.
@ UNDEFINED
Undefined type.
Type type(bool followLink=true, bool checkGzip=false) const
Return the directory entry type: UNDEFINED, FILE, DIRECTORY (or SYMLINK).
bool remove_ext()
Remove extension, returning true if string changed.
fileName()=default
Default construct.
fileName & operator/=(const string &other)
Append a path element with '/' separator.
bool has_path() const
True if it contains a '/' character.
word name() const
Return basename (part beyond last /), including its extension.
fileName(fileName &&)=default
Move construct.
static fileName concat(const std::string &s1, const std::string &s2, const char delim='/')
Join two strings with a path separator ('/' by default).
bool removePath()
Same as remove_path().
bool hasPath() const
Same as has_path().
static std::string nameLessExt(const std::string &s)
Same as stem().
fileName & operator=(const fileName &str)
Copy assignment, no character validation required.
fileName lessExt() const
Return file name without extension (part before last .).
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.
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 slash...
word component(const size_type cmpt, const char delim='/') const
Return a single component of the path or empty if out of range.
static const fileName null
An empty fileName.
static bool valid(char c)
Is this character valid for a fileName?
bool has_ext() const
Various checks for extensions.
bool removeExt()
Same as remove_ext().
word ext() const
Return file name extension (part after last .).
bool hasExt(const std::string &s) const
Same as has_ext().
fileName & toAbsolute()
Convert from relative to absolute.
fileName path() const
Return directory path name (part before last /).
static int debug
Debugging.
fileName & replace_name(const word &newName)
Replace basename (part beyond last /) with a new name.
fileName(const fileName &)=default
Copy construct.
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
void stripInvalid()
Strip invalid characters.
bool hasExt() const
Same as has_ext().
bool isBackup() const
Return true if file name ends with "~", ".bak", ".old", ".save".
static int allowSpaceInFileName
Allow space character in fileName. To be used with caution.
word stem() const
Return basename, without extension.
word nameLessExt() const
Same as stem().
static const char *const typeName
The typeName.
bool remove_ext()
Remove extension, return true if string changed.
string()=default
Default construct.
bool remove_path()
Remove leading path, return true if string changed.
bool has_ext() const
Return true if it has an extension or simply ends with a '.'.
A token holds an item read from Istream.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
List< word > wordList
List of word.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Istream & operator>>(Istream &, directionInfo &)
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Hash function class. The default definition is for primitives. Non-primitives used to hash entries on...
Hashing functor for string and derived string classes.