summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/obackendfactory.h
Unidiff
Diffstat (limited to 'libopie2/opiepim/backend/obackendfactory.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/obackendfactory.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/libopie2/opiepim/backend/obackendfactory.h b/libopie2/opiepim/backend/obackendfactory.h
index 3a73210..ad6cf5a 100644
--- a/libopie2/opiepim/backend/obackendfactory.h
+++ b/libopie2/opiepim/backend/obackendfactory.h
@@ -13,12 +13,17 @@
13 * ToDo: Use plugins 13 * ToDo: Use plugins
14 * ===================================================================== 14 * =====================================================================
15 * Version: $Id$ 15 * Version: $Id$
16 * ===================================================================== 16 * =====================================================================
17 * History: 17 * History:
18 * $Log$ 18 * $Log$
19 * Revision 1.6 2003/04/13 18:07:10 zecke
20 * More API doc
21 * QString -> const QString&
22 * QString = 0l -> QString::null
23 *
19 * Revision 1.5 2003/02/21 23:31:52 zecke 24 * Revision 1.5 2003/02/21 23:31:52 zecke
20 * Add XML datebookresource 25 * Add XML datebookresource
21 * -clean up todoaccessxml header 26 * -clean up todoaccessxml header
22 * -implement some more stuff in the oeven tester 27 * -implement some more stuff in the oeven tester
23 * -extend DefaultFactory to not crash and to use datebook 28 * -extend DefaultFactory to not crash and to use datebook
24 * 29 *
@@ -60,25 +65,44 @@
60#include "odatebookaccessbackend_xml.h" 65#include "odatebookaccessbackend_xml.h"
61 66
62#ifdef __USE_SQL 67#ifdef __USE_SQL
63#include "otodoaccesssql.h" 68#include "otodoaccesssql.h"
64#endif 69#endif
65 70
66 71/**
72 * This class is our factory. It will give us the default implementations
73 * of at least Todolist, Contacts and Datebook. In the future this class will
74 * allow users to switch the backend with ( XML->SQLite ) without the need
75 * to recompile.#
76 * This class as the whole PIM Api is making use of templates
77 *
78 * <pre>
79 * OTodoAccessBackend* backend = OBackEndFactory<OTodoAccessBackend>::Default("todo", QString::null );
80 * backend->load();
81 * </pre>
82 *
83 * @author Stefan Eilers
84 * @version 0.1
85 */
67template<class T> 86template<class T>
68class OBackendFactory 87class OBackendFactory
69{ 88{
70 public: 89 public:
71 OBackendFactory() {}; 90 OBackendFactory() {};
72 91
73 enum BACKENDS { 92 enum BACKENDS {
74 TODO, 93 TODO,
75 CONTACT, 94 CONTACT,
76 DATE 95 DATE
77 }; 96 };
78 97
98 /**
99 * Returns a backend implementation for backendName
100 * @param backendName the type of the backend
101 * @param appName will be passed on to the backend
102 */
79 static T* Default( const QString backendName, const QString& appName ){ 103 static T* Default( const QString backendName, const QString& appName ){
80 104
81 // __asm__("int3"); 105 // __asm__("int3");
82 106
83 Config config( "pimaccess" ); 107 Config config( "pimaccess" );
84 config.setGroup ( backendName ); 108 config.setGroup ( backendName );