diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2011-10-16 04:42:30 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2011-10-16 04:42:30 +0200 |
commit | 4da9bced6a27b92d49b9fc9392946510b8519d82 (patch) | |
tree | 7a2417a932a6463e3e6f6ec4d3799e24de917306 /libsowatch/registry.h | |
parent | bde4bde8ec9d6d09874d5ae9e0ba6dc9431859b6 (diff) | |
download | sowatch-4da9bced6a27b92d49b9fc9392946510b8519d82.tar.gz sowatch-4da9bced6a27b92d49b9fc9392946510b8519d82.zip |
Initial implementation of weather
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 |