6#include <albert/export.h>
40 std::map<QString, T*> results;
41 for (
auto &[
id, extension] : extensions_)
42 if (T *t =
dynamic_cast<T*
>(extension))
43 results.emplace(
id, t);
48 template<
typename T> T*
extension(
const QString &
id)
51 return dynamic_cast<T*
>(extensions_.at(
id));
52 }
catch (
const std::out_of_range &) {
67 std::map<QString,Extension*> extensions_;
The common extension pool.
Definition extensionregistry.h:23
void removed(Extension *)
Emitted when an extension has been deregistered.
bool registerExtension(Extension *)
Add extension to the registry.
void deregisterExtension(Extension *)
Remove extension from the registry.
void added(Extension *)
Emitted when an extension has been registered.
T * extension(const QString &id)
Get extension by id implicitly dynamic_cast'ed to type T.
Definition extensionregistry.h:48
const std::map< QString, Extension * > & extensions()
Get map of all registered extensions.
std::map< QString, T * > extensions()
Get map of all extensions of type T.
Definition extensionregistry.h:38
Abstract extension class.
Definition extension.h:19