이 페이지에서

Utils::QrcParser Class

class Utils::QrcParser

QrcParser 클래스는 하나 이상의 QRC 파일을 파싱하고 해당 내용을 캐시에 저장합니다. 더 보기...

Header: #include <QrcParser>

공개 유형

공개 함수

void collectFilesAtPath(const QString &path, Utils::FilePaths *res, const QLocale *locale = nullptr) const
void collectFilesInPath(const QString &path, QMap<QString, Utils::FilePaths> *res, bool addDirs = false, const QLocale *locale = nullptr) const
void collectResourceFilesForSourceFile(const Utils::FilePath &sourceFile, QStringList *res, const QLocale *locale = nullptr) const
QStringList errorMessages() const
Utils::FilePath firstFileAtPath(const QString &path, const QLocale &locale) const
bool hasDirAtPath(const QString &path, const QLocale *locale = nullptr) const
bool isValid() const
QStringList languages() const
bool parseFile(const Utils::FilePath &path, const QString &contents)

정적 공용 멤버

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

상세 설명

Qt 리소스 컬렉션(QRC) 은 파일 시스템에서 읽은 파일을 포함하지만, 조직 방식은 다를 수 있습니다. 이를 간단한 구조로 쉽게 설명하기 위해, QRC 경로와 파일 시스템 내 경로를 연결하는 맵을 사용합니다. 맵을 사용하면 주어진 접두사로 시작하는 모든 QRC 경로를 쉽게 찾을 수 있으며, 따라서 QRC 디렉터리를 순회할 수 있습니다.

QRC 파일은 또한 언어를 지원하며, 언어는 QRC 경로의 접두사로 매핑됩니다. 예를 들어, 프랑스어 /image/bla.png (lang=fr)의 경로는 fr/image/bla.png 이 됩니다. 빈 언어는 기본 리소스를 나타냅니다. 언어는 locale uiLanguages() 속성을 사용하여 조회됩니다.

단일 QRC의 경우, 주어진 경로는 하나의 파일에 매핑되지만, 여러 개의 (플랫폼별이며 상호 배타적인) QRC 파일이 있는 경우에는 여러 파일이 일치하므로 QStringList 가 사용됩니다.

특히, collect* 함수들은 저수준 인터페이스로 간주됩니다.

멤버 유형 문서

[alias] QrcParser::ConstPtr

상수 포인터를 나타냅니다.

[alias] QrcParser::Ptr

포인터를 나타냅니다.

멤버 함수 문서

void QrcParser::collectFilesAtPath(const QString &path, Utils::FilePaths *res, const QLocale *locale = nullptr) const

지정된 QRC path 에 해당하는 파일 시스템 경로를 res 에 추가합니다.

locale 가 null인 경우, 가능한 모든 파일이 추가됩니다. 그렇지 않은 경우, 로케일과 일치하는 첫 번째 파일만 추가됩니다.

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

addDirs 가 true 로 설정된 경우, 지정된 QRC( path )의 디렉터리 내용을 res 에 추가합니다.

지정된 path 에 포함된 파일 시스템 경로 매핑에 QRC 파일 이름을 res 에 추가합니다. addDirs()가 true 인 경우, 디렉터리도 함께 추가됩니다.

locale 가 null인 경우, 가능한 모든 파일이 추가됩니다. 그렇지 않은 경우, 로케일과 일치하는 첫 번째 파일만 추가됩니다.

void QrcParser::collectResourceFilesForSourceFile(const Utils::FilePath &sourceFile, QStringList *res, const QLocale *locale = nullptr) const

QRC 파일 sourceFile 에 포함된 리소스 파일을 res 에 추가합니다.

locale 가 null인 경우, 가능한 모든 파일이 추가됩니다. 그렇지 않은 경우, 해당 로케일과 일치하는 첫 번째 파일만 추가됩니다.

QStringList QrcParser::errorMessages() const

구문 분석 중에 발견된 오류를 반환합니다.

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

지정된 QRC path 와 locale 에 있는 첫 번째(활성) 파일의 파일 시스템 경로를 반환합니다.

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

path 가 비어 있지 않은 디렉터리이며 locale 와 일치할 경우, true 를 반환합니다.

bool QrcParser::isValid() const

QRC의 내용이 유효한지 여부를 나타냅니다.

QRC가 비어 있는 경우 오류를 반환합니다.

QStringList QrcParser::languages() const

이 QRC에서 사용된 모든 언어를 반환합니다.

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

QRC 리소스 내의 디렉터리 경로를 path 형식으로 정규화하여 반환합니다. 이때 qrc:/ 또는 : 을 제거하고, 경로 시작 부분의 불필요한 슬래시를 제거하며, 경로가 슬래시로 끝나도록 처리합니다.

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

path 을 QRC 리소스 내의 파일로 정규화하며, 이때 qrc:/ 또는 : 및 파일 이름 앞부분에 있는 불필요한 슬래시를 제거합니다.

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

path 에 있는 QRC 파일을 파싱합니다. contents 가 비어 있지 않은 경우, 파일 시스템에서 파일을 읽지 않고 이 값을 파일 내용으로 사용합니다.

구문 분석이 성공했는지 여부를 반환합니다.

errorMessages() 및 parseQrcFile()도 참조하십시오 .

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

path 에 있는 QRC 파일의 contents 를 반환합니다.

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

file 의 QRC 디렉터리 경로를 반환합니다.

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.