59 const thread_local QRegularExpression sRx( u
"^data:([a-zA-Z0-9+\\-]*\\/[a-zA-Z0-9+\\-]*?)(?:;(base64|utf8))?,(.*)$"_s );
60 const QRegularExpressionMatch base64Match = sRx.match( path );
61 if ( !base64Match.hasMatch() )
64 const QString typeMatch = base64Match.captured( 2 );
65 const QString mimeMatch = base64Match.captured( 1 );
68 *mimeType = mimeMatch;
70 *data = base64Match.captured( 3 );
72 if ( typeMatch ==
"base64"_L1 )
74 else if ( typeMatch ==
"utf8"_L1 )
79 if ( mimeMatch.endsWith(
"xml"_L1 ) || mimeMatch.endsWith(
"svg"_L1 ) )
87 const thread_local QRegularExpression sRx( u
"^data:([a-zA-Z0-9+\\-]*\\/[a-zA-Z0-9+\\-]*?)\\;utf8,(.*)$"_s, QRegularExpression::DotMatchesEverythingOption );
88 const QRegularExpressionMatch stringMatch = sRx.match( path );
90 if ( !stringMatch.hasMatch() )
94 *mimeType = stringMatch.captured( 1 );
96 *data = stringMatch.captured( 2 );
static bool parseEmbeddedStringData(const QString &path, QString *mimeType=nullptr, QString *data=nullptr)
Parses a path to determine if it represents a embedded string data, and if so, extracts the component...
virtual void onRemoteContentFetched(const QString &url, bool success)
Triggered after remote content (i.e.
static bool parseBase64DataUrl(const QString &path, QString *mimeType=nullptr, QString *data=nullptr)
Parses a path to determine if it represents a base 64 encoded HTML data URL, and if so,...
QgsAbstractContentCacheBase(QObject *parent)
Constructor for QgsAbstractContentCacheBase, with the specified parent object.
virtual bool invalidateCacheEntry(const QString &path)
Invalidates a cache entry for the specified path.
static bool isBase64Data(const QString &path)
Returns true if path represents base64 encoded data.
QgsAbstractContentCacheEntry(const QString &path)
Constructor for QgsAbstractContentCacheEntry for an entry relating to the specified path.
QString path
Represents the absolute path to a file, a remote URL, or a base64 encoded string.