summaryrefslogtreecommitdiff
path: root/libsowatch/registry.h
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-10-16 04:42:30 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-10-16 04:42:30 +0200
commit4da9bced6a27b92d49b9fc9392946510b8519d82 (patch)
tree7a2417a932a6463e3e6f6ec4d3799e24de917306 /libsowatch/registry.h
parentbde4bde8ec9d6d09874d5ae9e0ba6dc9431859b6 (diff)
downloadsowatch-4da9bced6a27b92d49b9fc9392946510b8519d82.tar.gz
sowatch-4da9bced6a27b92d49b9fc9392946510b8519d82.zip
Initial implementation of weather
Diffstat (limited to 'libsowatch/registry.h')
-rw-r--r--libsowatch/registry.h50
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