QGIS API Documentation 3.41.0-Master (cea29feecf2)
|
A cache for source strings that returns a local file path containing the source content. More...
#include <qgssourcecache.h>
Signals | |
void | remoteSourceFetched (const QString &url) |
Emitted when the cache has finished retrieving a 3D model from a remote url. | |
Signals inherited from QgsAbstractContentCacheBase | |
void | remoteContentFetched (const QString &url) |
Emitted when the cache has finished retrieving content from a remote url. | |
Public Member Functions | |
QgsSourceCache (QObject *parent=nullptr) | |
Constructor for QgsSourceCache, with the specified parent object. | |
QString | localFilePath (const QString &path, bool blocking=false) |
Returns a local file path reflecting the content of a specified source path. | |
Public Member Functions inherited from QgsAbstractContentCache< QgsSourceCacheEntry > | |
QgsAbstractContentCache (QObject *parent=nullptr, const QString &typeString=QString(), long maxCacheSize=20000000, int fileModifiedCheckTimeout=30000) | |
Constructor for QgsAbstractContentCache, with the specified parent object. | |
~QgsAbstractContentCache () override | |
Public Member Functions inherited from QgsAbstractContentCacheBase | |
QgsAbstractContentCacheBase (QObject *parent) | |
Constructor for QgsAbstractContentCacheBase, with the specified parent object. | |
Additional Inherited Members | |
Static Public Member Functions inherited from QgsAbstractContentCacheBase | |
static bool | isBase64Data (const QString &path) |
Returns true if path represents base64 encoded data. | |
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, extracts the components of the URL. | |
Protected Slots inherited from QgsAbstractContentCacheBase | |
Protected Member Functions inherited from QgsAbstractContentCache< QgsSourceCacheEntry > | |
QgsSourceCacheEntry * | findExistingEntry (QgsSourceCacheEntry *entryTemplate) |
Returns the existing entry from the cache which matches entryTemplate (deleting entryTemplate when done), or if no existing entry is found then entryTemplate is transferred to the cache and returned. | |
QByteArray | getContent (const QString &path, const QByteArray &missingContent, const QByteArray &fetchingContent, bool blocking=false) const |
Gets the file content corresponding to the given path. | |
void | onRemoteContentFetched (const QString &url, bool success) override |
Triggered after remote content (i.e. | |
void | trimToMaximumSize () |
Removes the least used cache entries until the maximum cache size is under the predefined size limit. | |
bool | waitForTaskFinished (QgsNetworkContentFetcherTask *task) const |
Blocks the current thread until the task finishes (or user's preset network timeout expires) | |
Protected Member Functions inherited from QgsAbstractContentCacheBase | |
virtual bool | checkReply (QNetworkReply *reply, const QString &path) const |
Runs additional checks on a network reply to ensure that the reply content is consistent with that required by the cache. | |
Protected Attributes inherited from QgsAbstractContentCache< QgsSourceCacheEntry > | |
long | mMaxCacheSize |
Maximum cache size. | |
QRecursiveMutex | mMutex |
long | mTotalSize |
Estimated total size of all cached content. | |
A cache for source strings that returns a local file path containing the source content.
QgsSourceCache is not usually directly created, but rather accessed through QgsApplication::sourceCache().
Definition at line 72 of file qgssourcecache.h.
QgsSourceCache::QgsSourceCache | ( | QObject * | parent = nullptr | ) |
Constructor for QgsSourceCache, with the specified parent object.
Definition at line 58 of file qgssourcecache.cpp.
QString QgsSourceCache::localFilePath | ( | const QString & | path, |
bool | blocking = false |
||
) |
Returns a local file path reflecting the content of a specified source path.
path may be a local file, remote (HTTP) url, or a base 64 encoded string (with a "base64:" prefix).
Definition at line 66 of file qgssourcecache.cpp.
|
signal |
Emitted when the cache has finished retrieving a 3D model from a remote url.