QrcParser Class

(QmlJS::QrcParser)

Parses one or more qrc files, and keeps their content cached. More...

Header: #include <QrcParser>

Public Types

typedef ConstPtr
typedef Ptr

Public Functions

~QrcParser()
void collectFilesAtPath(const QString &path, QStringList *res, const QLocale *locale = 0) const
void collectFilesInPath(const QString &path, QMap<QString, QStringList> *res, bool addDirs = false, const QLocale *locale = 0) const
void collectResourceFilesForSourceFile(const QString &sourceFile, QStringList *results, const QLocale *locale = 0) const
QStringList errorMessages() const
QString firstFileAtPath(const QString &path, const QLocale &locale) const
bool hasDirAtPath(const QString &path, const QLocale *locale = 0) const
bool isValid() const
QStringList languages() const
bool parseFile(const QString &path, const QString &contents)

Static Public Members

QString normalizedQrcDirectoryPath(const QString &path)
QString normalizedQrcFilePath(const QString &path)
QmlJS::QrcParser::Ptr parseQrcFile(const QString &path, const QString &contents)
QString qrcDirectoryPathForQrcFilePath(const QString &file)

Detailed Description

Parses one or more qrc files, and keeps their content cached

A Qrc resource contains files read from the filesystem but organized in a possibly different way.

To easily describe that with a simple structure we use a map from qrc paths to the paths in the filesystem. By using a map we can easily find all qrc paths that start with a given prefix, and thus loop on a qrc directory.

Qrc files also support languages, those are mapped to a prefix of the qrc path. For example the french /image/bla.png (lang=fr) will have the path "fr/image/bla.png". The empty language represent the default resource. Languages are looked up using the locale uiLanguages() property

For a single qrc a given path maps to a single file, but when one has multiple (platform specific exclusive) qrc files, then multiple files match, so QStringList are used.

Especially the collect* functions are thought as low level interface.

Member Type Documentation

typedef QrcParser::ConstPtr

typedef QrcParser::Ptr

Member Function Documentation

QrcParser::~QrcParser()

Destroys the instance of QrcParser.

void QrcParser::collectFilesAtPath(const QString &path, QStringList *res, const QLocale *locale = 0) const

void QrcParser::collectFilesInPath(const QString &path, QMap<QString, QStringList> *res, bool addDirs = false, const QLocale *locale = 0) const

void QrcParser::collectResourceFilesForSourceFile(const QString &sourceFile, QStringList *results, const QLocale *locale = 0) const

QStringList QrcParser::errorMessages() const

QString QrcParser::firstFileAtPath(const QString &path, const QLocale &locale) const

bool QrcParser::hasDirAtPath(const QString &path, const QLocale *locale = 0) const

bool QrcParser::isValid() const

QStringList QrcParser::languages() const

[static] QString QrcParser::normalizedQrcDirectoryPath(const QString &path)

[static] QString QrcParser::normalizedQrcFilePath(const QString &path)

bool QrcParser::parseFile(const QString &path, const QString &contents)

[static] QmlJS::QrcParser::Ptr QrcParser::parseQrcFile(const QString &path, const QString &contents)

[static] QString QrcParser::qrcDirectoryPathForQrcFilePath(const QString &file)