[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdepim/kpilot
From:       Adriaan de Groot <groot () kde ! org>
Date:       2005-04-11 23:21:24
Message-ID: 20050411232124.1A18C633 () office ! kde ! org
[Download RAW message or body]

CVS commit by adridg: 

Template madness, mostly


  M +3 -0      ChangeLog   1.253
  M +2 -10     lib/pilotAddress.h   1.15
  M +1 -0      lib/pilotAppCategory.h   1.26
  M +23 -0     lib/pilotDatabase.h   1.25
  M +3 -9      lib/pilotDateEntry.h   1.20
  M +1 -11     lib/pilotMemo.cc   1.25
  M +2 -8      lib/pilotMemo.h   1.14
  M +3 -4      lib/pilotTodoEntry.h   1.17


--- kdepim/kpilot/ChangeLog  #1.252:1.253
@@ -2,4 +2,7 @@
 ======================
 
+2005-04-12  Adriaan de Groot
+* For a lark, and for David, re-added some KDE 3.2 compatibility code.
+* Template madness! An easy way to create the right appinfo's from any database.
 
 2005-04-11  Adriaan de Groot

--- kdepim/kpilot/lib/pilotAddress.h  #1.14:1.15
@@ -30,18 +30,9 @@
 */
 
-#include <time.h>
-#include <string.h>
-
-#ifndef _PILOT_MACROS_H_
 #include <pi-macros.h>
-#endif
-
-#ifndef _PILOT_ADDRESS_H_
 #include <pi-address.h>
-#endif
 
-#ifndef _KPILOT_PILOTAPPCATEGORY_H
 #include "pilotAppCategory.h"
-#endif
+#include "pilotDatabase.h"
 
 /** @brief A wrapper class around the Address struct provided by pi-address.h
@@ -191,4 +182,5 @@ private:
 
 
+typedef PilotAppInfo<AddressAppInfo,unpack_AddressAppInfo> PilotAddressInfo;
 
 

--- kdepim/kpilot/lib/pilotDatabase.h  #1.24:1.25
@@ -191,3 +191,26 @@ private:
 };
 
+template <typename appinfo, int(*f)(appinfo *, unsigned char *, int)>
+class PilotAppInfo
+{
+public:
+        PilotAppInfo(PilotDatabase *d)
+        {
+                FUNCTIONSETUP;
+                int appLen = 8192;
+                unsigned char buffer[8192];
+
+                appLen = d->readAppBlock(buffer,appLen);
+
+                (*f)(&fInfo, buffer, appLen);
+        } ;
+
+        struct CategoryAppInfo *categoryInfo() { return &fInfo.category; } ;
+        appinfo *info() { return &fInfo; } ;
+
+protected:
+        appinfo fInfo;
+} ;
+
+
 #endif

--- kdepim/kpilot/lib/pilotDateEntry.h  #1.19:1.20
@@ -30,7 +30,4 @@
 */
 
-#include <time.h>
-#include <string.h>
-
 #include <qbitarray.h>
 
@@ -39,6 +36,5 @@
 
 #include "pilotAppCategory.h"
-#include "pilotRecord.h"
-
+#include "pilotDatabase.h"
 
 
@@ -144,8 +140,6 @@ private:
 
 
+typedef PilotAppInfo<AppointmentAppInfo,unpack_AppointmentAppInfo> PilotDateInfo;
 
-#else
-#ifdef DEBUG
-#warning "File doubly included"
-#endif
 #endif
+

--- kdepim/kpilot/lib/pilotMemo.cc  #1.24:1.25
@@ -146,12 +146,2 @@ QString PilotMemo::sensibleTitle() const
 }
 
-PilotMemoInfo::PilotMemoInfo(PilotDatabase *d)
-{
-        FUNCTIONSETUP;
-        int appLen = 8192;
-        unsigned char buffer[8192];
-
-        appLen = d->readAppBlock(buffer,appLen);
-
-        unpack_MemoAppInfo(&fInfo, buffer, appLen);
-}

--- kdepim/kpilot/lib/pilotMemo.h  #1.13:1.14
@@ -34,6 +34,6 @@
 
 #include "pilotAppCategory.h"
+#include "pilotDatabase.h"
 
-class PilotDatabase;
 
 class KDE_EXPORT PilotMemo : public PilotAppCategory
@@ -78,11 +78,5 @@ private:
 };
 
-class KDE_EXPORT PilotMemoInfo
-{
-public:
-        PilotMemoInfo(PilotDatabase *);
-protected:
-        struct MemoAppInfo fInfo;
-};
+typedef PilotAppInfo<MemoAppInfo,unpack_MemoAppInfo> PilotMemoInfo;
 
 #endif

--- kdepim/kpilot/lib/pilotTodoEntry.h  #1.16:1.17
@@ -39,4 +39,5 @@
 
 #include "pilotAppCategory.h"
+#include "pilotDatabase.h"
 
 
@@ -99,9 +100,7 @@ private:
 };
 
+typedef PilotAppInfo<ToDoAppInfo,unpack_ToDoAppInfo> PilotToDoInfo;
 
 
-#else
-#ifdef DEBUG
-#warning "File doubly included"
-#endif
 #endif
+


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic