8#include <QXmlStreamReader>
54 populateFromQrcFile(
f);
60 return qrcPathToFileSystemPath.isEmpty();
65 for (
const auto &
entry : qrcPathToFileSystemPath) {
66 if (
entry.resourcePath == resourcePath)
74 if (suffixes.isEmpty())
77 return suffixes.contains(suffix);
80template<
typename HandleMatch>
83 const HandleMatch &handler)
118 if (
it->resourcePath ==
filter.path && handler(*
it))
120 }
else if (
it->filePath ==
filter.path && handler(*
it)) {
170void QQmlJSResourceFileMapper::populateFromQrcFile(
QFile &
file)
188 switch (
reader.readNext()) {
189 case QXmlStreamReader::StartElement:
191 if (
state != InitialState)
208 if (
state != InResource)
211 currentFileAttributes =
reader.attributes();
216 case QXmlStreamReader::EndElement:
223 if (
state != InResource)
230 state = InitialState;
235 case QXmlStreamReader::Characters: {
236 if (
reader.isWhitespace())
251 currentFileName.
remove(0, 3);
253 const QString qrcPath = prefix + currentFileName;
255 qrcPathToFileSystemPath.append({qrcPath, fsPath});
static QString cleanPath(const QString &path)
Returns path with directory separators normalized (that is, platform-native separators converted to "...
QString absoluteFilePath(const QString &fileName) const
Returns the absolute path name of a file in the directory.
\inmodule QtCore \reentrant
QString suffix() const
Returns the suffix (extension) of the file.
QString canonicalFilePath() const
Returns the canonical path including the file name, i.e.
QDir absoluteDir() const
Returns the file's absolute path as a QDir object.
bool exists() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString text(const QString &key) const
const_iterator constBegin() const noexcept
const_iterator constEnd() const noexcept
QString toString() const
Returns a deep copy of this string view's data as a QString.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
qsizetype size() const
Returns the number of characters in this string.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString & append(QChar c)
QString & remove(qsizetype i, qsizetype len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
QString & prepend(QChar c)
bool hasAttribute(QAnyStringView qualifiedName) const
Q_CORE_EXPORT QStringView value(QAnyStringView namespaceUri, QAnyStringView name) const noexcept
QSet< QString >::iterator it
Combined button and popup list for selecting options.
QImageReader reader("image.png")
[1]
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
static bool hasSuffix(const QString &qrcPath, const QStringList &suffixes)
void doFilter(const QList< QQmlJSResourceFileMapper::Entry > &qrcPathToFileSystemPath, const QQmlJSResourceFileMapper::Filter &filter, const HandleMatch &handler)
#define QStringLiteral(str)
\inmodule QtCore \reentrant
Entry entry(const Filter &filter) const
static Filter resourceFileFilter(const QString &file)
static Filter resourceQmlDirectoryFilter(const QString &directory)
bool isFile(const QString &resourcePath) const
QList< Entry > filter(const Filter &filter) const
QStringList filePaths(const Filter &filter) const
static Filter localFileFilter(const QString &file)
QQmlJSResourceFileMapper(const QStringList &resourceFiles)
QStringList resourcePaths(const Filter &filter) const
static Filter allQmlJSFilter()