38 if ( mProviders.contains( provider->
id() ) )
40 QgsLogger::warning( QStringLiteral(
"Duplicate provider %1 registered" ).arg( provider->
id() ) );
45 if ( !provider->
load() )
52 provider->setParent(
this );
53 mProviders[ provider->
id()] = provider;
63 QString
id = provider->
id();
65 if ( !mProviders.contains(
id ) )
70 delete mProviders.take(
id );
83 return mProviders.value(
id,
nullptr );
88 QList< const QgsProcessingAlgorithm * > algs;
89 QMap<QString, QgsProcessingProvider *>::const_iterator it = mProviders.constBegin();
90 for ( ; it != mProviders.constEnd(); ++it )
92 algs.append( it.value()->algorithms() );
99 QMap<QString, QgsProcessingProvider *>::const_iterator it = mProviders.constBegin();
100 for ( ; it != mProviders.constEnd(); ++it )
103 if ( alg->
id() == id )
110 if (
id.startsWith( QStringLiteral(
"qgis:" ) ) )
112 QString newId = QStringLiteral(
"native:" ) +
id.mid( 5 );
124 std::unique_ptr< QgsProcessingAlgorithm > creation( alg->
create( configuration ) );
125 return creation.release();
bool removeProvider(QgsProcessingProvider *provider)
Removes a provider implementation from the registry (the provider object is deleted).
QString id() const
Returns the unique ID for the algorithm, which is a combination of the algorithm provider's ID and th...
void providerAdded(const QString &id)
Emitted when a provider has been added to the registry.
~QgsProcessingRegistry() override
QgsProcessingAlgorithm * create(const QVariantMap &configuration=QVariantMap()) const
Creates a copy of the algorithm, ready for execution.
static void warning(const QString &msg)
Goes to qWarning.
Abstract base class for processing providers.
const QgsProcessingAlgorithm * algorithmById(const QString &id) const
Finds an algorithm by its ID.
Abstract base class for processing algorithms.
QgsProcessingProvider * providerById(const QString &id)
Returns a matching provider by provider ID.
void providerRemoved(const QString &id)
Emitted when a provider is removed from the registry.
QList< const QgsProcessingAlgorithm * > algorithms() const
Returns a list of all available algorithms from registered providers.
virtual QString id() const =0
Returns the unique provider id, used for identifying the provider.
QgsProcessingRegistry(QObject *parent=nullptr)
Constructor for QgsProcessingRegistry.
virtual bool load()
Loads the provider.
QgsProcessingAlgorithm * createAlgorithmById(const QString &id, const QVariantMap &configuration=QVariantMap()) const
Creates a new instance of an algorithm by its ID.
bool addProvider(QgsProcessingProvider *provider)
Add a processing provider to the registry.
virtual void unload()
Unloads the provider.