48 #ifndef Foam_fileName_H 49 #define Foam_fileName_H 62 template<
class T>
class List;
63 template<
class T>
class UList;
124 inline fileName(
const string&
s,
bool doStrip=
true);
127 inline fileName(
string&&
s,
bool doStrip=
true);
130 inline fileName(
const std::string&
s,
bool doStrip=
true);
133 inline fileName(std::string&&
s,
bool doStrip=
true);
136 inline fileName(
const char*
s,
bool doStrip=
true);
142 explicit fileName(std::initializer_list<word> list);
158 inline static bool valid(
char c);
171 const std::string& s1,
172 const std::string& s2,
173 const char delim =
'/' 178 static bool equals(
const std::string& s1,
const std::string& s2);
219 static bool clean(std::string& str);
234 Type type(
bool followLink=
true,
bool checkGzip=
false)
const;
238 inline static bool isAbsolute(
const std::string& str);
249 static bool isBackup(
const std::string& str);
273 inline static std::string
path(
const std::string& str);
301 inline static std::string
name(
const std::string& str);
311 static std::string
stem(
const std::string& str);
348 const bool caseTag =
false 443 word
name(
const bool noExt)
const 454 Istream&
operator>>(Istream& is, fileName& val);
464 fileName
operator/(
const string& s1,
const string& s2);
470 fileName
search(
const word& file,
const fileName& directory);
static int debug
Debugging.
A class for handling file names.
fileName & operator/=(const string &other)
Append a path element with '/' separator.
bool clean()
Cleanup filename (inplace)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
word nameLessExt() const
Same as stem()
word stem() const
Return basename, without extension.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
A token holds an item read from Istream.
static const fileName null
An empty fileName.
Type type(bool followLink=true, bool checkGzip=false) const
Return the directory entry type: UNDEFINED, FILE, DIRECTORY (or SYMLINK).
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
static const char *const typeName
The typeName.
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...
fileName & replace_ext(const word &ending)
Remove extension (if any) and append a new one.
word ext() const
Return file name extension (part after last .)
word component(const size_type cmpt, const char delim='/') const
Return a single component of the path or empty if out of range.
bool has_path() const
True if it contains a '/' character.
bool assign(const token &tok)
Assign from word or string token.
bool has_ext() const
Return true if it has an extension or simply ends with a '.'.
fileName relative(const fileName &parent, const bool caseTag=false) const
Return a relative name by stripping off the parent directory where possible.
fileName()=default
Default construct.
void stripInvalid()
Strip invalid characters.
bool isAbsolute() const
Return true if filename is absolute, which means it starts with a '/' or '\' or (windows-only) with a...
A class for handling words, derived from Foam::string.
Istream & operator>>(Istream &, directionInfo &)
word name() const
Return basename (part beyond last /), including its extension.
bool removePath()
Same as remove_path()
graph_traits< Graph >::vertices_size_type size_type
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void assign(Field< Tout > &result, const Field< T1 > &a, const UnaryOp &op)
Populate a field as the result of a unary operation on an input.
fileName & toAbsolute()
Convert from relative to absolute.
wordList components(const char delim='/') const
Return path components as wordList.
bool hasPath() const
Same as has_path()
OBJstream os(runTime.globalPath()/outputName)
static bool valid(char c)
Is this character valid for a fileName?
static fileName concat(const std::string &s1, const std::string &s2, const char delim='/')
Join two strings with a path separator ('/' by default).
Hashing functor for string and derived string classes.
fileName & replace_name(const word &newName)
Replace basename (part beyond last /) with a new name.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
List< word > wordList
List of word.
bool removeExt()
Same as remove_ext()
bool remove_path()
Remove leading path, return true if string changed.
Hash function class. The default definition is for primitives. Non-primitives used to hash entries on...
static int allowSpaceInFileName
Allow space character in fileName. To be used with caution.
bool isBackup() const
Return true if file name ends with "~", ".bak", ".old", ".save".
static fileName validate(const std::string &, const bool doClean=true)
Construct fileName without invalid characters, possibly applying other transformations such as changi...
const dimensionedScalar c
Speed of light in a vacuum.
fileName lessExt() const
Return file name without extension (part before last .)
bool hasExt() const
Same as has_ext()
fileName path() const
Return directory path name (part before last /)
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
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))
A class for handling character strings derived from std::string.
Type
Enumerations to handle directory entry types.
fileName & operator=(const fileName &str)
Copy assignment, no character validation required.
bool remove_ext()
Remove extension, return true if string changed.