mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-07 05:31:25 -07:00
parent
669b67e666
commit
7377974731
5 changed files with 16 additions and 15 deletions
|
@ -151,7 +151,7 @@ QString Path::extension() const
|
|||
return ((dotIndex == -1) ? QString() : filename.mid(dotIndex).toString());
|
||||
}
|
||||
|
||||
bool Path::hasExtension(const QString &ext) const
|
||||
bool Path::hasExtension(const QStringView ext) const
|
||||
{
|
||||
Q_ASSERT(ext.startsWith(u'.') && (ext.size() >= 2));
|
||||
|
||||
|
@ -186,12 +186,17 @@ Path Path::removedExtension() const
|
|||
return createUnchecked(m_pathStr.chopped(extension().size()));
|
||||
}
|
||||
|
||||
void Path::removeExtension(const QString &ext)
|
||||
void Path::removeExtension(const QStringView ext)
|
||||
{
|
||||
if (hasExtension(ext))
|
||||
m_pathStr.chop(ext.size());
|
||||
}
|
||||
|
||||
Path Path::removedExtension(const QStringView ext) const
|
||||
{
|
||||
return (hasExtension(ext) ? createUnchecked(m_pathStr.chopped(ext.size())) : *this);
|
||||
}
|
||||
|
||||
QString Path::data() const
|
||||
{
|
||||
return m_pathStr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue