diff options
Diffstat (limited to 'libsowatch/registry.h')
-rw-r--r-- | libsowatch/registry.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/libsowatch/registry.h b/libsowatch/registry.h new file mode 100644 index 0000000..ca7252a --- /dev/null +++ b/libsowatch/registry.h @@ -0,0 +1,50 @@ +#ifndef SOWATCH_REGISTRY_H +#define SOWATCH_REGISTRY_H + +#include <QtCore/QString> +#include <QtCore/QMap> +#include "sowatch_global.h" + +namespace sowatch +{ + +class WatchPluginInterface; +class NotificationPluginInterface; +class WatchletPluginInterface; + +class SOWATCH_EXPORT Registry +{ +public: + static Registry* registry(); + + inline WatchPluginInterface* getWatchPlugin(const QString& id) { + return _drivers.value(id, 0); + } + + inline NotificationPluginInterface* getNotificationPlugin(const QString& id) { + return _providers.value(id, 0); + } + + inline WatchletPluginInterface* getWatchletPlugin(const QString& id) { + return _watchlets.value(id, 0); + } + +protected: + Registry(); + ~Registry(); + +private: + static Registry* singleRegistry; + + QMap<QString, WatchPluginInterface*> _drivers; + QMap<QString, NotificationPluginInterface*> _providers; + QMap<QString, WatchletPluginInterface*> _watchlets; + + void loadDrivers(); + void loadNotificationProviders(); + void loadWatchlets(); +}; + +} + +#endif // SOWATCH_REGISTRY_H |