summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core
authoreilers <eilers>2003-08-01 12:30:16 (UTC)
committer eilers <eilers>2003-08-01 12:30:16 (UTC)
commit6c715b67a8f0e32a4edca5be91332622834c8d91 (patch) (side-by-side diff)
treeae2d660e1fd9c990c2d725c075ce6c42480b0af8 /libopie2/opiepim/core
parentcb45aa10043fdd6fddcab42ef0e07ddafc3d506d (diff)
downloadopie-6c715b67a8f0e32a4edca5be91332622834c8d91.zip
opie-6c715b67a8f0e32a4edca5be91332622834c8d91.tar.gz
opie-6c715b67a8f0e32a4edca5be91332622834c8d91.tar.bz2
Merging changes from BRANCH_1_0 to HEAD
Diffstat (limited to 'libopie2/opiepim/core') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/ocontactaccess.h11
-rw-r--r--libopie2/opiepim/core/oconversion.h5
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h4
-rw-r--r--libopie2/opiepim/core/opimcache.h6
-rw-r--r--libopie2/opiepim/core/opimxrefmanager.h2
-rw-r--r--libopie2/opiepim/core/otemplatebase.h7
6 files changed, 35 insertions, 0 deletions
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h
index e90db32..9b0a719 100644
--- a/libopie2/opiepim/core/ocontactaccess.h
+++ b/libopie2/opiepim/core/ocontactaccess.h
@@ -1,43 +1,51 @@
/*
* Class to manage the Contacts.
*
* Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
* Copyright (c) 2002 by Holger Freyther (zecke@handhelds.org)
*
* =====================================================================
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later
* version.
* =====================================================================
* ToDo: Define enum for query settings
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.9 2003/08/01 12:30:16 eilers
+ * Merging changes from BRANCH_1_0 to HEAD
+ *
+ * Revision 1.8.2.1 2003/06/30 14:34:19 eilers
+ * Patches from Zecke:
+ * Fixing and cleaning up extraMap handling
+ * Adding d_ptr for binary compatibility in the future
+ *
* Revision 1.8 2003/05/08 13:55:09 tille
* search stuff
* and match, toRichText & toShortText in oevent
*
* Revision 1.7 2003/04/13 18:07:10 zecke
* More API doc
* QString -> const QString&
* QString = 0l -> QString::null
*
* Revision 1.6 2003/01/02 14:27:12 eilers
* Improved query by example: Search by date is possible.. First step
* for a today plugin for birthdays..
*
* Revision 1.5 2002/11/13 14:14:51 eilers
* Added sorted for Contacts..
*
* Revision 1.4 2002/11/01 15:10:42 eilers
* Added regExp-search in database for all fields in a contact.
*
* Revision 1.3 2002/10/16 10:52:40 eilers
* Added some docu to the interface and now using the cache infrastucture by zecke.. :)
*
* Revision 1.2 2002/10/14 16:21:54 eilers
* Some minor interface updates
@@ -144,27 +152,30 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
* Save is more a "commit". After calling this function, all changes are public available.
* @return true if successful
*/
bool save();
signals:
/* Signal is emitted if the database was changed. Therefore
* we may need to reload to stay consistent.
* @param which Pointer to the database who created this event. This pointer
* is useful if an application has to handle multiple databases at the same time.
* @see reload()
*/
void signalChanged ( const OContactAccess *which );
private:
// class OContactAccessPrivate;
// OContactAccessPrivate* d;
OContactAccessBackend *m_backEnd;
bool m_loading:1;
private slots:
void copMessage( const QCString &msg, const QByteArray &data );
+ private:
+ class Private;
+ Private *d;
};
#endif
diff --git a/libopie2/opiepim/core/oconversion.h b/libopie2/opiepim/core/oconversion.h
index 13367e1..4c0a497 100644
--- a/libopie2/opiepim/core/oconversion.h
+++ b/libopie2/opiepim/core/oconversion.h
@@ -16,28 +16,33 @@
** not clear to you.
**********************************************************************/
#ifndef __oconversion_h__
#define __oconversion_h__
/* #include <time.h> */
/* #include <sys/types.h> */
#include <qdatetime.h>
/* FIXME namespace? -zecke */
class OConversion
{
public:
static QString dateToString( const QDate &d );
static QDate dateFromString( const QString &datestr );
/**
* simple function to store DateTime as string and read from string
* no timezone changing is done
* DDMMYYYYHHMMSS is the simple format
*/
static QString dateTimeToString( const QDateTime& );
static QDateTime dateTimeFromString( const QString& );
+
+private:
+ class Private;
+ Private* d;
+
};
#endif // __oconversion_h__
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index 8ff205c..ecbeb68 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -1,36 +1,37 @@
#ifndef OPIE_PIM_ACCESS_TEMPLATE_H
#define OPIE_PIM_ACCESS_TEMPLATE_H
#include <qarray.h>
#include <opie/opimrecord.h>
#include <opie/opimaccessbackend.h>
#include <opie/orecordlist.h>
#include "opimcache.h"
#include "otemplatebase.h"
+class OPimAccessTemplatePrivate;
/**
* Thats the frontend to our OPIE PIM
* Library. Either you want to use it's
* interface or you want to implement
* your own Access lib
* Just create a OPimRecord and inherit from
* the plugins
*/
template <class T = OPimRecord >
class OPimAccessTemplate : public OTemplateBase<T> {
public:
enum Access {
Random = 0,
SortedAccess
};
typedef ORecordList<T> List;
typedef OPimAccessBackend<T> BackEnd;
typedef OPimCache<T> Cache;
/**
* c'tor BackEnd
* enum Access a small hint on how to handle the backend
*/
@@ -131,48 +132,51 @@ public:
virtual bool replace( const T& t) ;
void setReadAhead( uint count );
/**
* @internal
*/
void cache( const T& )const;
void setSaneCacheSize( int );
QArray<int> records()const;
protected:
/**
* invalidate the cache
*/
void invalidateCache();
void setBackEnd( BackEnd* end );
/**
* returns the backend
*/
BackEnd* backEnd();
BackEnd* m_backEnd;
Cache m_cache;
+private:
+ OPimAccessTemplatePrivate *d;
+
};
template <class T>
OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end )
: OTemplateBase<T>(), m_backEnd( end )
{
if (end )
end->setFrontend( this );
}
template <class T>
OPimAccessTemplate<T>::~OPimAccessTemplate() {
qWarning("~OPimAccessTemplate<T>");
delete m_backEnd;
}
template <class T>
bool OPimAccessTemplate<T>::load() {
invalidateCache();
return m_backEnd->load();
}
template <class T>
bool OPimAccessTemplate<T>::reload() {
invalidateCache(); // zecke: I think this should be added (se)
return m_backEnd->reload();
}
diff --git a/libopie2/opiepim/core/opimcache.h b/libopie2/opiepim/core/opimcache.h
index 73414e5..7f7cff5 100644
--- a/libopie2/opiepim/core/opimcache.h
+++ b/libopie2/opiepim/core/opimcache.h
@@ -1,72 +1,78 @@
#ifndef OPIE_PIM_CACHE_H
#define OPIE_PIM_CACHE_H
#include <qintcache.h>
#include "opimrecord.h"
+class OPimCacheItemPrivate;
+
template <class T = OPimRecord>
class OPimCacheItem {
public:
OPimCacheItem( const T& t = T() );
OPimCacheItem( const OPimCacheItem& );
~OPimCacheItem();
OPimCacheItem &operator=( const OPimCacheItem& );
T record()const;
void setRecord( const T& );
private:
T m_t;
+ OPimCacheItemPrivate *d;
};
+
+class OPimCachePrivate;
/**
* OPimCache for caching the items
* We support adding, removing
* and finding
*/
template <class T = OPimRecord>
class OPimCache {
public:
typedef OPimCacheItem<T> Item;
OPimCache();
OPimCache( const OPimCache& );
~OPimCache();
OPimCache &operator=( const OPimCache& );
bool contains(int uid)const;
void invalidate();
void setSize( int size );
T find(int uid )const;
void add( const T& );
void remove( int uid );
void replace( const T& );
private:
QIntCache<Item> m_cache;
+ OPimCachePrivate* d;
};
// Implementation
template <class T>
OPimCacheItem<T>::OPimCacheItem( const T& t )
: m_t(t) {
}
template <class T>
OPimCacheItem<T>::~OPimCacheItem() {
}
template <class T>
T OPimCacheItem<T>::record()const {
return m_t;
}
template <class T>
void OPimCacheItem<T>::setRecord( const T& t ) {
m_t = t;
}
// Cache
template <class T>
OPimCache<T>::OPimCache()
: m_cache(100, 53 )
{
diff --git a/libopie2/opiepim/core/opimxrefmanager.h b/libopie2/opiepim/core/opimxrefmanager.h
index 39e5eef..c485e98 100644
--- a/libopie2/opiepim/core/opimxrefmanager.h
+++ b/libopie2/opiepim/core/opimxrefmanager.h
@@ -15,27 +15,29 @@ class OPimXRefManager {
public:
OPimXRefManager();
OPimXRefManager( const OPimXRefManager& );
~OPimXRefManager();
OPimXRefManager& operator=( const OPimXRefManager& );
bool operator==( const OPimXRefManager& );
void add( const OPimXRef& );
void remove( const OPimXRef& );
void replace( const OPimXRef& );
void clear();
/**
* apps participating
*/
QStringList apps()const;
OPimXRef::ValueList list()const;
OPimXRef::ValueList list( const QString& service )const;
OPimXRef::ValueList list( int uid )const;
private:
OPimXRef::ValueList m_list;
+ class Private;
+ Private *d;
};
#endif
diff --git a/libopie2/opiepim/core/otemplatebase.h b/libopie2/opiepim/core/otemplatebase.h
index 29fb6ec..cadac74 100644
--- a/libopie2/opiepim/core/otemplatebase.h
+++ b/libopie2/opiepim/core/otemplatebase.h
@@ -1,87 +1,94 @@
#ifndef OPIE_TEMPLATE_BASE_H
#define OPIE_TEMPLATE_BASE_H
#include <qarray.h>
#include <opie/opimrecord.h>
/**
* Templates do not have a base class, This is why
* we've this class
* this is here to give us the possibility
* to have a common base class
* You may not want to use that interface internaly
* POOR mans interface
*/
+class OPimBasePrivate;
struct OPimBase {
/**
* return the rtti
*/
virtual int rtti()= 0;
virtual OPimRecord* record()const = 0;
virtual OPimRecord* record(int uid)const = 0;
virtual bool add( const OPimRecord& ) = 0;
virtual bool remove( int uid ) = 0;
virtual bool remove( const OPimRecord& ) = 0;
virtual void clear() = 0;
virtual bool load() = 0;
virtual bool save() = 0;
virtual QArray<int> records()const = 0;
/*
* ADD editing here?
* -zecke
*/
+private:
+ OPimBasePrivate* d;
};
/**
* internal template base
* T needs to implement the copy c'tor!!!
*/
+class OTemplateBasePrivate;
template <class T = OPimRecord>
class OTemplateBase : public OPimBase {
public:
enum CacheDirection { Forward=0, Reverse };
OTemplateBase() {
};
virtual ~OTemplateBase() {
}
virtual T find( int uid )const = 0;
/**
* read ahead find
*/
virtual T find( int uid, const QArray<int>& items,
uint current, CacheDirection dir = Forward )const = 0;
virtual void cache( const T& )const = 0;
virtual void setSaneCacheSize( int ) = 0;
/* reimplement of OPimBase */
int rtti();
OPimRecord* record()const;
OPimRecord* record(int uid )const;
static T* rec();
+
+private:
+ OTemplateBasePrivate *d;
};
/*
* implementation
*/
template <class T>
int
OTemplateBase<T>::rtti() {
return T::rtti();
}
template <class T>
OPimRecord* OTemplateBase<T>::record()const {
T* t = new T;
return t;
}
template <class T>
OPimRecord* OTemplateBase<T>::record(int uid )const {
T t2 = find(uid );
T* t1 = new T(t2);
return t1;
};
template <class T>
T* OTemplateBase<T>::rec() {