[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kdepim-3.5.5+/kpilot/lib
From: Adriaan de Groot <groot () kde ! org>
Date: 2007-04-01 21:22:47
Message-ID: 1175462567.168144.12362.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 649011 by adridg:
Unbearably cute shared administration of CUD on databases duri9ng conduit runs, for sanity checking.
M +27 -0 branches/work/kdepim-3.5.5+/kpilot/lib/plugin.cc
M +36 -4 branches/work/kdepim-3.5.5+/kpilot/lib/plugin.h
--- branches/work/kdepim-3.5.5+/kpilot/lib/plugin.cc #649010:649011
@@ -636,3 +636,30 @@
}
+ConduitAction::CUD::CUD() :
+ fC(0),fU(0),fD(0)
+{
+}
+
+void ConduitAction::CUD::create(unsigned int c)
+{
+ fC += c;
+}
+
+void ConduitAction::CUD::update(unsigned int c)
+{
+ fU += c;
+}
+
+void ConduitAction::CUD::destroy(unsigned int c)
+{
+ fD += c;
+}
+
+
+QString ConduitAction::CUD::moo() const
+{
+ return CSL1("CUD: %1/%2/%3").arg(fC).arg(fU).arg(fD);
+}
+
+
--- branches/work/kdepim-3.5.5+/kpilot/lib/plugin.h #649010:649011
@@ -267,14 +267,46 @@
*/
bool openDatabases(const QString &dbName, bool*retrieved=0L);
+ /**
+ * Name of the conduit; might be changed by subclasses. Should
+ * normally be set in the constructor.
+ */
+ QString fConduitName;
+
+
+ /**
+ * Copy-update-destroy administration of the plugin,
+ * used for reporting purposes (in a consistent manner).
+ */
+ class CUD
+ {
+ public:
+ /** Create new counter initialized to 0 */
+ CUD();
+
+ /** Tally the creation of @p c items */
+ void create(unsigned int c=1);
+ /** Tally updates to @p c items */
+ void update(unsigned int u=1);
+ /** Tally the destruction of @p c items */
+ void destroy(unsigned int d=1);
+
+ /** Measurement Of Objects -- report numbers of
+ * objects created, updated, destroyed. This
+ * string is already i18n()ed.
+ */
+ QString moo() const;
+ private:
+ unsigned int fC,fU,fD;
+ } ;
+
+ /** Every plugin has a CUD counter for administrative purposes. */
+ CUD fCownter;
+
private:
SyncMode fSyncDirection;
ConflictResolution fConflictResolution;
- // Make these only protected so the conduit can change the variable
-protected:
- QString fConduitName;
-private:
bool fFirstSync;
} ;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic