Port QDir's implementation to use Q_D() and d_func()
It had the d_func()s it needed, but wasn't using them. This prepares the way for QEDSP-ification. Task-number: QTBUG-105753 Change-Id: I8b7ba79818f27ae6a2281b276b95b94673f05648 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 62a4fe434d4d9cb27a6285778fdab7e2ce43b61b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
8a4f8de3c9
commit
8b701829f6
@ -611,7 +611,7 @@ void QDir::setPath(const QString &path)
|
|||||||
*/
|
*/
|
||||||
QString QDir::path() const
|
QString QDir::path() const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
return d->dirEntry.filePath();
|
return d->dirEntry.filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,7 +625,7 @@ QString QDir::path() const
|
|||||||
*/
|
*/
|
||||||
QString QDir::absolutePath() const
|
QString QDir::absolutePath() const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
d->resolveAbsoluteEntry();
|
d->resolveAbsoluteEntry();
|
||||||
return d->absoluteDirEntry.filePath();
|
return d->absoluteDirEntry.filePath();
|
||||||
}
|
}
|
||||||
@ -648,7 +648,7 @@ QString QDir::absolutePath() const
|
|||||||
*/
|
*/
|
||||||
QString QDir::canonicalPath() const
|
QString QDir::canonicalPath() const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
if (!d->fileEngine) {
|
if (!d->fileEngine) {
|
||||||
QFileSystemEntry answer = QFileSystemEngine::canonicalName(d->dirEntry, d->metaData);
|
QFileSystemEntry answer = QFileSystemEngine::canonicalName(d->dirEntry, d->metaData);
|
||||||
return answer.filePath();
|
return answer.filePath();
|
||||||
@ -669,7 +669,7 @@ QString QDir::canonicalPath() const
|
|||||||
*/
|
*/
|
||||||
QString QDir::dirName() const
|
QString QDir::dirName() const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
return d->dirEntry.fileName();
|
return d->dirEntry.fileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -733,7 +733,7 @@ QString QDir::filePath(const QString &fileName) const
|
|||||||
if (treatAsAbsolute(fileName))
|
if (treatAsAbsolute(fileName))
|
||||||
return fileName;
|
return fileName;
|
||||||
|
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
QString ret = d->dirEntry.filePath();
|
QString ret = d->dirEntry.filePath();
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
return ret;
|
return ret;
|
||||||
@ -764,7 +764,7 @@ QString QDir::absoluteFilePath(const QString &fileName) const
|
|||||||
if (treatAsAbsolute(fileName))
|
if (treatAsAbsolute(fileName))
|
||||||
return fileName;
|
return fileName;
|
||||||
|
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
d->resolveAbsoluteEntry();
|
d->resolveAbsoluteEntry();
|
||||||
const QString absoluteDirPath = d->absoluteDirEntry.filePath();
|
const QString absoluteDirPath = d->absoluteDirEntry.filePath();
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
@ -1000,7 +1000,7 @@ bool QDir::cdUp()
|
|||||||
*/
|
*/
|
||||||
QStringList QDir::nameFilters() const
|
QStringList QDir::nameFilters() const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
return d->nameFilters;
|
return d->nameFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1021,7 +1021,7 @@ QStringList QDir::nameFilters() const
|
|||||||
*/
|
*/
|
||||||
void QDir::setNameFilters(const QStringList &nameFilters)
|
void QDir::setNameFilters(const QStringList &nameFilters)
|
||||||
{
|
{
|
||||||
QDirPrivate* d = d_ptr.data();
|
Q_D(QDir);
|
||||||
d->initFileEngine();
|
d->initFileEngine();
|
||||||
d->clearFileLists();
|
d->clearFileLists();
|
||||||
|
|
||||||
@ -1108,7 +1108,7 @@ QStringList QDir::searchPaths(const QString &prefix)
|
|||||||
*/
|
*/
|
||||||
QDir::Filters QDir::filter() const
|
QDir::Filters QDir::filter() const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
return d->filters;
|
return d->filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1187,7 +1187,7 @@ QDir::Filters QDir::filter() const
|
|||||||
*/
|
*/
|
||||||
void QDir::setFilter(Filters filters)
|
void QDir::setFilter(Filters filters)
|
||||||
{
|
{
|
||||||
QDirPrivate* d = d_ptr.data();
|
Q_D(QDir);
|
||||||
d->initFileEngine();
|
d->initFileEngine();
|
||||||
d->clearFileLists();
|
d->clearFileLists();
|
||||||
|
|
||||||
@ -1201,7 +1201,7 @@ void QDir::setFilter(Filters filters)
|
|||||||
*/
|
*/
|
||||||
QDir::SortFlags QDir::sorting() const
|
QDir::SortFlags QDir::sorting() const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
return d->sort;
|
return d->sort;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1244,7 +1244,7 @@ QDir::SortFlags QDir::sorting() const
|
|||||||
*/
|
*/
|
||||||
void QDir::setSorting(SortFlags sort)
|
void QDir::setSorting(SortFlags sort)
|
||||||
{
|
{
|
||||||
QDirPrivate* d = d_ptr.data();
|
Q_D(QDir);
|
||||||
d->initFileEngine();
|
d->initFileEngine();
|
||||||
d->clearFileLists();
|
d->clearFileLists();
|
||||||
|
|
||||||
@ -1260,7 +1260,7 @@ void QDir::setSorting(SortFlags sort)
|
|||||||
*/
|
*/
|
||||||
uint QDir::count() const
|
uint QDir::count() const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
d->initFileLists(*this);
|
d->initFileLists(*this);
|
||||||
return d->files.count();
|
return d->files.count();
|
||||||
}
|
}
|
||||||
@ -1274,7 +1274,7 @@ uint QDir::count() const
|
|||||||
*/
|
*/
|
||||||
QString QDir::operator[](int pos) const
|
QString QDir::operator[](int pos) const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
d->initFileLists(*this);
|
d->initFileLists(*this);
|
||||||
return d->files[pos];
|
return d->files[pos];
|
||||||
}
|
}
|
||||||
@ -1300,7 +1300,7 @@ QString QDir::operator[](int pos) const
|
|||||||
*/
|
*/
|
||||||
QStringList QDir::entryList(Filters filters, SortFlags sort) const
|
QStringList QDir::entryList(Filters filters, SortFlags sort) const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
return entryList(d->nameFilters, filters, sort);
|
return entryList(d->nameFilters, filters, sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1323,7 +1323,7 @@ QStringList QDir::entryList(Filters filters, SortFlags sort) const
|
|||||||
*/
|
*/
|
||||||
QFileInfoList QDir::entryInfoList(Filters filters, SortFlags sort) const
|
QFileInfoList QDir::entryInfoList(Filters filters, SortFlags sort) const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
return entryInfoList(d->nameFilters, filters, sort);
|
return entryInfoList(d->nameFilters, filters, sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1346,7 +1346,7 @@ QFileInfoList QDir::entryInfoList(Filters filters, SortFlags sort) const
|
|||||||
QStringList QDir::entryList(const QStringList &nameFilters, Filters filters,
|
QStringList QDir::entryList(const QStringList &nameFilters, Filters filters,
|
||||||
SortFlags sort) const
|
SortFlags sort) const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
|
|
||||||
if (filters == NoFilter)
|
if (filters == NoFilter)
|
||||||
filters = d->filters;
|
filters = d->filters;
|
||||||
@ -1386,7 +1386,7 @@ QStringList QDir::entryList(const QStringList &nameFilters, Filters filters,
|
|||||||
QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filters,
|
QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filters,
|
||||||
SortFlags sort) const
|
SortFlags sort) const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
|
|
||||||
if (filters == NoFilter)
|
if (filters == NoFilter)
|
||||||
filters = d->filters;
|
filters = d->filters;
|
||||||
@ -1429,7 +1429,7 @@ QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filter
|
|||||||
*/
|
*/
|
||||||
bool QDir::mkdir(const QString &dirName, QFile::Permissions permissions) const
|
bool QDir::mkdir(const QString &dirName, QFile::Permissions permissions) const
|
||||||
{
|
{
|
||||||
const QDirPrivate *d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
|
|
||||||
if (dirName.isEmpty()) {
|
if (dirName.isEmpty()) {
|
||||||
qWarning("QDir::mkdir: Empty or null file name");
|
qWarning("QDir::mkdir: Empty or null file name");
|
||||||
@ -1451,7 +1451,7 @@ bool QDir::mkdir(const QString &dirName, QFile::Permissions permissions) const
|
|||||||
*/
|
*/
|
||||||
bool QDir::mkdir(const QString &dirName) const
|
bool QDir::mkdir(const QString &dirName) const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
|
|
||||||
if (dirName.isEmpty()) {
|
if (dirName.isEmpty()) {
|
||||||
qWarning("QDir::mkdir: Empty or null file name");
|
qWarning("QDir::mkdir: Empty or null file name");
|
||||||
@ -1475,7 +1475,7 @@ bool QDir::mkdir(const QString &dirName) const
|
|||||||
*/
|
*/
|
||||||
bool QDir::rmdir(const QString &dirName) const
|
bool QDir::rmdir(const QString &dirName) const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
|
|
||||||
if (dirName.isEmpty()) {
|
if (dirName.isEmpty()) {
|
||||||
qWarning("QDir::rmdir: Empty or null file name");
|
qWarning("QDir::rmdir: Empty or null file name");
|
||||||
@ -1503,7 +1503,7 @@ bool QDir::rmdir(const QString &dirName) const
|
|||||||
*/
|
*/
|
||||||
bool QDir::mkpath(const QString &dirPath) const
|
bool QDir::mkpath(const QString &dirPath) const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
|
|
||||||
if (dirPath.isEmpty()) {
|
if (dirPath.isEmpty()) {
|
||||||
qWarning("QDir::mkpath: Empty or null file name");
|
qWarning("QDir::mkpath: Empty or null file name");
|
||||||
@ -1529,7 +1529,7 @@ bool QDir::mkpath(const QString &dirPath) const
|
|||||||
*/
|
*/
|
||||||
bool QDir::rmpath(const QString &dirPath) const
|
bool QDir::rmpath(const QString &dirPath) const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
|
|
||||||
if (dirPath.isEmpty()) {
|
if (dirPath.isEmpty()) {
|
||||||
qWarning("QDir::rmpath: Empty or null file name");
|
qWarning("QDir::rmpath: Empty or null file name");
|
||||||
@ -1607,7 +1607,7 @@ bool QDir::removeRecursively()
|
|||||||
*/
|
*/
|
||||||
bool QDir::isReadable() const
|
bool QDir::isReadable() const
|
||||||
{
|
{
|
||||||
const QDirPrivate* d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
|
|
||||||
if (!d->fileEngine) {
|
if (!d->fileEngine) {
|
||||||
if (!d->metaData.hasFlags(QFileSystemMetaData::UserReadPermission))
|
if (!d->metaData.hasFlags(QFileSystemMetaData::UserReadPermission))
|
||||||
@ -1710,7 +1710,7 @@ bool QDir::isRelative() const
|
|||||||
*/
|
*/
|
||||||
bool QDir::makeAbsolute()
|
bool QDir::makeAbsolute()
|
||||||
{
|
{
|
||||||
const QDirPrivate *d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
std::unique_ptr<QDirPrivate> dir;
|
std::unique_ptr<QDirPrivate> dir;
|
||||||
if (!!d->fileEngine) {
|
if (!!d->fileEngine) {
|
||||||
QString absolutePath = d->fileEngine->fileName(QAbstractFileEngine::AbsoluteName);
|
QString absolutePath = d->fileEngine->fileName(QAbstractFileEngine::AbsoluteName);
|
||||||
@ -1739,7 +1739,7 @@ bool QDir::makeAbsolute()
|
|||||||
*/
|
*/
|
||||||
bool QDir::operator==(const QDir &dir) const
|
bool QDir::operator==(const QDir &dir) const
|
||||||
{
|
{
|
||||||
const QDirPrivate *d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
const QDirPrivate *other = dir.d_ptr.constData();
|
const QDirPrivate *other = dir.d_ptr.constData();
|
||||||
|
|
||||||
if (d == other)
|
if (d == other)
|
||||||
@ -1889,7 +1889,7 @@ bool QDir::exists(const QString &name) const
|
|||||||
*/
|
*/
|
||||||
bool QDir::isEmpty(Filters filters) const
|
bool QDir::isEmpty(Filters filters) const
|
||||||
{
|
{
|
||||||
const auto d = d_ptr.constData();
|
Q_D(const QDir);
|
||||||
QDirIterator it(d->dirEntry.filePath(), d->nameFilters, filters);
|
QDirIterator it(d->dirEntry.filePath(), d->nameFilters, filters);
|
||||||
return !it.hasNext();
|
return !it.hasNext();
|
||||||
}
|
}
|
||||||
@ -2339,7 +2339,7 @@ bool QDir::isRelativePath(const QString &path)
|
|||||||
*/
|
*/
|
||||||
void QDir::refresh() const
|
void QDir::refresh() const
|
||||||
{
|
{
|
||||||
QDirPrivate *d = const_cast<QDir*>(this)->d_ptr.data();
|
QDirPrivate *d = const_cast<QDir *>(this)->d_func();
|
||||||
d->metaData.clear();
|
d->metaData.clear();
|
||||||
d->initFileEngine();
|
d->initFileEngine();
|
||||||
d->clearFileLists();
|
d->clearFileLists();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user