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) (side-by-side diff)
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
@@ -39,112 +39,112 @@
#include <qpe/config.h>
#include <opie2/otodoaccessxml.h>
#include <opie2/ocontactaccessbackend_xml.h>
#include <opie2/odatebookaccessbackend_xml.h>
#ifdef __USE_SQL
#include <opie2/otodoaccesssql.h>
#include <opie2/ocontactaccessbackend_sql.h>
#include <opie2/odatebookaccessbackend_sql.h>
#endif
namespace Opie {
class OBackendPrivate;
/**
* This class is our factory. It will give us the default implementations
* of at least Todolist, Contacts and Datebook. In the future this class will
* allow users to switch the backend with ( XML->SQLite ) without the need
* to recompile.#
* This class as the whole PIM Api is making use of templates
*
* <pre>
- * OTodoAccessBackend* backend = OBackEndFactory<OTodoAccessBackend>::Default("todo", QString::null );
+ * OPimTodoAccessBackend* backend = OBackEndFactory<OPimTodoAccessBackend>::Default("todo", QString::null );
* backend->load();
* </pre>
*
* @author Stefan Eilers
* @version 0.1
*/
template<class T>
class OBackendFactory
{
public:
OBackendFactory() {};
enum BACKENDS {
TODO,
CONTACT,
DATE
};
/**
* Returns a backend implementation for backendName
* @param backendName the type of the backend
* @param appName will be passed on to the backend
*/
static T* Default( const QString backendName, const QString& appName ){
// __asm__("int3");
Config config( "pimaccess" );
config.setGroup ( backendName );
QString backend = config.readEntry( "usebackend" );
qWarning("Selected backend for %s is: %s", backendName.latin1(), backend.latin1() );
QAsciiDict<int> dict ( 3 );
dict.setAutoDelete ( TRUE );
dict.insert( "todo", new int (TODO) );
dict.insert( "contact", new int (CONTACT) );
dict.insert( "datebook", new int(DATE) );
int *find = dict[ backendName ];
if (!find ) return 0;
switch ( *find ){
case TODO:
#ifdef __USE_SQL
if ( backend == "sql" )
- return (T*) new OTodoAccessBackendSQL("");
+ return (T*) new OPimTodoAccessBackendSQL("");
#else
if ( backend == "sql" )
qWarning ("OBackendFactory:: sql Backend for TODO not implemented! Using XML instead!");
#endif
- return (T*) new OTodoAccessXML( appName );
+ return (T*) new OPimTodoAccessXML( appName );
case CONTACT:
#ifdef __USE_SQL
if ( backend == "sql" )
- return (T*) new OContactAccessBackend_SQL("");
+ return (T*) new OPimContactAccessBackend_SQL("");
#else
if ( backend == "sql" )
qWarning ("OBackendFactory:: sql Backend for CONTACT not implemented! Using XML instead!");
#endif
- return (T*) new OContactAccessBackend_XML( appName );
+ return (T*) new OPimContactAccessBackend_XML( appName );
case DATE:
#ifdef __USE_SQL
if ( backend == "sql" )
return (T*) new ODateBookAccessBackend_SQL("");
#else
if ( backend == "sql" )
qWarning("OBackendFactory:: sql Backend for DATEBOOK not implemented! Using XML instead!");
#endif
return (T*) new ODateBookAccessBackend_XML( appName );
default:
return NULL;
}
}
private:
OBackendPrivate* d;
};
}
#endif