Qt 4.8
Classes | Functions
qdir.cpp File Reference
#include "qplatformdefs.h"
#include "qdir.h"
#include "qdir_p.h"
#include "qabstractfileengine.h"
#include "qdebug.h"
#include "qdiriterator.h"
#include "qfsfileengine.h"
#include "qdatetime.h"
#include "qstring.h"
#include "qregexp.h"
#include "qvector.h"
#include "qalgorithms.h"
#include "qvarlengtharray.h"
#include "qfilesystementry_p.h"
#include "qfilesystemmetadata_p.h"
#include "qfilesystemengine_p.h"
#include <qstringbuilder.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct  QDirSortItem
 
class  QDirSortItemComparator
 

Functions

static QString driveSpec (const QString &path)
 
QDebug operator<< (QDebug debug, QDir::Filters filters)
 
static QDebug operator<< (QDebug debug, QDir::SortFlags sorting)
 
QDebug operator<< (QDebug debug, const QDir &dir)
 

Function Documentation

◆ driveSpec()

static QString driveSpec ( const QString path)
static

Definition at line 71 of file qdir.cpp.

Referenced by QDir::relativeFilePath().

72 {
73 #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
74  if (path.size() < 2)
75  return QString();
76  char c = path.at(0).toAscii();
77  if (c < 'a' && c > 'z' && c < 'A' && c > 'Z')
78  return QString();
79  if (path.at(1).toAscii() != ':')
80  return QString();
81  return path.mid(0, 2);
82 #else
83  Q_UNUSED(path);
84  return QString();
85 #endif
86 }
unsigned char c[8]
Definition: qnumeric_p.h:62
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
The QString class provides a Unicode character string.
Definition: qstring.h:83
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
char toAscii() const
Returns the character value of the QChar obtained using the current codec used to read C strings...
Definition: qchar.cpp:1490
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ operator<<() [1/3]

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

Definition at line 2476 of file qdir.cpp.

Referenced by QDir::temp().

2477 {
2478  QStringList flags;
2479  if (filters == QDir::NoFilter) {
2480  flags << QLatin1String("NoFilter");
2481  } else {
2482  if (filters & QDir::Dirs) flags << QLatin1String("Dirs");
2483  if (filters & QDir::AllDirs) flags << QLatin1String("AllDirs");
2484  if (filters & QDir::Files) flags << QLatin1String("Files");
2485  if (filters & QDir::Drives) flags << QLatin1String("Drives");
2486  if (filters & QDir::NoSymLinks) flags << QLatin1String("NoSymLinks");
2487  if (filters & QDir::NoDotAndDotDot) flags << QLatin1String("NoDotAndDotDot"); // ### Qt5: remove (because NoDotAndDotDot=NoDot|NoDotDot)
2488  if (filters & QDir::NoDot) flags << QLatin1String("NoDot");
2489  if (filters & QDir::NoDotDot) flags << QLatin1String("NoDotDot");
2490  if ((filters & QDir::AllEntries) == QDir::AllEntries) flags << QLatin1String("AllEntries");
2491  if (filters & QDir::Readable) flags << QLatin1String("Readable");
2492  if (filters & QDir::Writable) flags << QLatin1String("Writable");
2493  if (filters & QDir::Executable) flags << QLatin1String("Executable");
2494  if (filters & QDir::Modified) flags << QLatin1String("Modified");
2495  if (filters & QDir::Hidden) flags << QLatin1String("Hidden");
2496  if (filters & QDir::System) flags << QLatin1String("System");
2497  if (filters & QDir::CaseSensitive) flags << QLatin1String("CaseSensitive");
2498  }
2499  debug << "QDir::Filters(" << qPrintable(flags.join(QLatin1String("|"))) << ')';
2500  return debug;
2501 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
QString join(const QString &sep) const
Joins all the string list&#39;s strings into a single string with each element separated by the given sep...
Definition: qstringlist.h:162
static const char *const filters[3]
#define qPrintable(string)
Definition: qglobal.h:1750

◆ operator<<() [2/3]

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

Definition at line 2503 of file qdir.cpp.

2504 {
2505  if (sorting == QDir::NoSort) {
2506  debug << "QDir::SortFlags(NoSort)";
2507  } else {
2508  QString type;
2509  if ((sorting & 3) == QDir::Name) type = QLatin1String("Name");
2510  if ((sorting & 3) == QDir::Time) type = QLatin1String("Time");
2511  if ((sorting & 3) == QDir::Size) type = QLatin1String("Size");
2512  if ((sorting & 3) == QDir::Unsorted) type = QLatin1String("Unsorted");
2513 
2514  QStringList flags;
2515  if (sorting & QDir::DirsFirst) flags << QLatin1String("DirsFirst");
2516  if (sorting & QDir::DirsLast) flags << QLatin1String("DirsLast");
2517  if (sorting & QDir::IgnoreCase) flags << QLatin1String("IgnoreCase");
2518  if (sorting & QDir::LocaleAware) flags << QLatin1String("LocaleAware");
2519  if (sorting & QDir::Type) flags << QLatin1String("Type");
2520  debug << "QDir::SortFlags(" << qPrintable(type)
2521  << '|'
2522  << qPrintable(flags.join(QLatin1String("|"))) << ')';
2523  }
2524  return debug;
2525 }
int type
Definition: qmetatype.cpp:239
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
QString join(const QString &sep) const
Joins all the string list&#39;s strings into a single string with each element separated by the given sep...
Definition: qstringlist.h:162
#define qPrintable(string)
Definition: qglobal.h:1750

◆ operator<<() [3/3]

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

Definition at line 2527 of file qdir.cpp.

2528 {
2529  debug.maybeSpace() << "QDir(" << dir.path()
2530  << ", nameFilters = {"
2531  << qPrintable(dir.nameFilters().join(QLatin1String(",")))
2532  << "}, "
2533  << dir.sorting()
2534  << ','
2535  << dir.filter()
2536  << ')';
2537  return debug.space();
2538 }
SortFlags sorting() const
Returns the value set by setSorting()
Definition: qdir.cpp:1184
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QStringList nameFilters() const
Returns the string list set by setNameFilters()
Definition: qdir.cpp:945
QDebug & maybeSpace()
Writes a space character to the debug stream, depending on the last character sent to the stream...
Definition: qdebug.h:93
QString join(const QString &sep) const
Joins all the string list&#39;s strings into a single string with each element separated by the given sep...
Definition: qstringlist.h:162
Filters filter() const
Returns the value set by setFilter()
Definition: qdir.cpp:1085
QString path() const
Returns the path.
Definition: qdir.cpp:605
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91
#define qPrintable(string)
Definition: qglobal.h:1750