![]() |
LeechCraft
0.6.70-13729-g7046a9d2a7
Modular cross-platform feature rich live environment.
|
A standard QML QNetworkAccessManager factory. More...
#include "standardnamfactory.h"
Public Types | |
using | CacheSizeGetter_f = std::function< int()> |
The type of the function used to query the cache size by the factory. More... | |
Public Member Functions | |
StandardNAMFactory (const QString &subpath, CacheSizeGetter_f getter, QQmlEngine *engine=nullptr) | |
Constructs a new StandardNAMFactory. More... | |
QNetworkAccessManager * | create (QObject *parent) |
Creates the network access manager with the given parent. More... | |
A standard QML QNetworkAccessManager factory.
StandardNAMFactory allows easily creating QNetworkAccessManager instances in QML contexts.
The created managers are all using the same cache, located at the cache path passed and limited by the maximum size passed to the constructor.
Several different factories may be created sharing the same cache location. In this case, the minimum value of the cache size would be used as the maximum.
Definition at line 58 of file standardnamfactory.h.
using LC::Util::StandardNAMFactory::CacheSizeGetter_f = std::function<int ()> |
The type of the function used to query the cache size by the factory.
Definition at line 65 of file standardnamfactory.h.
LC::Util::StandardNAMFactory::StandardNAMFactory | ( | const QString & | subpath, |
CacheSizeGetter_f | getter, | ||
QQmlEngine * | engine = nullptr |
||
) |
Constructs a new StandardNAMFactory.
The cache uses a subdirectory subpath in the network directory of the user cache location.
[in] | subpath | The subpath in cache user location. |
[in] | getter | The function that would be queried during periodical cache garbage collection to fetch the current maximum cache size. |
[in] | engine | The QML engine where this factory should be installed, if not null. |
Definition at line 39 of file standardnamfactory.cpp.
QNetworkAccessManager * LC::Util::StandardNAMFactory::create | ( | QObject * | parent | ) |
Creates the network access manager with the given parent.
This function implements a pure virtual in Qt's base factory class (QDeclarativeNetworkAccessManagerFactory for Qt4 or QQmlNetworkAccessManagerFactory for Qt5).
The ownership of the returned QNetworkAccessManager is passed to the caller.
[in] | parent | The parent of the QNetworkAccessManager to be created. |
Definition at line 49 of file standardnamfactory.cpp.