r19957 - gnucash/trunk/src/engine - Add debug helper function qofeventid_to_string.

Christian Stimming cstim at code.gnucash.org
Fri Dec 17 16:31:12 EST 2010


Author: cstim
Date: 2010-12-17 16:31:11 -0500 (Fri, 17 Dec 2010)
New Revision: 19957
Trac: http://svn.gnucash.org/trac/changeset/19957

Added:
   gnucash/trunk/src/engine/gnc-event.c
Modified:
   gnucash/trunk/src/engine/CMakeLists.txt
   gnucash/trunk/src/engine/Makefile.am
   gnucash/trunk/src/engine/gnc-event.h
Log:
Add debug helper function qofeventid_to_string.

Modified: gnucash/trunk/src/engine/CMakeLists.txt
===================================================================
--- gnucash/trunk/src/engine/CMakeLists.txt	2010-12-17 20:36:40 UTC (rev 19956)
+++ gnucash/trunk/src/engine/CMakeLists.txt	2010-12-17 21:31:11 UTC (rev 19957)
@@ -120,6 +120,7 @@
   gnc-budget.c
   gnc-commodity.c
   gnc-engine.c
+  gnc-event.c
   gnc-hooks.c
   gnc-lot.c
   gnc-pricedb.c

Modified: gnucash/trunk/src/engine/Makefile.am
===================================================================
--- gnucash/trunk/src/engine/Makefile.am	2010-12-17 20:36:40 UTC (rev 19956)
+++ gnucash/trunk/src/engine/Makefile.am	2010-12-17 21:31:11 UTC (rev 19957)
@@ -32,6 +32,7 @@
   gnc-budget.c \
   gnc-commodity.c \
   gnc-engine.c \
+  gnc-event.c \
   gnc-hooks.c \
   gnc-lot.c \
   gnc-pricedb.c \

Added: gnucash/trunk/src/engine/gnc-event.c
===================================================================
--- gnucash/trunk/src/engine/gnc-event.c	                        (rev 0)
+++ gnucash/trunk/src/engine/gnc-event.c	2010-12-17 21:31:11 UTC (rev 19957)
@@ -0,0 +1,31 @@
+#include "config.h"
+#include "gnc-event.h"
+
+const char* qofeventid_to_string(QofEventId id)
+{
+    switch (id)
+    {
+    case 0:
+        return "NONE";
+    case QOF_EVENT_CREATE:
+        return "CREATE";
+    case QOF_EVENT_MODIFY:
+        return "MODIFY";
+    case QOF_EVENT_DESTROY:
+        return "DESTROY";
+    case QOF_EVENT_ADD:
+        return "ADD";
+    case QOF_EVENT_REMOVE:
+        return "REMOVE";
+
+    case GNC_EVENT_ITEM_ADDED:
+        return "ITEM_ADDED";
+    case GNC_EVENT_ITEM_REMOVED:
+        return "ITEM_REMOVED";
+    case GNC_EVENT_ITEM_CHANGED:
+        return "ITEM_CHANGED";
+
+    default:
+        return "<unknown, maybe multiple>";
+    }
+}


Property changes on: gnucash/trunk/src/engine/gnc-event.c
___________________________________________________________________
Added: svn:eol-style
   + LF

Modified: gnucash/trunk/src/engine/gnc-event.h
===================================================================
--- gnucash/trunk/src/engine/gnc-event.h	2010-12-17 20:36:40 UTC (rev 19956)
+++ gnucash/trunk/src/engine/gnc-event.h	2010-12-17 21:31:11 UTC (rev 19957)
@@ -20,6 +20,13 @@
  *                                                                  *
  ********************************************************************/
 
+/** @addtogroup Event
+@{
+*/
+/** @file
+    @brief Additional event handling code
+*/
+
 #ifndef GNC_EVENT_H
 #define GNC_EVENT_H
 
@@ -32,11 +39,16 @@
     gint idx;
 } GncEventData;
 
-/* These events are used when a split is added to an account.
+/** These events are used when a split is added to an account.
  * The event subject is the Account, the Object is the Split.
  */
 #define GNC_EVENT_ITEM_ADDED	QOF_MAKE_EVENT(QOF_EVENT_BASE+0)
 #define GNC_EVENT_ITEM_REMOVED	QOF_MAKE_EVENT(QOF_EVENT_BASE+1)
 #define GNC_EVENT_ITEM_CHANGED	QOF_MAKE_EVENT(QOF_EVENT_BASE+2)
 
+/** Convert the given QofEventId (an integer number) to a string that
+ * is usable in debugging output. */
+const char* qofeventid_to_string(QofEventId id);
+
 #endif
+/** @} */



More information about the gnucash-changes mailing list