summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/sync/sinkfactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kipi-plugins/sync/sinkfactory.cpp')
-rw-r--r--kipi-plugins/sync/sinkfactory.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/kipi-plugins/sync/sinkfactory.cpp b/kipi-plugins/sync/sinkfactory.cpp
new file mode 100644
index 0000000..bd34bcc
--- /dev/null
+++ b/kipi-plugins/sync/sinkfactory.cpp
@@ -0,0 +1,46 @@
+/* ============================================================
+ * File : sinkfactory.cpp
+ * Author: Colin Guthrie <kde@colin.guthr.ie>
+ * Date : 2007-01-22
+ *
+ * Copyright 2007 by Colin Guthrie <kde@colin.guthr.ie>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * ============================================================ */
+
+#include "sinkfactory.h"
+
+namespace KIPISyncPlugin
+{
+
+// Define the static stack variables
+SinkMap SinkFactory::mSinkProxies;
+
+// Define the register method
+bool SinkFactory::Register(QString type, SinkProxy* pSinkProxy)
+{
+ if (mSinkProxies.contains(type))
+ return false;
+
+ mSinkProxies[type] = pSinkProxy;
+ return true;
+}
+
+// The main creation method
+Sink* SinkFactory::Create(QString type, unsigned int sinkId, QString name, KConfig* pConfig, KWallet::Wallet* pWallet)
+{
+ if (!mSinkProxies.contains(type))
+ return NULL;
+
+ return (*(mSinkProxies[type]))(sinkId, name, pConfig, pWallet);
+}
+
+}