summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/obackendfactory.h
authormickeyl <mickeyl>2004-02-24 12:46:23 (UTC)
committer mickeyl <mickeyl>2004-02-24 12:46:23 (UTC)
commit911473db35a9fce5f3589f03c27210456faaba86 (patch) (unidiff)
tree7d55b6117b24de6ab18747b00a4641d38001c0ed /libopie2/opiepim/backend/obackendfactory.h
parenta2ead23c3614fe581261455cb4c3f31cee2098f3 (diff)
downloadopie-911473db35a9fce5f3589f03c27210456faaba86.zip
opie-911473db35a9fce5f3589f03c27210456faaba86.tar.gz
opie-911473db35a9fce5f3589f03c27210456faaba86.tar.bz2
*phew* here is the class and file rename patch. not converted yet: backend,
but that will be not visible to application classes so we can change it later.
Diffstat (limited to 'libopie2/opiepim/backend/obackendfactory.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/obackendfactory.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/libopie2/opiepim/backend/obackendfactory.h b/libopie2/opiepim/backend/obackendfactory.h
index 346e2f5..06421d1 100644
--- a/libopie2/opiepim/backend/obackendfactory.h
+++ b/libopie2/opiepim/backend/obackendfactory.h
@@ -51,25 +51,25 @@
51namespace Opie { 51namespace Opie {
52 52
53class OBackendPrivate; 53class OBackendPrivate;
54 54
55/** 55/**
56 * This class is our factory. It will give us the default implementations 56 * This class is our factory. It will give us the default implementations
57 * of at least Todolist, Contacts and Datebook. In the future this class will 57 * of at least Todolist, Contacts and Datebook. In the future this class will
58 * allow users to switch the backend with ( XML->SQLite ) without the need 58 * allow users to switch the backend with ( XML->SQLite ) without the need
59 * to recompile.# 59 * to recompile.#
60 * This class as the whole PIM Api is making use of templates 60 * This class as the whole PIM Api is making use of templates
61 * 61 *
62 * <pre> 62 * <pre>
63 * OTodoAccessBackend* backend = OBackEndFactory<OTodoAccessBackend>::Default("todo", QString::null ); 63 * OPimTodoAccessBackend* backend = OBackEndFactory<OPimTodoAccessBackend>::Default("todo", QString::null );
64 * backend->load(); 64 * backend->load();
65 * </pre> 65 * </pre>
66 * 66 *
67 * @author Stefan Eilers 67 * @author Stefan Eilers
68 * @version 0.1 68 * @version 0.1
69 */ 69 */
70template<class T> 70template<class T>
71class OBackendFactory 71class OBackendFactory
72{ 72{
73 public: 73 public:
74 OBackendFactory() {}; 74 OBackendFactory() {};
75 75
@@ -99,41 +99,41 @@ class OBackendFactory
99 99
100 dict.insert( "todo", new int (TODO) ); 100 dict.insert( "todo", new int (TODO) );
101 dict.insert( "contact", new int (CONTACT) ); 101 dict.insert( "contact", new int (CONTACT) );
102 dict.insert( "datebook", new int(DATE) ); 102 dict.insert( "datebook", new int(DATE) );
103 103
104 int *find = dict[ backendName ]; 104 int *find = dict[ backendName ];
105 if (!find ) return 0; 105 if (!find ) return 0;
106 106
107 switch ( *find ){ 107 switch ( *find ){
108 case TODO: 108 case TODO:
109#ifdef __USE_SQL 109#ifdef __USE_SQL
110 if ( backend == "sql" ) 110 if ( backend == "sql" )
111 return (T*) new OTodoAccessBackendSQL(""); 111 return (T*) new OPimTodoAccessBackendSQL("");
112#else 112#else
113 if ( backend == "sql" ) 113 if ( backend == "sql" )
114 qWarning ("OBackendFactory:: sql Backend for TODO not implemented! Using XML instead!"); 114 qWarning ("OBackendFactory:: sql Backend for TODO not implemented! Using XML instead!");
115#endif 115#endif
116 116
117 return (T*) new OTodoAccessXML( appName ); 117 return (T*) new OPimTodoAccessXML( appName );
118 case CONTACT: 118 case CONTACT:
119#ifdef __USE_SQL 119#ifdef __USE_SQL
120 if ( backend == "sql" ) 120 if ( backend == "sql" )
121 return (T*) new OContactAccessBackend_SQL(""); 121 return (T*) new OPimContactAccessBackend_SQL("");
122#else 122#else
123 if ( backend == "sql" ) 123 if ( backend == "sql" )
124 qWarning ("OBackendFactory:: sql Backend for CONTACT not implemented! Using XML instead!"); 124 qWarning ("OBackendFactory:: sql Backend for CONTACT not implemented! Using XML instead!");
125#endif 125#endif
126 126
127 return (T*) new OContactAccessBackend_XML( appName ); 127 return (T*) new OPimContactAccessBackend_XML( appName );
128 case DATE: 128 case DATE:
129#ifdef __USE_SQL 129#ifdef __USE_SQL
130 if ( backend == "sql" ) 130 if ( backend == "sql" )
131 return (T*) new ODateBookAccessBackend_SQL(""); 131 return (T*) new ODateBookAccessBackend_SQL("");
132#else 132#else
133 if ( backend == "sql" ) 133 if ( backend == "sql" )
134 qWarning("OBackendFactory:: sql Backend for DATEBOOK not implemented! Using XML instead!"); 134 qWarning("OBackendFactory:: sql Backend for DATEBOOK not implemented! Using XML instead!");
135#endif 135#endif
136 136
137 return (T*) new ODateBookAccessBackend_XML( appName ); 137 return (T*) new ODateBookAccessBackend_XML( appName );
138 default: 138 default:
139 return NULL; 139 return NULL;