mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add fileName::isBackup() method
- previously part of POSIX.C
This commit is contained in:
@ -26,18 +26,22 @@ License
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
inline std::string::size_type Foam::string::find_ext() const
|
||||
inline std::string::size_type Foam::string::find_ext(const std::string& str)
|
||||
{
|
||||
const size_type i = find_last_of("./");
|
||||
const auto i = str.find_last_of("./");
|
||||
|
||||
if (i == npos || i == 0 || operator[](i) == '/')
|
||||
if (i == npos || i == 0 || str[i] == '/')
|
||||
{
|
||||
return npos;
|
||||
}
|
||||
else
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
inline std::string::size_type Foam::string::find_ext() const
|
||||
{
|
||||
return find_ext(*this);
|
||||
}
|
||||
|
||||
|
||||
@ -49,17 +53,15 @@ inline bool Foam::string::hasExt() const
|
||||
|
||||
inline bool Foam::string::removeExt()
|
||||
{
|
||||
const size_type i = find_ext();
|
||||
const auto i = find_ext();
|
||||
|
||||
if (i == npos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->resize(i);
|
||||
return true;
|
||||
}
|
||||
|
||||
this->resize(i);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user