Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdir.cpp File Reference

(4275dfb7bfa78999bb8edf27ab18433f97cd3490)

#include "qplatformdefs.h"
#include "qdir.h"
#include "qdir_p.h"
#include "qabstractfileengine_p.h"
#include "qfsfileengine_p.h"
#include "qdebug.h"
#include "qdirlisting.h"
#include "qdatetime.h"
#include "qstring.h"
#include "qvarlengtharray.h"
#include "qfilesystementry_p.h"
#include "qfilesystemmetadata_p.h"
#include "qfilesystemengine_p.h"
#include <qstringbuilder.h>
#include <qcollator.h>
#include "qreadwritelock.h"
#include "qmutex.h"
#include <private/qorderedmutexlocker_p.h>
#include <algorithm>
#include <memory>
#include <stdlib.h>
+ Include dependency graph for qdir.cpp:

Go to the source code of this file.

Classes

struct  QDirSortItem
 
class  QDirSortItemComparator
 

Functions

static qsizetype rootLength (QStringView name, QDirPrivate::PathNormalizations flags)
 
static bool treatAsAbsolute (const QString &path)
 
static bool qt_cleanPath (QString *path)
 
bool comparesEqual (const QDir &lhs, const QDir &rhs)
 
bool qt_normalizePathSegments (QString *path, QDirPrivate::PathNormalizations flags)
 
QDebug operator<< (QDebug debug, QDir::Filters filters)
 
static QDebug operator<< (QDebug debug, QDir::SortFlags sorting)
 
QDebug operator<< (QDebug debug, const QDir &dir)
 

Function Documentation

◆ comparesEqual()

bool comparesEqual ( const QDir & lhs,
const QDir & rhs )

Definition at line 1835 of file qdir.cpp.

◆ operator<<() [1/3]

QDebug operator<< ( QDebug debug,
const QDir & dir )

Definition at line 2514 of file qdir.cpp.

◆ operator<<() [2/3]

QDebug operator<< ( QDebug debug,
QDir::Filters filters )

Definition at line 2462 of file qdir.cpp.

Referenced by checkWarnMessage(), formatQDebug(), and QSGBatchRenderer::qsg_dumpShadowRoots().

+ Here is the caller graph for this function:

◆ operator<<() [3/3]

static QDebug operator<< ( QDebug debug,
QDir::SortFlags sorting )
static

Definition at line 2490 of file qdir.cpp.

◆ qt_cleanPath()

static bool qt_cleanPath ( QString * path)
static

Definition at line 2379 of file qdir.cpp.

◆ qt_normalizePathSegments()

bool qt_normalizePathSegments ( QString * path,
QDirPrivate::PathNormalizations flags )

Updates path with redundant directory separators removed, and "."s and ".."s resolved (as far as possible). It returns false if there were ".." segments left over, attempt to go up past the root (only applies to absolute paths), or true otherwise.

This method is shared with QUrl, so it doesn't deal with QDir::separator(), nor does it remove the trailing slash, if any.

When dealing with URLs, we are following the "Remove dot segments" algorithm from https://www.ietf.org/rfc/rfc3986.html#section-5.2.4 URL mode differs from local path mode in these ways: 1) it can set *path to empty ("." becomes "") 2) directory path outputs end in / ("a/.." becomes "a/" instead of "a") 3) a sequence of "//" is treated as multiple path levels ("a/b//.." becomes "a/b/" and "a/b//../.." becomes "a/"), which matches the behavior observed in web browsers.

As a Qt extension, for local URLs we treat multiple slashes as one slash.

Definition at line 2240 of file qdir.cpp.

References QDirPrivate::RemotePath.

◆ rootLength()

static qsizetype rootLength ( QStringView name,
QDirPrivate::PathNormalizations flags )
static

Definition at line 55 of file qdir.cpp.

References QDirPrivate::UrlNormalizationMode.

◆ treatAsAbsolute()

static bool treatAsAbsolute ( const QString & path)
static

Definition at line 766 of file qdir.cpp.