45 #include <QtCore/qstring.h> 46 #include <QtCore/qfileinfo.h> 47 #include <QtCore/qstringlist.h> 48 #include <QtCore/qshareddata.h> 68 AllEntries = Dirs | Files | Drives,
77 PermissionMask = 0x070,
90 NoDotAndDotDot = 0x1000,
96 ,DefaultFilter = NoFilter
101 typedef Filters FilterSpec;
118 ,DefaultSort = NoSort
126 SortFlags
sort = SortFlags(Name | IgnoreCase), Filters
filter = AllEntries);
131 #ifdef Q_COMPILER_RVALUE_REFS 132 inline QDir &operator=(
QDir &&other)
133 {
qSwap(d_ptr, other.d_ptr);
return *
this; }
136 void setPath(
const QString &path);
141 static void addResourceSearchPath(
const QString &path);
144 static void addSearchPath(
const QString &prefix,
const QString &path);
158 bool cd(
const QString &dirName);
162 void setNameFilters(
const QStringList &nameFilters);
165 void setFilter(Filters
filter);
166 SortFlags sorting()
const;
167 void setSorting(SortFlags
sort);
176 SortFlags
sort = NoSort)
const;
180 SortFlags
sort = NoSort)
const;
182 bool mkdir(
const QString &dirName)
const;
183 bool rmdir(
const QString &dirName)
const;
184 bool mkpath(
const QString &dirPath)
const;
185 bool rmpath(
const QString &dirPath)
const;
187 bool isReadable()
const;
191 static bool isRelativePath(
const QString &path);
193 bool isRelative()
const;
206 static QChar separator();
208 static bool setCurrent(
const QString &path);
225 void refresh()
const;
228 typedef SortFlags SortSpec;
229 inline QT3_SUPPORT
QString absPath()
const {
return absolutePath(); }
230 inline QT3_SUPPORT
QString absFilePath(
const QString &fileName,
bool acceptAbsPath =
true)
const 231 {
Q_UNUSED(acceptAbsPath);
return absoluteFilePath(fileName); }
232 QT3_SUPPORT
bool matchAllDirs()
const;
233 QT3_SUPPORT
void setMatchAllDirs(
bool on);
234 inline QT3_SUPPORT
QStringList entryList(
const QString &nameFilter, Filters filters = NoFilter,
235 SortFlags
sort = NoSort)
const 236 {
return entryList(nameFiltersFromString(nameFilter), filters,
sort); }
238 Filters filters = NoFilter,
239 SortFlags
sort = NoSort)
const 240 {
return entryInfoList(nameFiltersFromString(nameFilter), filters,
sort); }
242 QT3_SUPPORT
QString nameFilter()
const;
243 QT3_SUPPORT
void setNameFilter(
const QString &nameFilter);
245 inline QT3_SUPPORT
bool mkdir(
const QString &dirName,
bool acceptAbsPath)
const 246 {
Q_UNUSED(acceptAbsPath);
return mkdir(dirName); }
247 inline QT3_SUPPORT
bool rmdir(
const QString &dirName,
bool acceptAbsPath)
const 248 {
Q_UNUSED(acceptAbsPath);
return rmdir(dirName); }
250 inline QT3_SUPPORT
void convertToAbs() { makeAbsolute(); }
251 inline QT3_SUPPORT
static QString currentDirPath() {
return currentPath(); }
252 inline QT3_SUPPORT
static QString homeDirPath() {
return homePath(); }
253 inline QT3_SUPPORT
static QString rootDirPath() {
return rootPath(); }
255 #endif // QT3_SUPPORT 261 #ifndef QT_NO_DEBUG_STREAM The QDir class provides access to directory structures and their contents.
The QDebug class provides an output stream for debugging information.
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
#define QT_END_NAMESPACE
This macro expands to.
static bool isAbsolutePath(const QString &path)
Returns true if path is absolute; returns false if it is relative.
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
static bool match(const uchar *found, const char *target, uint len)
The QString class provides a Unicode character string.
static QDir home()
Returns the user's home directory.
bool isAbsolute() const
Returns true if the directory's path is absolute; otherwise returns false.
The QChar class provides a 16-bit Unicode character.
#define QT_BEGIN_NAMESPACE
This macro expands to.
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
static void sort(T *array, int count, LessThan lessThan)
bool operator!=(const QDir &dir) const
Returns true if directory dir and this directory have different paths or different sort or filter set...
static QDir current()
Returns the application's current directory.
The QStringList class provides a list of strings.
SortFlag
This enum describes the sort options available to QDir, e.
static QDir temp()
Returns the system's temporary directory.
static QString cleanPath(const QString &_path)
void qSwap(T &value1, T &value2)
Filter
This enum describes the filtering options available to QDir; e.
static const char *const filters[3]
QFuture< void > filter(Sequence &sequence, FilterFunction filterFunction)
QSharedDataPointer< QDirPrivate > d_ptr
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static QString fileName(const QString &fileUrl)
bool operator==(QBool b1, bool b2)
static QDir root()
Returns the root directory.