Albert
Loading...
Searching...
No Matches
albert::util::WeakDependency< T > Class Template Referencefinal

#include <albert/plugindependency.h>

Inherits albert::util::Dependency< T >.

Detailed Description

template<class T>
class albert::util::WeakDependency< T >

Convenience holder class for plugin soft dependencies.

Watches for (de)registration of an extension id of type T. On (de)registration of the dependency the pointer is updated and the callback called.

If you use this class you may want to lock a mutex against a query handler or an action. This should not be necessary since the plugin loader and the extension registry must not be accessed while a session query is running. Take care though if you defer the execution of the action using a timer or similar.

Public Member Functions

 WeakDependency (const QString &id, std::function< void(bool)> on_registered={})
 Constructs a WeakDependency with id and callback on_registered.
 
 ~WeakDependency ()
 

Public Attributes

std::function< void(bool)> callback
 

Constructor & Destructor Documentation

◆ WeakDependency()

template<class T >
albert::util::WeakDependency< T >::WeakDependency ( const QString &  id,
std::function< void(bool)>  on_registered = {} 
)
inlineexplicit

Constructs a WeakDependency with id and callback on_registered.

◆ ~WeakDependency()

template<class T >
albert::util::WeakDependency< T >::~WeakDependency ( )
inline

Member Data Documentation

◆ callback

template<class T >
std::function<void(bool)> albert::util::WeakDependency< T >::callback

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