119 <<
"fileName::stripInvalid() called for invalid fileName "
120 << this->c_str() << std::endl;
125 <<
" For debug level (= " <<
debug
126 <<
") > 1 this is considered fatal" << std::endl;
138 return !str.empty() &&
145 (str[0] ==
'/' || str[0] ==
'\\')
150 (str.length() > 2 && str[1] ==
':')
151 && (str[2] ==
'/' || str[2] ==
'\\')
178 const auto i = str.rfind(
'/');
180 if (i == std::string::npos)
186 return str.substr(0, i);
201 const auto i = str.rfind(
'/');
203 if (i == std::string::npos)
208 return str.substr(i+1);
247 const auto i = find_ext();
249 if (i == std::string::npos)
A class for handling file names.
bool isAbsolute() const
Return true if filename is absolute, which means it starts with a '/' or '\' or (windows-only) with a...
bool assign(const token &tok)
Assign from word or string token.
fileName & replace_ext(const word &ending)
Remove extension (if any) and append a new one.
fileName()=default
Default construct.
bool has_path() const
True if it contains a '/' character.
word name() const
Return basename (part beyond last /), including its extension.
fileName & operator=(const fileName &str)
Copy assignment, no character validation required.
static bool isBackup(const std::string &str)
Return true if string ends with "~", ".bak", ".old", ".save".
fileName lessExt() const
Return file name without extension (part before last .).
static bool valid(char c)
Is this character valid for a fileName?
word ext() const
Return file name extension (part after last .).
fileName path() const
Return directory path name (part before last /).
static int debug
Debugging.
void stripInvalid()
Strip invalid characters.
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.
A class for handling character strings derived from std::string.
bool remove_ext()
Remove extension, return true if string changed.
string()=default
Default construct.
static bool stripInvalid(std::string &str)
Strip invalid characters from the given string.
bool contains(char c) const noexcept
True if string contains given character (cf. C++23).
bool removeRepeated(const char character)
Remove repeated characters.
word ext() const
Return file name extension (part after last .).
static std::string::size_type find_ext(const std::string &str)
Find position of a file extension dot, return npos on failure.
bool removeEnd(const std::string &text)
Remove the given text from the end of the string.
A class for handling words, derived from Foam::string.
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))
Namespace for handling debugging switches.
constexpr bool isspace(char c) noexcept
Test for whitespace (C-locale only).