Qt 4.8
Functions
qfilesystemengine.cpp File Reference
#include "qfilesystemengine_p.h"
#include <QtCore/qdir.h>
#include <QtCore/qset.h>
#include <QtCore/qstringbuilder.h>
#include <QtCore/private/qabstractfileengine_p.h>

Go to the source code of this file.

Functions

static bool _q_checkEntry (QFileSystemEntry &entry, QFileSystemMetaData &data, bool resolvingEntry)
 
static bool _q_checkEntry (QAbstractFileEngine *&engine, bool resolvingEntry)
 
static bool _q_resolveEntryAndCreateLegacyEngine_recursive (QFileSystemEntry &entry, QFileSystemMetaData &data, QAbstractFileEngine *&engine, bool resolvingEntry=false)
 

Function Documentation

◆ _q_checkEntry() [1/2]

static bool _q_checkEntry ( QFileSystemEntry entry,
QFileSystemMetaData data,
bool  resolvingEntry 
)
inlinestatic

Definition at line 124 of file qfilesystemengine.cpp.

Referenced by _q_resolveEntryAndCreateLegacyEngine_recursive().

125 {
126  if (resolvingEntry) {
128  || !data.exists()) {
129  data.clear();
130  return false;
131  }
132  }
133 
134  return true;
135 }
static bool fillMetaData(const QFileSystemEntry &entry, QFileSystemMetaData &data, QFileSystemMetaData::MetaDataFlags what)

◆ _q_checkEntry() [2/2]

static bool _q_checkEntry ( QAbstractFileEngine *&  engine,
bool  resolvingEntry 
)
inlinestatic

Definition at line 137 of file qfilesystemengine.cpp.

138 {
139  if (resolvingEntry) {
141  delete engine;
142  engine = 0;
143  return false;
144  }
145  }
146 
147  return true;
148 }
virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const
This function should return the set of OR&#39;d flags that are true for the file engine&#39;s file...

◆ _q_resolveEntryAndCreateLegacyEngine_recursive()

static bool _q_resolveEntryAndCreateLegacyEngine_recursive ( QFileSystemEntry entry,
QFileSystemMetaData data,
QAbstractFileEngine *&  engine,
bool  resolvingEntry = false 
)
static

Definition at line 150 of file qfilesystemengine.cpp.

Referenced by QFileSystemEngine::resolveEntryAndCreateLegacyEngine().

152 {
153  QString const &filePath = entry.filePath();
154  if ((engine = qt_custom_file_engine_handler_create(filePath)))
155  return _q_checkEntry(engine, resolvingEntry);
156 
157 #if defined(QT_BUILD_CORE_LIB)
158  for (int prefixSeparator = 0; prefixSeparator < filePath.size(); ++prefixSeparator) {
159  QChar const ch = filePath[prefixSeparator];
160  if (ch == QLatin1Char('/'))
161  break;
162 
163  if (ch == QLatin1Char(':')) {
164  if (prefixSeparator == 0) {
165  engine = new QResourceFileEngine(filePath);
166  return _q_checkEntry(engine, resolvingEntry);
167  }
168 
169  if (prefixSeparator == 1)
170  break;
171 
172  const QStringList &paths = QDir::searchPaths(filePath.left(prefixSeparator));
173  for (int i = 0; i < paths.count(); i++) {
174  entry = QFileSystemEntry(QDir::cleanPath(paths.at(i) % QLatin1Char('/') % filePath.mid(prefixSeparator + 1)));
175  // Recurse!
176  if (_q_resolveEntryAndCreateLegacyEngine_recursive(entry, data, engine, true))
177  return true;
178  }
179 
180  // entry may have been clobbered at this point.
181  return false;
182  }
183 
184  // There's no need to fully validate the prefix here. Consulting the
185  // unicode tables could be expensive and validation is already
186  // performed in QDir::setSearchPaths.
187  //
188  // if (!ch.isLetterOrNumber())
189  // break;
190  }
191 #endif // defined(QT_BUILD_CORE_LIB)
192 
193  return _q_checkEntry(entry, data, resolvingEntry);
194 }
static bool _q_checkEntry(QFileSystemEntry &entry, QFileSystemMetaData &data, bool resolvingEntry)
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QAbstractFileEngine * qt_custom_file_engine_handler_create(const QString &path)
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
static QString cleanPath(const QString &path)
Removes all multiple directory separators "/" and resolves any "."s or ".."s found in the path...
Definition: qdir.cpp:2082
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
static QStringList searchPaths(const QString &prefix)
QString filePath() const
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
static bool _q_resolveEntryAndCreateLegacyEngine_recursive(QFileSystemEntry &entry, QFileSystemMetaData &data, QAbstractFileEngine *&engine, bool resolvingEntry=false)