Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QSSGGltfResourceResolver Namespace Reference

Functions

bool isDataUri (QStringView uri)
QByteArray decodeDataUri (QStringView uri, QString *errorMessage)
QString resolveFilePath (QStringView uri, const QString &baseDir)
QByteArray loadUri (QStringView uri, const QString &baseDir, QString *errorMessage)

Detailed Description

Resolves glTF URIs: data: URIs (base64 or percent-encoded), and relative or absolute file paths, including Qt resource (":/...") paths.

Function Documentation

◆ decodeDataUri()

QByteArray QSSGGltfResourceResolver::decodeDataUri ( QStringView uri,
QString * errorMessage = nullptr )

Decodes the payload of the data: URI uri. Returns an empty array and sets errorMessage on failure.

Definition at line 38 of file qssggltfresourceresolver.cpp.

◆ isDataUri()

bool QSSGGltfResourceResolver::isDataUri ( QStringView uri)

Returns whether uri is a data: URI.

Definition at line 27 of file qssggltfresourceresolver.cpp.

◆ loadUri()

QByteArray QSSGGltfResourceResolver::loadUri ( QStringView uri,
const QString & baseDir,
QString * errorMessage = nullptr )

Loads the contents referenced by the glTF URI uri: data: URIs are decoded, anything else is treated as a file path relative to baseDir. Sets errorMessage on failure.

Definition at line 105 of file qssggltfresourceresolver.cpp.

◆ resolveFilePath()

QString QSSGGltfResourceResolver::resolveFilePath ( QStringView uri,
const QString & baseDir )

Resolves the relative file URI uri against baseDir to a local or qrc path. The URI is percent-decoded as required by the glTF specification.

A URI that would reach outside baseDir is rejected, which returns an empty string. The specification only allows relative references here, so an absolute path or one climbing out with ".." is malformed rather than merely unusual, and refusing it keeps a hostile asset from naming an arbitrary file for the application to load and read back.

Definition at line 80 of file qssggltfresourceresolver.cpp.