QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Signals | Public Member Functions | List of all members
QgsSourceCache Class Reference

A cache for source strings that returns a local file path containing the source content. More...

#include <qgssourcecache.h>

Inheritance diagram for QgsSourceCache:
Inheritance graph
[legend]

Signals

void remoteSourceFetched (const QString &url)
 Emitted when the cache has finished retrieving a 3D model from a remote url. More...
 
- Signals inherited from QgsAbstractContentCacheBase
void remoteContentFetched (const QString &url)
 Emitted when the cache has finished retrieving content from a remote url. More...
 

Public Member Functions

 QgsSourceCache (QObject *parent=nullptr)
 Constructor for QgsSourceCache, with the specified parent object. More...
 
QString localFilePath (const QString &path, bool blocking=false)
 Returns a local file path reflecting the content of a specified source path. More...
 
- 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. More...
 
 ~QgsAbstractContentCache () override
 
- Public Member Functions inherited from QgsAbstractContentCacheBase
 QgsAbstractContentCacheBase (QObject *parent)
 Constructor for QgsAbstractContentCacheBase, with the specified parent object. More...
 

Additional Inherited Members

- Protected Slots inherited from QgsAbstractContentCacheBase
virtual void onRemoteContentFetched (const QString &url, bool success)
 Triggered after remote content (i.e. More...
 
- 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. More...
 
QByteArray getContent (const QString &path, const QByteArray &missingContent, const QByteArray &fetchingContent, bool blocking=false) const
 Gets the file content corresponding to the given path. More...
 
void onRemoteContentFetched (const QString &url, bool success) override
 Triggered after remote content (i.e. More...
 
void trimToMaximumSize ()
 Removes the least used cache entries until the maximum cache size is under the predefined size limit. More...
 
bool waitForTaskFinished (QgsNetworkContentFetcherTask *task) const
 Blocks the current thread until the task finishes (or user's preset network timeout expires) More...
 
- 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. More...
 
- Protected Attributes inherited from QgsAbstractContentCache< QgsSourceCacheEntry >
long mMaxCacheSize
 Maximum cache size. More...
 
QRecursiveMutex mMutex
 
long mTotalSize
 Estimated total size of all cached content. More...
 

Detailed Description

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().

Since
QGIS 3.16

Definition at line 72 of file qgssourcecache.h.

Constructor & Destructor Documentation

◆ QgsSourceCache()

QgsSourceCache::QgsSourceCache ( QObject *  parent = nullptr)

Constructor for QgsSourceCache, with the specified parent object.

Definition at line 56 of file qgssourcecache.cpp.

Member Function Documentation

◆ localFilePath()

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 64 of file qgssourcecache.cpp.

◆ remoteSourceFetched

void QgsSourceCache::remoteSourceFetched ( const QString &  url)
signal

Emitted when the cache has finished retrieving a 3D model from a remote url.


The documentation for this class was generated from the following files: