[Gnucash-changes] r13747 - gnucash/trunk/lib/libqof/qof -
Standardise on gint and gchar. libqof 0.6.4 release.
Neil Williams
codehelp at cvs.gnucash.org
Fri Apr 7 14:50:10 EDT 2006
Author: codehelp
Date: 2006-04-07 14:50:08 -0400 (Fri, 07 Apr 2006)
New Revision: 13747
Trac: http://svn.gnucash.org/trac/changeset/13747
Removed:
gnucash/trunk/lib/libqof/qof/qof-be-utils.h
Modified:
gnucash/trunk/lib/libqof/qof/deprecated.c
gnucash/trunk/lib/libqof/qof/deprecated.h
gnucash/trunk/lib/libqof/qof/gnc-date.c
gnucash/trunk/lib/libqof/qof/gnc-date.h
gnucash/trunk/lib/libqof/qof/gnc-numeric.h
gnucash/trunk/lib/libqof/qof/guid.h
gnucash/trunk/lib/libqof/qof/kvp_frame.c
gnucash/trunk/lib/libqof/qof/kvp_frame.h
gnucash/trunk/lib/libqof/qof/qofbackend-p.h
gnucash/trunk/lib/libqof/qof/qofbackend.c
gnucash/trunk/lib/libqof/qof/qofbackend.h
gnucash/trunk/lib/libqof/qof/qofbook-p.h
gnucash/trunk/lib/libqof/qof/qofbook.c
gnucash/trunk/lib/libqof/qof/qofbook.h
gnucash/trunk/lib/libqof/qof/qofbookmerge.c
gnucash/trunk/lib/libqof/qof/qofbookmerge.h
gnucash/trunk/lib/libqof/qof/qofclass.h
gnucash/trunk/lib/libqof/qof/qofevent.c
gnucash/trunk/lib/libqof/qof/qofevent.h
gnucash/trunk/lib/libqof/qof/qofgobj.c
gnucash/trunk/lib/libqof/qof/qofid-p.h
gnucash/trunk/lib/libqof/qof/qofid.h
gnucash/trunk/lib/libqof/qof/qofinstance.c
gnucash/trunk/lib/libqof/qof/qofla-dir.h.in
gnucash/trunk/lib/libqof/qof/qoflog.c
gnucash/trunk/lib/libqof/qof/qoflog.h
gnucash/trunk/lib/libqof/qof/qofquery.c
gnucash/trunk/lib/libqof/qof/qofquerycore-p.h
gnucash/trunk/lib/libqof/qof/qofquerycore.h
gnucash/trunk/lib/libqof/qof/qofreference.c
gnucash/trunk/lib/libqof/qof/qofsession.h
gnucash/trunk/lib/libqof/qof/qofsql.c
gnucash/trunk/lib/libqof/qof/qofsql.h
Log:
Standardise on gint and gchar. libqof 0.6.4 release.
Modified: gnucash/trunk/lib/libqof/qof/deprecated.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/deprecated.c 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/deprecated.c 2006-04-07 18:50:08 UTC (rev 13747)
@@ -23,6 +23,7 @@
#include "config.h"
#ifndef QOF_DISABLE_DEPRECATED
+#include <glib.h>
#include "qof.h"
/* Don't be fooled: gnc_trace_num_spaces has external linkage and
@@ -103,6 +104,26 @@
{
qof_book_merge_rule_foreach(mergeData, cb, mergeResult);
}
+gpointer gnc_string_cache_insert(gconstpointer key)
+{
+ return (gpointer)qof_util_string_cache_insert(key);
+}
+gchar * gnc_stpcpy (gchar *dest, const gchar *src)
+{
+ return g_stpcpy(dest, src);
+}
+GCache* gnc_engine_get_string_cache(void)
+{
+ return qof_util_get_string_cache();
+}
+void gnc_engine_string_cache_destroy (void)
+{
+ qof_util_string_cache_destroy();
+}
+void gnc_string_cache_remove(gconstpointer key)
+{
+ qof_util_string_cache_remove(key);
+}
/* ==================================================================== */
#endif /* QOF_DISABLE_DEPRECATED */
Modified: gnucash/trunk/lib/libqof/qof/deprecated.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/deprecated.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/deprecated.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -24,6 +24,7 @@
#ifndef _DEPRECATED_H
#define _DEPRECATED_H
+#include <glib.h> /* deprecated */
#include "qof.h"
/** @file deprecated.h
@@ -141,11 +142,49 @@
QofBookMergeRuleForeachCB callback ,
QofBookMergeResult mergeResult);
/** \deprecated use qof_book_merge_update_result instead. */
-QofBookMergeData*
-qof_book_mergeUpdateResult(QofBookMergeData *mergeData, QofBookMergeResult tag);
+QofBookMergeData* qof_book_mergeUpdateResult(QofBookMergeData *mergeData,
+ QofBookMergeResult tag);
/** \deprecated use qof_book_merge_commit instead. */
-gint
-qof_book_mergeCommit(QofBookMergeData *mergeData );
-
+gint qof_book_mergeCommit(QofBookMergeData *mergeData );
+/** \deprecated Use the function versions, safe_strcmp() and
+safe_strcasecmp() instead. */
+#define SAFE_STRCMP_REAL(fcn,da,db) { \
+ if ((da) && (db)) { \
+ if ((da) != (db)) { \
+ gint retval = fcn ((da), (db)); \
+ /* if strings differ, return */ \
+ if (retval) return retval; \
+ } \
+ } else \
+ if ((!(da)) && (db)) { \
+ return -1; \
+ } else \
+ if ((da) && (!(db))) { \
+ return +1; \
+ } \
+}
+/** \deprecated use safe_strcmp() */
+#define SAFE_STRCMP(da,db) SAFE_STRCMP_REAL(strcmp,(da),(db))
+/** \deprecated use safe_strcasecmp() */
+#define SAFE_STRCASECMP(da,db) SAFE_STRCMP_REAL(strcasecmp,(da),(db))
+/** \deprecated use qof_util_string_cache_insert instead. */
+gpointer gnc_string_cache_insert(gconstpointer key);
+#if HAVE_SCANF_LLD
+# define GNC_SCANF_LLD "%lld" /**< \deprecated use G_GINT64_FORMAT instead. */
+#else
+# define GNC_SCANF_LLD "%qd" /**< \deprecated use G_GINT64_FORMAT instead. */
+#endif
+/** \deprecated use qof_util_stpcpy instead. */
+gchar * gnc_stpcpy (gchar *dest, const gchar *src);
+/** \deprecated use qof_init instead. */
+GCache* gnc_engine_get_string_cache(void);
+/** \deprecated use qof_init instead. */
+GCache* qof_util_get_string_cache(void);
+/** \deprecated use qof_close instead. */
+void gnc_engine_string_cache_destroy (void);
+/** \deprecated use qof_util_string_cache_remove instead. */
+void gnc_string_cache_remove(gconstpointer key);
+/** \deprecated no replacement. */
+void qof_book_set_schedxactions( QofBook *book, GList *newList );
#endif /* _DEPRECATED_H */
#endif /* QOF_DISABLE_DEPRECATED */
Modified: gnucash/trunk/lib/libqof/qof/gnc-date.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/gnc-date.c 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/gnc-date.c 2006-04-07 18:50:08 UTC (rev 13747)
@@ -28,6 +28,7 @@
#define __EXTENSIONS__
#include "config.h"
+#include <glib.h>
/* to be renamed qofdate.c */
#include <ctype.h>
Modified: gnucash/trunk/lib/libqof/qof/gnc-date.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/gnc-date.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/gnc-date.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -67,7 +67,6 @@
#ifndef GNC_DATE_H
#define GNC_DATE_H
-#include <glib.h>
#include <time.h>
/** The maximum length of a string created by the date printers */
@@ -119,59 +118,54 @@
//@{
/** \brief The string->value versions return FALSE on success and TRUE on failure */
-const char* gnc_date_dateformat_to_string(QofDateFormat format);
+const gchar* gnc_date_dateformat_to_string(QofDateFormat format);
/** \brief Converts the date format to a printable string.
Note the reversed return values!
@return FALSE on success, TRUE on failure.
*/
-gboolean gnc_date_string_to_dateformat(const char* format_string,
+gboolean gnc_date_string_to_dateformat(const gchar* format_string,
QofDateFormat *format);
-const char* gnc_date_monthformat_to_string(GNCDateMonthFormat format);
+const gchar* gnc_date_monthformat_to_string(GNCDateMonthFormat format);
/** \brief Converts the month format to a printable string.
Note the reversed return values!
@return FALSE on success, TRUE on failure.
*/
-gboolean gnc_date_string_to_monthformat(const char *format_string,
+gboolean gnc_date_string_to_monthformat(const gchar *format_string,
GNCDateMonthFormat *format);
// @}
/* Datatypes *******************************************************/
-/** \brief Use a 64-bit signed int timespec
+/** \brief Use a 64-bit unsigned int timespec
*
* struct timespec64 is just like the unix 'struct timespec' except
* that we use a 64-bit
- * signed int to store the seconds. This should adequately cover
+ * unsigned int to store the seconds. This should adequately cover
* dates in the distant future as well as the distant past, as long as
* they're not more than a couple dozen times the age of the universe.
- * Note that both gcc and the IBM Toronto xlC compiler (aka CSet,
- * VisualAge, etc) correctly handle long long as a 64 bit quantity,
- * even on the 32-bit Intel x86 and PowerPC architectures. I'm
- * assuming that all the other modern compilers are clean on this
- * issue too. */
+ * Values of this type can range from 0 to 18,446,744,073,709,551,615.
+ */
#ifndef SWIG /* swig 1.1p5 can't hack the long long type */
struct timespec64
{
- long long int tv_sec;
- long int tv_nsec;
+ guint64 tv_sec;
+ glong tv_nsec;
};
#endif /* SWIG */
/** The Timespec is just like the unix 'struct timespec'
- * except that we use a 64-bit signed int to
+ * except that we use a 64-bit unsigned int to
* store the seconds. This should adequately cover dates in the
* distant future as well as the distant past, as long as they're not
- * more than a couple dozen times the age of the universe. Note that
- * both gcc and the IBM Toronto xlC compiler (aka CSet, VisualAge,
- * etc) correctly handle long long as a 64 bit quantity, even on the
- * 32-bit Intel x86 and PowerPC architectures. I'm assuming that all
- * the other modern compilers are clean on this issue too. */
+ * more than a couple dozen times the age of the universe
+ * Values of this type can range from 0 to 18,446,744,073,709,551,615.
+ */
typedef struct timespec64 Timespec;
@@ -183,7 +177,7 @@
gboolean timespec_equal(const Timespec *ta, const Timespec *tb);
/** comparison: if (ta < tb) -1; else if (ta > tb) 1; else 0; */
-int timespec_cmp(const Timespec *ta, const Timespec *tb);
+gint timespec_cmp(const Timespec *ta, const Timespec *tb);
/** difference between ta and tb, results are normalised
* ie tv_sec and tv_nsec of the result have the same size
@@ -204,10 +198,10 @@
time_t timespecToTime_t (Timespec ts);
/** Convert a day, month, and year to a Timespec */
-Timespec gnc_dmy2timespec (int day, int month, int year);
+Timespec gnc_dmy2timespec (gint day, gint month, gint year);
/** Same as gnc_dmy2timespec, but last second of the day */
-Timespec gnc_dmy2timespec_end (int day, int month, int year);
+Timespec gnc_dmy2timespec_end (gint day, gint month, gint year);
/** The gnc_iso8601_to_timespec_gmt() routine converts an ISO-8601 style
* date/time string to Timespec. Please note that ISO-8601 strings
@@ -225,7 +219,7 @@
* XXX Caution: this routine does not handle strings that specify
* times before January 1 1970.
*/
-Timespec gnc_iso8601_to_timespec_gmt(const char *);
+Timespec gnc_iso8601_to_timespec_gmt(const gchar *);
/** The gnc_timespec_to_iso8601_buff() routine takes the input
* UTC Timespec value and prints it as an ISO-8601 style string.
@@ -243,11 +237,11 @@
* The string generated by this routine uses the local timezone
* on the machine on which it is executing to create the timestring.
*/
-char * gnc_timespec_to_iso8601_buff (Timespec ts, char * buff);
+gchar * gnc_timespec_to_iso8601_buff (Timespec ts, gchar * buff);
/** DOCUMENT ME! FIXME: Probably similar to xaccDMYToSec() this date
* routine might return incorrect values for dates before 1970. */
-void gnc_timespec2dmy (Timespec ts, int *day, int *month, int *year);
+void gnc_timespec2dmy (Timespec ts, gint *day, gint *month, gint *year);
/** \brief Add a number of days to a Timespec and normalise.
@@ -269,7 +263,7 @@
/** \deprecated Add a number of months to a time value and normalize. Optionally
* also track the last day of the month, i.e. 1/31 -> 2/28 -> 3/31. */
-void date_add_months (struct tm *tm, int months, gboolean track_last_day);
+void date_add_months (struct tm *tm, gint months, gboolean track_last_day);
/** \warning hack alert XXX FIXME -- these date routines return incorrect
* values for dates before 1970. Most of them are good only up
@@ -279,7 +273,7 @@
* the user wanted the time at noon, localtime. The returned
* time_t should be seconds (at GMT) of the local noon-time.
*/
-time_t xaccDMYToSec (int day, int month, int year);
+time_t xaccDMYToSec (gint day, gint month, gint year);
/** The gnc_timezone function returns the number of seconds *west*
* of UTC represented by the tm argument, adjusted for daylight
@@ -293,7 +287,7 @@
* daylight savings time! Timezone stuff under unix is not
* standardized and is a big mess.
*/
-long int gnc_timezone (struct tm *tm);
+glong gnc_timezone (struct tm *tm);
// @}
/* ------------------------------------------------------------------------ */
@@ -343,7 +337,7 @@
*
* Globals: global dateFormat value
*/
-char dateSeparator(void);
+gchar dateSeparator(void);
/** \name Date Printing/Scanning functions
*/
@@ -371,7 +365,7 @@
*
* Globals: global dateFormat value
**/
-size_t qof_print_date_dmy_buff (char * buff, size_t buflen, int day, int month, int year);
+size_t qof_print_date_dmy_buff (gchar * buff, size_t buflen, int day, int month, int year);
/** Convenience: calls through to qof_print_date_dmy_buff(). **/
size_t qof_print_date_buff (char * buff, size_t buflen, time_t secs);
@@ -463,7 +457,7 @@
tm->tm_isdst = -1;
}
-/** The gnc_tm_set_day_middle() inline routine will set the appropriate
+/** The gnc_tm_set_day_start() inline routine will set the appropriate
* fields in the struct tm to indicate noon of that day. This
* routine assumes that the contents of the data structure is already
* in normalized form.*/
@@ -477,7 +471,7 @@
tm->tm_isdst = -1;
}
-/** The gnc_tm_set_day_end() inline routine will set the appropriate
+/** The gnc_tm_set_day_start() inline routine will set the appropriate
* fields in the struct tm to indicate the last second of that day.
* This routine assumes that the contents of the data structure is
* already in normalized form.*/
Modified: gnucash/trunk/lib/libqof/qof/gnc-numeric.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/gnc-numeric.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/gnc-numeric.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -36,52 +36,8 @@
addition and multiplication, but 64-bit rationals do not have
the dynamic range of floating point numbers.
-EXAMPLE\n
--------\n
-The following program finds the best ::gnc_numeric approximation to
-the \a math.h constant \a M_PI given a maximum denominator. For
-large denominators, the ::gnc_numeric approximation is accurate to
-more decimal places than will generally be needed, but in some cases
-this may not be good enough. For example,
+See \ref gncnumericexample
- at verbatim
- M_PI = 3.14159265358979323846
- 245850922 / 78256779 = 3.14159265358979311599 (16 sig figs)
- 3126535 / 995207 = 3.14159265358865047446 (12 sig figs)
- 355 / 113 = 3.14159292035398252096 (7 sig figs)
- at endverbatim
-
- at verbatim
-#include <glib.h>
-#include <qof.h>
-#include <math.h>
-
-int
-main(int argc, char ** argv)
-{
- gnc_numeric approx, best;
- double err, best_err=1.0;
- double m_pi = M_PI;
- gint64 denom;
- gint64 max;
-
- sscanf(argv[1], "%Ld", &max);
-
- for (denom = 1; denom < max; denom++)
- {
- approx = double_to_gnc_numeric (m_pi, denom, GNC_RND_ROUND);
- err = m_pi - gnc_numeric_to_double (approx);
- if (fabs (err) < fabs (best_err))
- {
- best = approx;
- best_err = err;
- printf ("%Ld / %Ld = %.30f\n", gnc_numeric_num (best),
- gnc_numeric_denom (best), gnc_numeric_to_double (best));
- }
- }
-}
- at endverbatim
-
@{ */
/** @file gnc-numeric.h
@brief An exact-rational-number library for gnucash.
@@ -94,8 +50,6 @@
#ifndef GNC_NUMERIC_H
#define GNC_NUMERIC_H
-#include <glib.h>
-
struct _gnc_numeric
{
gint64 num;
@@ -325,7 +279,7 @@
gint64 gnc_numeric_denom(gnc_numeric a) { return a.denom; }
/** Convert numeric to floating-point value. */
-double gnc_numeric_to_double(gnc_numeric in);
+gdouble gnc_numeric_to_double(gnc_numeric in);
/** Convert to string. The returned buffer is to be g_free'd by the
* caller (it was allocated through g_strdup) */
@@ -346,7 +300,7 @@
GNCNumericErrorCode gnc_numeric_check(gnc_numeric a);
/** Returns 1 if a>b, -1 if b>a, 0 if a == b */
-int gnc_numeric_compare(gnc_numeric a, gnc_numeric b);
+gint gnc_numeric_compare(gnc_numeric a, gnc_numeric b);
/** Returns 1 if the given gnc_numeric is 0 (zero), else returns 0. */
gboolean gnc_numeric_zero_p(gnc_numeric a);
@@ -380,7 +334,7 @@
because 7/16 rounds to 1/2 under unbiased rounding but 3/4 rounds
to 2/2.
*/
-int gnc_numeric_same(gnc_numeric a, gnc_numeric b,
+gint gnc_numeric_same(gnc_numeric a, gnc_numeric b,
gint64 denom, gint how);
/** @} */
Modified: gnucash/trunk/lib/libqof/qof/guid.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/guid.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/guid.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -24,7 +24,6 @@
#ifndef GUID_H
#define GUID_H
-#include <glib.h>
#include <stddef.h>
/** @addtogroup Entity
@@ -53,9 +52,9 @@
#define GUID_DATA_SIZE 16
typedef union _GUID
{
- unsigned char data[GUID_DATA_SIZE];
+ guchar data[GUID_DATA_SIZE];
- int __align_me; /* this just ensures that GUIDs are 32-bit
+ gint __align_me; /* this just ensures that GUIDs are 32-bit
* aligned on systems that need them to be. */
} GUID;
@@ -160,7 +159,7 @@
* returned memory is owned by this routine and may not be freed by
* the caller.
*/
-const char * guid_to_string (const GUID * guid);
+const gchar * guid_to_string (const GUID * guid);
/** The guid_to_string_buff() routine puts a null-terminated string
* encoding of the id into the memory pointed at by buff. The
@@ -175,7 +174,7 @@
*
* @return A pointer to the terminating null character of the string.
*/
-char * guid_to_string_buff (const GUID * guid, char *buff);
+gchar * guid_to_string_buff (const GUID * guid, gchar *buff);
/** Given a string, decode the id into the guid if guid is non-NULL.
@@ -183,7 +182,7 @@
* hexadecimal number. This function accepts both upper and lower case
* hex digits. If the return value is FALSE, the effect on guid is
* undefined. */
-gboolean string_to_guid(const char * string, GUID * guid);
+gboolean string_to_guid(const gchar * string, GUID * guid);
/** Given two GUIDs, return TRUE if they are non-NULL and equal.
Modified: gnucash/trunk/lib/libqof/qof/kvp_frame.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/kvp_frame.c 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/kvp_frame.c 2006-04-07 18:50:08 UTC (rev 13747)
@@ -34,7 +34,7 @@
#include "qof.h"
/* Note that we keep the keys for this hash table in a GCache
- * (gnc_string_cache), as it is very likely we will see the
+ * (qof_util_string_cache), as it is very likely we will see the
* same keys over and over again */
struct _KvpFrame
@@ -107,7 +107,7 @@
static void
kvp_frame_delete_worker(gpointer key, gpointer value, gpointer user_data)
{
- gnc_string_cache_remove(key);
+ qof_util_string_cache_remove(key);
kvp_value_delete((KvpValue *)value);
}
@@ -142,7 +142,7 @@
{
KvpFrame * dest = (KvpFrame *)user_data;
g_hash_table_insert(dest->hash,
- gnc_string_cache_insert(key),
+ qof_util_string_cache_insert(key),
(gpointer)kvp_value_copy(value));
}
@@ -183,7 +183,7 @@
if(key_exists)
{
g_hash_table_remove(frame->hash, slot);
- gnc_string_cache_remove(orig_key);
+ qof_util_string_cache_remove(orig_key);
}
else
{
@@ -193,7 +193,7 @@
if(new_value)
{
g_hash_table_insert(frame->hash,
- gnc_string_cache_insert((gpointer) slot),
+ qof_util_string_cache_insert((gpointer) slot),
new_value);
}
Modified: gnucash/trunk/lib/libqof/qof/kvp_frame.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/kvp_frame.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/kvp_frame.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -61,8 +61,6 @@
#ifndef KVP_FRAME_H
#define KVP_FRAME_H
-#include <glib.h>
-
#include "gnc-date.h"
#include "gnc-numeric.h"
#include "guid.h"
@@ -141,13 +139,13 @@
* the path exist, they are created.
*
*/
-void kvp_frame_set_gint64(KvpFrame * frame, const char * path, gint64 ival);
+void kvp_frame_set_gint64(KvpFrame * frame, const gchar * path, gint64 ival);
/**
* store the value of the
* double at the indicated path. If not all frame components of
* the path exist, they are created.
*/
-void kvp_frame_set_double(KvpFrame * frame, const char * path, double dval);
+void kvp_frame_set_double(KvpFrame * frame, const gchar * path, double dval);
/** \deprecated
@@ -159,13 +157,13 @@
* If not all frame components of
* the path exist, they are created.
*/
-void kvp_frame_set_numeric(KvpFrame * frame, const char * path, gnc_numeric nval);
+void kvp_frame_set_numeric(KvpFrame * frame, const gchar * path, gnc_numeric nval);
/** store the value of the
* Timespec at the indicated path.
* If not all frame components of
* the path exist, they are created.
*/
-void kvp_frame_set_timespec(KvpFrame * frame, const char * path, Timespec ts);
+void kvp_frame_set_timespec(KvpFrame * frame, const gchar * path, Timespec ts);
/** \deprecated
@@ -185,11 +183,11 @@
* The kvp_frame_set_frame_nc() routine works as above, but does
* *NOT* copy the frame.
*/
-void kvp_frame_set_string(KvpFrame * frame, const char * path, const char* str);
-void kvp_frame_set_guid(KvpFrame * frame, const char * path, const GUID *guid);
+void kvp_frame_set_string(KvpFrame * frame, const gchar * path, const char* str);
+void kvp_frame_set_guid(KvpFrame * frame, const gchar * path, const GUID *guid);
-void kvp_frame_set_frame(KvpFrame *frame, const char *path, KvpFrame *chld);
-void kvp_frame_set_frame_nc(KvpFrame *frame, const char *path, KvpFrame *chld);
+void kvp_frame_set_frame(KvpFrame *frame, const gchar *path, KvpFrame *chld);
+void kvp_frame_set_frame_nc(KvpFrame *frame, const gchar *path, KvpFrame *chld);
/** The kvp_frame_set_value() routine copies the value into the frame,
* at the location 'path'. If the path contains slashes '/', these
@@ -202,7 +200,7 @@
* of the caller; the pointers are *not* taken over or managed.
*/
KvpFrame * kvp_frame_set_value(KvpFrame * frame,
- const char * path, const KvpValue * value);
+ const gchar * path, const KvpValue * value);
/**
* The kvp_frame_set_value_nc() routine puts the value (without copying
* it) into the frame, putting it at the location 'path'. If the path
@@ -217,7 +215,7 @@
* unless you remove the key as well (or unless you replace the value).
*/
KvpFrame * kvp_frame_set_value_nc(KvpFrame * frame,
- const char * path, KvpValue * value);
+ const gchar * path, KvpValue * value);
/** The kvp_frame_replace_value_nc() routine places the new value
* at the indicated path. It returns the old value, if any.
@@ -227,7 +225,7 @@
* effect of deleting the trailing slot (i.e. the trailing path
* element).
*/
-KvpValue * kvp_frame_replace_value_nc (KvpFrame * frame, const char * slot,
+KvpValue * kvp_frame_replace_value_nc (KvpFrame * frame, const gchar * slot,
KvpValue * new_value);
/** @} */
/** @name KvpFrame URL handling
@@ -245,7 +243,7 @@
* This routine treats all values as strings; it does *not* attempt
* to perform any type-conversion.
* */
-void kvp_frame_add_url_encoding (KvpFrame *frame, const char *enc);
+void kvp_frame_add_url_encoding (KvpFrame *frame, const gchar *enc);
/** @} */
/** @name KvpFrame Glist Bag Storing
@@ -263,16 +261,16 @@
* routines perform the same function, for each of the respective
* types.
*/
-void kvp_frame_add_gint64(KvpFrame * frame, const char * path, gint64 ival);
-void kvp_frame_add_double(KvpFrame * frame, const char * path, double dval);
+void kvp_frame_add_gint64(KvpFrame * frame, const gchar * path, gint64 ival);
+void kvp_frame_add_double(KvpFrame * frame, const gchar * path, double dval);
/** \deprecated
Use kvp_frame_add_numeric instead of kvp_frame_add_gnc_numeric
*/
#define kvp_frame_add_gnc_numeric kvp_frame_add_numeric
-void kvp_frame_add_numeric(KvpFrame * frame, const char * path, gnc_numeric nval);
-void kvp_frame_add_timespec(KvpFrame * frame, const char * path, Timespec ts);
+void kvp_frame_add_numeric(KvpFrame * frame, const gchar * path, gnc_numeric nval);
+void kvp_frame_add_timespec(KvpFrame * frame, const gchar * path, Timespec ts);
/** \deprecated
@@ -294,11 +292,11 @@
* The kvp_frame_add_frame_nc() routine works as above, but does
* *NOT* copy the frame.
*/
-void kvp_frame_add_string(KvpFrame * frame, const char * path, const char* str);
-void kvp_frame_add_guid(KvpFrame * frame, const char * path, const GUID *guid);
+void kvp_frame_add_string(KvpFrame * frame, const gchar * path, const gchar* str);
+void kvp_frame_add_guid(KvpFrame * frame, const gchar * path, const GUID *guid);
-void kvp_frame_add_frame(KvpFrame *frame, const char *path, KvpFrame *chld);
-void kvp_frame_add_frame_nc(KvpFrame *frame, const char *path, KvpFrame *chld);
+void kvp_frame_add_frame(KvpFrame *frame, const gchar *path, KvpFrame *chld);
+void kvp_frame_add_frame_nc(KvpFrame *frame, const gchar *path, KvpFrame *chld);
/* The kvp_frame_add_value() routine will add a copy of the value
* to the glist bag at the indicated path. If not all frame components
@@ -312,8 +310,8 @@
* The *_nc() routine is analogous, except that it doesn't copy the
* value.
*/
-KvpFrame * kvp_frame_add_value(KvpFrame * frame, const char * path, KvpValue *value);
-KvpFrame * kvp_frame_add_value_nc(KvpFrame * frame, const char * path, KvpValue *value);
+KvpFrame * kvp_frame_add_value(KvpFrame * frame, const gchar * path, KvpValue *value);
+KvpFrame * kvp_frame_add_value_nc(KvpFrame * frame, const gchar * path, KvpValue *value);
/** @} */
@@ -347,15 +345,15 @@
@{
*/
-gint64 kvp_frame_get_gint64(const KvpFrame *frame, const char *path);
-double kvp_frame_get_double(const KvpFrame *frame, const char *path);
-gnc_numeric kvp_frame_get_numeric(const KvpFrame *frame, const char *path);
-char * kvp_frame_get_string(const KvpFrame *frame, const char *path);
-GUID * kvp_frame_get_guid(const KvpFrame *frame, const char *path);
-void * kvp_frame_get_binary(const KvpFrame *frame, const char *path,
+gint64 kvp_frame_get_gint64(const KvpFrame *frame, const gchar *path);
+double kvp_frame_get_double(const KvpFrame *frame, const gchar *path);
+gnc_numeric kvp_frame_get_numeric(const KvpFrame *frame, const gchar *path);
+gchar * kvp_frame_get_string(const KvpFrame *frame, const gchar *path);
+GUID * kvp_frame_get_guid(const KvpFrame *frame, const gchar *path);
+void * kvp_frame_get_binary(const KvpFrame *frame, const gchar *path,
guint64 * size_return);
-Timespec kvp_frame_get_timespec(const KvpFrame *frame, const char *path);
-KvpValue * kvp_frame_get_value(const KvpFrame *frame, const char *path);
+Timespec kvp_frame_get_timespec(const KvpFrame *frame, const gchar *path);
+KvpValue * kvp_frame_get_value(const KvpFrame *frame, const gchar *path);
/** Value accessor. Takes a unix-style slash-separated path as an
* argument, and return the KvpFrame stored at that location. If the
@@ -375,7 +373,7 @@
* @return The KvpFrame at the specified path, or NULL if it doesn't
* exist.
*/
-KvpFrame * kvp_frame_get_frame(const KvpFrame *frame, const char *path);
+KvpFrame * kvp_frame_get_frame(const KvpFrame *frame, const gchar *path);
/** This routine returns the last frame of the path.
* If the frame path doesn't exist, it is created.
@@ -390,7 +388,7 @@
* kvp_frame_get_frame_path(). This happened on 2003-09-14, revision
* 1.31.
*/
-KvpFrame * kvp_frame_get_frame_path (KvpFrame *frame, const char *,...);
+KvpFrame * kvp_frame_get_frame_path (KvpFrame *frame, const gchar *,...);
/** This routine returns the last frame of the path.
* If the frame path doesn't exist, it is created.
@@ -411,7 +409,7 @@
* (This is a bug that needs fixing).
*/
KvpFrame * kvp_frame_get_frame_slash (KvpFrame *frame,
- const char *path);
+ const gchar *path);
/** @} */
/** @name KvpFrame KvpValue low-level storing routines.
@@ -435,7 +433,7 @@
* Passing in a NULL new_value has the effect of deleting that
* slot.
*/
-KvpValue * kvp_frame_replace_slot_nc (KvpFrame * frame, const char * slot,
+KvpValue * kvp_frame_replace_slot_nc (KvpFrame * frame, const gchar * slot,
KvpValue * new_value);
@@ -446,7 +444,7 @@
* this location, if any, is destroyed.
*/
void kvp_frame_set_slot(KvpFrame * frame,
- const char * key, const KvpValue * value);
+ const gchar * key, const KvpValue * value);
/**
* The kvp_frame_set_slot_nc() routine puts the value (without copying
* it) into the frame, associating it with a copy of 'key'. This
@@ -456,7 +454,7 @@
* The old value at this location, if any, is destroyed.
*/
void kvp_frame_set_slot_nc(KvpFrame * frame,
- const char * key, KvpValue * value);
+ const gchar * key, KvpValue * value);
/** The kvp_frame_set_slot_path() routine walks the hierarchy,
* using the key values to pick each branch. When the terminal
@@ -465,7 +463,7 @@
*/
void kvp_frame_set_slot_path (KvpFrame *frame,
const KvpValue *value,
- const char *first_key, ...);
+ const gchar *first_key, ...);
/** The kvp_frame_set_slot_path_gslist() routine walks the hierarchy,
* using the key values to pick each branch. When the terminal node
@@ -492,13 +490,13 @@
kvp_frame. Make copies as needed.
@{
*/
-KvpValue * kvp_frame_get_slot(const KvpFrame * frame, const char * key);
+KvpValue * kvp_frame_get_slot(const KvpFrame * frame, const gchar * key);
/** This routine return the value at the end of the
* path, or NULL if any portion of the path doesn't exist.
*/
KvpValue * kvp_frame_get_slot_path (KvpFrame *frame,
- const char *first_key, ...);
+ const gchar *first_key, ...);
/** This routine return the value at the end of the
* path, or NULL if any portion of the path doesn't exist.
@@ -559,7 +557,7 @@
*/
#define kvp_value_new_gnc_numeric kvp_value_new_numeric
KvpValue * kvp_value_new_numeric(gnc_numeric value);
-KvpValue * kvp_value_new_string(const char * value);
+KvpValue * kvp_value_new_string(const gchar * value);
KvpValue * kvp_value_new_guid(const GUID * guid);
KvpValue * kvp_value_new_timespec(Timespec timespec);
KvpValue * kvp_value_new_binary(const void * data, guint64 datasize);
Deleted: gnucash/trunk/lib/libqof/qof/qof-be-utils.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qof-be-utils.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qof-be-utils.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -1,204 +0,0 @@
-/********************************************************************\
- * qof-be-utils.h: api for data storage backend *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU General Public License as *
- * published by the Free Software Foundation; either version 2 of *
- * the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License*
- * along with this program; if not, contact: *
- * *
- * Free Software Foundation Voice: +1-617-542-5942 *
- * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
- * Boston, MA 02110-1301, USA gnu at gnu.org *
- * *
-\********************************************************************/
-/** @addtogroup Object
- @{ */
-/** @addtogroup Backend
- @{ */
-/** @file qof-be-utils.h
- @brief QOF Backend Utilities
- @author Derek Atkins <derek at ihtfp.com>
- @author Neil Williams <linux at codehelp.co.uk>
-
- Common code used by objects to define begin_edit() and
- commit_edit() functions.
-
-*/
-
-#ifndef QOF_BE_UTILS_H
-#define QOF_BE_UTILS_H
-
-#include "qoflog.h"
-#include "gnc-engine-util.h"
-#include "qofbackend-p.h"
-#include "qofbook.h"
-#include "qofinstance.h"
-
-/** begin_edit helper
- *
- * @param inst: an instance of QofInstance
- *
- * The caller should use this macro first and then perform any other operations.
-
- Uses newly created functions to allow the macro to be used
- when QOF is linked as a library. qofbackend-p.h is a private header.
- */
-
-#define QOF_BEGIN_EDIT(inst) \
- if (!(inst)) return; \
- \
- (inst)->editlevel++; \
- if (1 < (inst)->editlevel) return; \
- \
- if (0 >= (inst)->editlevel) \
- { \
- PERR ("unbalanced call - resetting (was %d)", (inst)->editlevel); \
- (inst)->editlevel = 1; \
- } \
- ENTER ("(inst=%p)", (inst)); \
- \
- /* See if there's a backend. If there is, invoke it. */ \
- { \
- QofBackend * be; \
- be = qof_book_get_backend ((inst)->book); \
- if (be && qof_backend_begin_exists(be)) { \
- qof_backend_run_begin(be, (inst)); \
- } else { \
- /* We tried and failed to start transaction! */ \
- (inst)->dirty = TRUE; \
- } \
- } \
- LEAVE (" ");
-
-/** \brief function version of QOF_BEGIN_EDIT
-
-The macro cannot be used in a function that returns a value,
-this function can be used instead.
-*/
-gboolean qof_begin_edit(QofInstance *inst);
-
-/**
- * commit_edit helpers
- *
- * The caller should call PART1 as the first thing, then
- * perform any local operations prior to calling the backend.
- * Then call PART2.
- */
-
-/**
- * part1 -- deal with the editlevel
- *
- * @param inst: an instance of QofInstance
- */
-
-#define QOF_COMMIT_EDIT_PART1(inst) { \
- if (!(inst)) return; \
- \
- (inst)->editlevel--; \
- if (0 < (inst)->editlevel) return; \
- \
- /* The pricedb suffers from delayed update... */ \
- /* This may be setting a bad precedent for other types, I fear. */ \
- /* Other types probably really should handle begin like this. */ \
- if ((-1 == (inst)->editlevel) && (inst)->dirty) \
- { \
- QofBackend * be; \
- be = qof_book_get_backend ((inst)->book); \
- if (be && qof_backend_begin_exists(be)) { \
- qof_backend_run_begin(be, (inst)); \
- } \
- (inst)->editlevel = 0; \
- } \
- if (0 > (inst)->editlevel) \
- { \
- PERR ("unbalanced call - resetting (was %d)", (inst)->editlevel); \
- (inst)->editlevel = 0; \
- } \
- ENTER ("(inst=%p) dirty=%d do-free=%d", \
- (inst), (inst)->dirty, (inst)->do_free); \
-}
-
-/** \brief function version of QOF_COMMIT_EDIT_PART1
-
-The macro cannot be used in a function that returns a value,
-this function can be used instead. Only Part1 is implemented.
-*/
-gboolean qof_commit_edit(QofInstance *inst);
-
-/**
- * part2 -- deal with the backend
- *
- * @param inst: an instance of QofInstance
- * @param on_error: a function called if there is a backend error.
- * void (*on_error)(inst, QofBackendError)
- * @param on_done: a function called after the commit is completed
- * successfully for an object which remained valid.
- * void (*on_done)(inst)
- * @param on_free: a function called if the commit succeeded and the instance
- * is to be freed.
- * void (*on_free)(inst)
- *
- * Note that only *one* callback will be called (or zero, if that
- * callback is NULL). In particular, 'on_done' will not be called for
- * an object which is to be freed.
- *
- * Returns TRUE, if the commit succeeded, FALSE otherwise.
- */
-gboolean
-qof_commit_edit_part2(QofInstance *inst,
- void (*on_error)(QofInstance *, QofBackendError),
- void (*on_done)(QofInstance *),
- void (*on_free)(QofInstance *));
-
-/** \brief Macro version of ::qof_commit_edit_part2
-
-\note This macro changes programme flow if the instance is freed.
-*/
-#define QOF_COMMIT_EDIT_PART2(inst,on_error,on_done,on_free) { \
- QofBackend * be; \
- \
- /* See if there's a backend. If there is, invoke it. */ \
- be = qof_book_get_backend ((inst)->book); \
- if (be && qof_backend_commit_exists(be)) \
- { \
- QofBackendError errcode; \
- \
- /* clear errors */ \
- do { \
- errcode = qof_backend_get_error (be); \
- } while (ERR_BACKEND_NO_ERR != errcode); \
- \
- qof_backend_run_commit(be, (inst)); \
- errcode = qof_backend_get_error (be); \
- if (ERR_BACKEND_NO_ERR != errcode) \
- { \
- /* XXX Should perform a rollback here */ \
- (inst)->do_free = FALSE; \
- \
- /* Push error back onto the stack */ \
- qof_backend_set_error (be, errcode); \
- (on_error)((inst), errcode); \
- } \
- /* XXX the backend commit code should clear dirty!! */ \
- (inst)->dirty = FALSE; \
- } \
- (on_done)(inst); \
- \
- LEAVE ("inst=%p, dirty=%d do-free=%d", \
- (inst), (inst)->dirty, (inst)->do_free); \
- if ((inst)->do_free) { \
- (on_free)(inst); \
- return; \
- } \
-}
-
-#endif /* QOF_BE_UTILS_H */
-/** @} */
-/** @} */
Modified: gnucash/trunk/lib/libqof/qof/qofbackend-p.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbackend-p.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofbackend-p.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -41,7 +41,6 @@
#ifndef QOF_BACKEND_P_H
#define QOF_BACKEND_P_H
-#include "qof-be-utils.h"
#include "qofbackend.h"
#include "qofbook.h"
#include "qofinstance-p.h"
Modified: gnucash/trunk/lib/libqof/qof/qofbackend.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbackend.c 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofbackend.c 2006-04-07 18:50:08 UTC (rev 13747)
@@ -193,7 +193,7 @@
switch (option->type)
{
case KVP_TYPE_GINT64 : {
- value = kvp_value_new_gint64(GPOINTER_TO_INT(option->value));
+ value = kvp_value_new_gint64(*(gint64*)&option->value);
break;
}
case KVP_TYPE_DOUBLE : {
@@ -246,6 +246,10 @@
KvpFrame *recursive;
};
+/* Set the option with the default KvpValue,
+manipulate the option in the supplied callback routine
+then set the value of the option into the KvpValue
+in the configuration frame. */
static void
config_foreach_cb (const char *key, KvpValue *value, gpointer data)
{
@@ -268,11 +272,11 @@
option.type = kvp_value_get_type(value);
if(!option.type) { return; }
switch (option.type)
- {
+ { /* set the KvpFrame value into the option */
case KVP_TYPE_GINT64 : {
int64 = kvp_value_get_gint64(value);
option.value = (gpointer)&int64;
- break;
+ break;
}
case KVP_TYPE_DOUBLE : {
db = kvp_value_get_double(value);
@@ -288,12 +292,12 @@
option.value = (gpointer)kvp_value_get_string(value);
break;
}
- case KVP_TYPE_GUID : { break; } /* unsupported */
case KVP_TYPE_TIMESPEC : {
ts = kvp_value_get_timespec(value);
option.value = (gpointer)&ts;
break;
}
+ case KVP_TYPE_GUID : { break; } /* unsupported */
case KVP_TYPE_BINARY : { break; } /* unsupported */
case KVP_TYPE_GLIST : { break; } /* unsupported */
case KVP_TYPE_FRAME : { break; } /* unsupported */
@@ -303,9 +307,43 @@
g_free(parent);
parent = g_strdup_printf("/%s/%s", QOF_CONFIG_TIP, key);
option.tooltip = kvp_frame_get_string(helper->recursive, parent);
+ g_free(parent);
helper->count++;
+ /* manipulate the option */
helper->fcn (&option, helper->data);
- LEAVE (" desc=%s tip=%s", option.description, option.tooltip);
+ switch (option.type)
+ { /* set the option value into the KvpFrame */
+ case KVP_TYPE_GINT64 : {
+ kvp_frame_set_gint64(helper->recursive, key,
+ (*(gint64*)option.value));
+ break;
+ }
+ case KVP_TYPE_DOUBLE : {
+ kvp_frame_set_double(helper->recursive, key,
+ (*(double*)option.value));
+ break;
+ }
+ case KVP_TYPE_NUMERIC : {
+ kvp_frame_set_numeric(helper->recursive, key,
+ (*(gnc_numeric*)option.value));
+ break;
+ }
+ case KVP_TYPE_STRING : {
+ kvp_frame_set_string(helper->recursive, key,
+ (gchar*)option.value);
+ break;
+ }
+ case KVP_TYPE_TIMESPEC : {
+ kvp_frame_set_timespec(helper->recursive, key,
+ (*(Timespec*)option.value));
+ break;
+ }
+ case KVP_TYPE_GUID : { break; } /* unsupported */
+ case KVP_TYPE_BINARY : { break; } /* unsupported */
+ case KVP_TYPE_GLIST : { break; } /* unsupported */
+ case KVP_TYPE_FRAME : { break; } /* unsupported */
+ }
+ LEAVE (" ");
}
void qof_backend_option_foreach(KvpFrame *config, QofBackendOptionCB cb, gpointer data)
@@ -347,85 +385,6 @@
}
gboolean
-qof_begin_edit(QofInstance *inst)
-{
- QofBackend * be;
-
- if (!inst) { return FALSE; }
- (inst->editlevel)++;
- if (1 < inst->editlevel) { return FALSE; }
- if (0 >= inst->editlevel) { inst->editlevel = 1; }
- be = qof_book_get_backend (inst->book);
- if (be && qof_backend_begin_exists(be)) {
- qof_backend_run_begin(be, inst);
- } else { inst->dirty = TRUE; }
- return TRUE;
-}
-
-gboolean qof_commit_edit(QofInstance *inst)
-{
- QofBackend * be;
-
- if (!inst) { return FALSE; }
- (inst->editlevel)--;
- if (0 < inst->editlevel) { return FALSE; }
- if ((-1 == inst->editlevel) && inst->dirty)
- {
- be = qof_book_get_backend ((inst)->book);
- if (be && qof_backend_begin_exists(be)) {
- qof_backend_run_begin(be, inst);
- }
- inst->editlevel = 0;
- }
- if (0 > inst->editlevel) { inst->editlevel = 0; }
- return TRUE;
-}
-
-
-gboolean
-qof_commit_edit_part2(QofInstance *inst,
- void (*on_error)(QofInstance *, QofBackendError),
- void (*on_done)(QofInstance *),
- void (*on_free)(QofInstance *))
-{
- QofBackend * be;
-
- /* See if there's a backend. If there is, invoke it. */
- be = qof_book_get_backend(inst->book);
- if (be && qof_backend_commit_exists(be)) {
- QofBackendError errcode;
-
- /* clear errors */
- do {
- errcode = qof_backend_get_error(be);
- } while (ERR_BACKEND_NO_ERR != errcode);
-
- qof_backend_run_commit(be, inst);
- errcode = qof_backend_get_error(be);
- if (ERR_BACKEND_NO_ERR != errcode) {
- /* XXX Should perform a rollback here */
- inst->do_free = FALSE;
-
- /* Push error back onto the stack */
- qof_backend_set_error (be, errcode);
- if (on_error)
- on_error(inst, errcode);
- return FALSE;
- }
- /* XXX the backend commit code should clear dirty!! */
- inst->dirty = FALSE;
- }
- if (inst->do_free) {
- if (on_free)
- on_free(inst);
- return TRUE;
- }
- if (on_done)
- on_done(inst);
- return TRUE;
-}
-
-gboolean
qof_load_backend_library (const char *directory,
const char* filename, const char* init_fcn)
{
Modified: gnucash/trunk/lib/libqof/qof/qofbackend.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbackend.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofbackend.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -18,6 +18,9 @@
* Boston, MA 02110-1301, USA gnu at gnu.org *
* *
\********************************************************************/
+/** @addtogroup Object
+ @{
+*/
/** @addtogroup Backend
The QOF Backend is a pseudo-object providing an interface between the
@@ -195,11 +198,11 @@
/** A single Backend Configuration Option. */
typedef struct QofBackendOption_s {
- KvpValueType type; /**< Only GINT64, DOUBLE, NUMERIC, STRING and TIMESPEC supported. */
- const char *option_name; /**< non-translated, key. */
- const char *description; /**< translatable description. */
- const char *tooltip; /**< translatable tooltip */
- gpointer value; /**< The value of the option. */
+ KvpValueType type; /**< Only GINT64, DOUBLE, NUMERIC, STRING and TIMESPEC supported. */
+ const gchar *option_name; /**< non-translated, key. */
+ const gchar *description; /**< translatable description. */
+ const gchar *tooltip; /**< translatable tooltip */
+ gpointer value; /**< The value of the option. */
}QofBackendOption;
/** Initialise the backend_configuration */
@@ -258,8 +261,8 @@
\return FALSE in case or error, otherwise TRUE.
*/
gboolean
-qof_load_backend_library (const char *directory,
- const char* filename, const char* init_fcn);
+qof_load_backend_library (const gchar *directory,
+ const gchar* filename, const gchar* init_fcn);
/** \brief Retrieve the backend used by this book */
QofBackend* qof_book_get_backend (QofBook *book);
@@ -268,3 +271,4 @@
#endif /* QOF_BACKEND_H */
/** @} */
+/** @} */
Modified: gnucash/trunk/lib/libqof/qof/qofbook-p.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbook-p.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofbook-p.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -99,9 +99,6 @@
*/
void qof_book_set_backend (QofBook *book, QofBackend *be);
-/** \deprecated */
-void qof_book_set_schedxactions( QofBook *book, GList *newList );
-
/* Register books with the engine */
gboolean qof_book_register (void);
Modified: gnucash/trunk/lib/libqof/qof/qofbook.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbook.c 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofbook.c 2006-04-07 18:50:08 UTC (rev 13747)
@@ -63,7 +63,7 @@
book->hash_of_collections = g_hash_table_new_full(
g_str_hash, g_str_equal,
- (GDestroyNotify)gnc_string_cache_remove, /* key_destroy_func */
+ (GDestroyNotify)qof_util_string_cache_remove, /* key_destroy_func */
coll_destroy); /* value_destroy_func */
qof_instance_init (&book->inst, QOF_ID_BOOK, book);
@@ -239,7 +239,7 @@
col = qof_collection_new (entity_type);
g_hash_table_insert(
book->hash_of_collections,
- gnc_string_cache_insert((gpointer) entity_type), col);
+ qof_util_string_cache_insert((gpointer) entity_type), col);
}
return col;
}
Modified: gnucash/trunk/lib/libqof/qof/qofbook.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbook.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofbook.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -40,7 +40,6 @@
#ifndef QOF_BOOK_H
#define QOF_BOOK_H
-#include <glib.h>
#include "qofid.h"
#include "kvp_frame.h"
@@ -124,17 +123,17 @@
* of the book KVP are persistent (are saved and restored to file
* or database), whereas the data pointers exist only at runtime.
*/
-void qof_book_set_data (QofBook *book, const char *key, gpointer data);
+void qof_book_set_data (QofBook *book, const gchar *key, gpointer data);
/** Same as qof_book_set_data(), except that the callback will be called
* when the book is destroyed. The argument to the callback will be
* the book followed by the data pointer.
*/
-void qof_book_set_data_fin (QofBook *book, const char *key, gpointer data,
+void qof_book_set_data_fin (QofBook *book, const gchar *key, gpointer data,
QofBookFinalCB);
/** Retrieves arbitrary pointers to structs stored by qof_book_set_data. */
-gpointer qof_book_get_data (QofBook *book, const char *key);
+gpointer qof_book_get_data (QofBook *book, const gchar *key);
/** Is the book shutting down? */
gboolean qof_book_shutting_down (QofBook *book);
Modified: gnucash/trunk/lib/libqof/qof/qofbookmerge.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbookmerge.c 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofbookmerge.c 2006-04-07 18:50:08 UTC (rev 13747)
@@ -21,6 +21,7 @@
* *
********************************************************************/
+#include <glib.h>
#include "qof.h"
static QofLogModule log_module = QOF_MOD_MERGE;
Modified: gnucash/trunk/lib/libqof/qof/qofbookmerge.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbookmerge.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofbookmerge.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -79,8 +79,7 @@
@author Copyright (c) 2004-2005 Neil Williams <linux at codehelp.co.uk>
*/
-#include <glib.h>
-#include "gnc-engine-util.h"
+#include "qofutil.h"
#include "qofbook.h"
#include "qofclass.h"
#include "qofobject.h"
Modified: gnucash/trunk/lib/libqof/qof/qofclass.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofclass.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofclass.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -178,7 +178,7 @@
};
/** This function is the default sort function for a particular object type */
-typedef int (*QofSortFunc)(gpointer, gpointer);
+typedef int (*QofSortFunc)(gconstpointer, gconstpointer);
/** This function registers a new object class with the Qof subsystem.
* In particular, it registers the set of setters and getters for
Modified: gnucash/trunk/lib/libqof/qof/qofevent.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofevent.c 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofevent.c 2006-04-07 18:50:08 UTC (rev 13747)
@@ -23,6 +23,7 @@
********************************************************************/
#include "config.h"
+#include <glib.h>
#include "qof.h"
#include "qofevent-p.h"
@@ -259,9 +260,9 @@
next_node = node->next;
if ((hi->handler == NULL)
#ifndef QOF_DISABLE_DEPRECATED
- &&(hi->old_handler == NULL)
+ &&(hi->old_handler == NULL)
#endif
- )
+ )
{
/* remove this node from the list, then free this node */
handlers = g_list_remove_link (handlers, node);
Modified: gnucash/trunk/lib/libqof/qof/qofevent.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofevent.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofevent.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -34,7 +34,6 @@
#ifndef QOF_EVENT_H
#define QOF_EVENT_H
-#include <glib.h>
#include "qof.h"
/** Define the type of events allowed. */
Modified: gnucash/trunk/lib/libqof/qof/qofgobj.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofgobj.c 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofgobj.c 2006-04-07 18:50:08 UTC (rev 13747)
@@ -21,6 +21,7 @@
\********************************************************************/
#include "config.h"
+#include <glib.h>
#include "qof.h"
#include "qofgobj.h"
Modified: gnucash/trunk/lib/libqof/qof/qofid-p.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofid-p.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofid-p.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -30,8 +30,6 @@
#ifndef QOF_ID_P_H
#define QOF_ID_P_H
-#include <glib.h>
-
#include "qofid.h"
/* This file defines an engine-only API for using QOF entity
Modified: gnucash/trunk/lib/libqof/qof/qofid.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofid.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofid.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -77,9 +77,9 @@
#include "guid.h"
/** QofIdType declaration */
-typedef const char * QofIdType;
+typedef const gchar * QofIdType;
/** QofIdTypeConst declaration */
-typedef const char * QofIdTypeConst;
+typedef const gchar * QofIdTypeConst;
/** QofLogModule declaration */
typedef const gchar* QofLogModule;
@@ -94,7 +94,7 @@
/** Inline string comparision; compiler will optimize away most of this */
#define QSTRCMP(da,db) ({ \
- int val = 0; \
+ gint val = 0; \
if ((da) && (db)) { \
if ((da) != (db)) { \
val = strcmp ((da), (db)); \
Modified: gnucash/trunk/lib/libqof/qof/qofinstance.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofinstance.c 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofinstance.c 2006-04-07 18:50:08 UTC (rev 13747)
@@ -28,6 +28,7 @@
*/
#include "config.h"
+#include <glib.h>
#include "qof.h"
#include "kvp-util-p.h"
#include "qofbook-p.h"
Modified: gnucash/trunk/lib/libqof/qof/qofla-dir.h.in
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofla-dir.h.in 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofla-dir.h.in 2006-04-07 18:50:08 UTC (rev 13747)
@@ -15,7 +15,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
+ * GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
Modified: gnucash/trunk/lib/libqof/qof/qoflog.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qoflog.c 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qoflog.c 2006-04-07 18:50:08 UTC (rev 13747)
@@ -334,6 +334,7 @@
qof_log_set_level(QOF_MOD_QUERY, log_level);
qof_log_set_level(QOF_MOD_SESSION, log_level);
qof_log_set_level(QOF_MOD_CHOICE, log_level);
+ qof_log_set_level(QOF_MOD_UTIL, log_level);
}
struct hash_s
Modified: gnucash/trunk/lib/libqof/qof/qoflog.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qoflog.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qoflog.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -34,10 +34,9 @@
#ifndef _QOF_LOG_H
#define _QOF_LOG_H
-#include <glib.h>
#include <stdarg.h>
#include <stdio.h>
-#include "gnc-engine-util.h"
+#include "qofutil.h"
#define QOF_MOD_ENGINE "qof-engine"
@@ -138,7 +137,7 @@
/** qof_log_prettify() cleans up subroutine names. AIX/xlC has the habit
* of printing signatures not names; clean this up. On other operating
* systems, truncate name to QOF_LOG_MAX_CHARS chars. */
-const char * qof_log_prettify (const char *name);
+const gchar * qof_log_prettify (const gchar *name);
/** Do not log log_modules that have not been enabled. */
gboolean qof_log_check(QofLogModule log_module, QofLogLevel log_level);
@@ -250,20 +249,20 @@
* of code. Used for only for performance tuning & debugging.
*/
-void qof_start_clock (int clockno, QofLogModule log_module, QofLogLevel log_level,
- const char *function_name, const char *format, ...);
+void qof_start_clock (gint clockno, QofLogModule log_module, QofLogLevel log_level,
+ const gchar *function_name, const gchar *format, ...);
-void qof_report_clock (int clockno,
+void qof_report_clock (gint clockno,
QofLogModule log_module,
QofLogLevel log_level,
- const char *function_name,
- const char *format, ...);
+ const gchar *function_name,
+ const gchar *format, ...);
-void qof_report_clock_total (int clockno,
+void qof_report_clock_total (gint clockno,
QofLogModule log_module,
QofLogLevel log_level,
- const char *function_name,
- const char *format, ...);
+ const gchar *function_name,
+ const gchar *format, ...);
/** start a particular timer */
#define START_CLOCK(clockno,format, args...) do { \
Modified: gnucash/trunk/lib/libqof/qof/qofquery.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofquery.c 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofquery.c 2006-04-07 18:50:08 UTC (rev 13747)
@@ -88,7 +88,7 @@
QofSortFunc defaultSort; /* <- Computed from search_for */
/* The maximum number of results to return */
- int max_results;
+ gint max_results;
/* list of books that will be participating in the query */
GList * books;
@@ -98,7 +98,7 @@
/* cache the results so we don't have to run the whole search
* again until it's really necessary */
- int changed;
+ gint changed;
GList * results;
};
@@ -107,7 +107,7 @@
{
QofQuery * query;
GList * list;
- int count;
+ gint count;
} QofQueryCB;
/* initial_term will be owned by the new Query */
@@ -282,7 +282,7 @@
/* See if this is a default sort */
if (sort->use_default)
{
- if (default_sort) return default_sort ((gpointer)a, (gpointer)b);
+ if (default_sort) return default_sort (a, b);
return 0;
}
Modified: gnucash/trunk/lib/libqof/qof/qofquerycore-p.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofquerycore-p.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofquerycore-p.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -26,7 +26,6 @@
#include <sys/types.h>
#include <time.h>
-#include <glib.h>
#include <regex.h>
#include <string.h>
@@ -42,7 +41,7 @@
* the Query internals), compare the object's parameter to the
* predicate data.
*/
-typedef int (*QofQueryPredicateFunc) (gpointer object,
+typedef gint (*QofQueryPredicateFunc) (gpointer object,
QofParam *getter,
QofQueryPredData *pdata);
@@ -50,13 +49,13 @@
* common getter (parameter member), using the provided comparison
* options (which are the type-specific options).
*/
-typedef int (*QofCompareFunc) (gpointer a, gpointer b,
+typedef gint (*QofCompareFunc) (gpointer a, gpointer b,
gint compare_options,
QofParam *getter);
/* Lookup functions */
-QofQueryPredicateFunc qof_query_core_get_predicate (char const *type);
-QofCompareFunc qof_query_core_get_compare (char const *type);
+QofQueryPredicateFunc qof_query_core_get_predicate (gchar const *type);
+QofCompareFunc qof_query_core_get_compare (gchar const *type);
/* Compare two predicates */
gboolean qof_query_core_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2);
@@ -75,7 +74,7 @@
QofQueryPredData pd;
QofStringMatch options;
gboolean is_regex;
- char * matchstring;
+ gchar * matchstring;
regex_t compiled;
} query_string_def, *query_string_t;
@@ -120,7 +119,7 @@
typedef struct {
QofQueryPredData pd;
QofCharMatch options;
- char * char_list;
+ gchar * char_list;
} query_char_def, *query_char_t;
typedef struct {
Modified: gnucash/trunk/lib/libqof/qof/qofquerycore.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofquerycore.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofquerycore.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -32,8 +32,6 @@
#ifndef QOF_QUERYCORE_H
#define QOF_QUERYCORE_H
-#include <glib.h>
-
#include "gnc-numeric.h"
#include "gnc-date.h"
#include "kvp_frame.h"
@@ -139,7 +137,7 @@
/** @name Core Data Type Predicates
@{ */
QofQueryPredData *qof_query_string_predicate (QofQueryCompare how,
- const char *str,
+ const gchar *str,
QofStringMatch options,
gboolean is_regex);
@@ -157,7 +155,7 @@
QofQueryPredData *qof_query_double_predicate (QofQueryCompare how, double val);
QofQueryPredData *qof_query_boolean_predicate (QofQueryCompare how, gboolean val);
QofQueryPredData *qof_query_char_predicate (QofCharMatch options,
- const char *chars);
+ const gchar *chars);
QofQueryPredData *qof_query_collect_predicate (QofGuidMatch options,
QofCollection *coll);
QofQueryPredData *qof_query_choice_predicate (QofGuidMatch options, GList *guids);
@@ -173,7 +171,7 @@
/** Same predicate as above, except that 'path' is assumed to be
* a string containing slash-separated pathname. */
QofQueryPredData *qof_query_kvp_predicate_path (QofQueryCompare how,
- const char *path,
+ const gchar *path,
const KvpValue *value);
/** Copy a predicate. */
Modified: gnucash/trunk/lib/libqof/qof/qofreference.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofreference.c 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofreference.c 2006-04-07 18:50:08 UTC (rev 13747)
@@ -20,8 +20,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
+
#include "config.h"
+#include <glib.h>
#include "qofreference.h"
static void
Modified: gnucash/trunk/lib/libqof/qof/qofsession.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofsession.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofsession.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -209,7 +209,7 @@
* filepath is derived from the url by substituting commas for
* slashes).
*
- * The qof_session_get_url() routine returns the url that was opened.
+ * The qof_session_get_url() routine returns the url that was opened.
* URL's for local files take the form of
* file:/some/where/some/file.gml
*/
Modified: gnucash/trunk/lib/libqof/qof/qofsql.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofsql.c 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofsql.c 2006-04-07 18:50:08 UTC (rev 13747)
@@ -882,19 +882,19 @@
if (!query) return NULL;
qof_sql_query_parse (query, str);
- if (NULL == query->qof_query) return NULL;
+ if (NULL == query->qof_query) { PINFO (" Null query"); return NULL; }
qof_query_set_book (query->qof_query, query->book);
+ /* Maybe log this sucker */
+ if (gnc_should_log (log_module, GNC_LOG_DETAIL))
+ {
+ qof_query_print (query->qof_query);
+ }
if(SQL_insert == query->parse_result->type){
results = NULL;
results = g_list_append(results, qof_query_insert(query));
return results;
}
- /* Maybe log this sucker */
- if (gnc_should_log (log_module, GNC_LOG_DETAIL))
- {
- qof_query_print (query->qof_query);
- }
results = qof_query_run (query->qof_query);
Modified: gnucash/trunk/lib/libqof/qof/qofsql.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofsql.h 2006-04-07 18:49:40 UTC (rev 13746)
+++ gnucash/trunk/lib/libqof/qof/qofsql.h 2006-04-07 18:50:08 UTC (rev 13747)
@@ -31,10 +31,9 @@
#ifndef QOF_SQL_QUERY_H
#define QOF_SQL_QUERY_H
-#include <glib.h>
-#include <kvp_frame.h>
-#include <qofbook.h>
-#include <qofquery.h>
+#include "kvp_frame.h"
+#include "qofbook.h"
+#include "qofquery.h"
/** @addtogroup SQL SQL Interface to Query
@@ -150,14 +149,14 @@
*
*/
-GList * qof_sql_query_run (QofSqlQuery *query, const char * str);
+GList * qof_sql_query_run (QofSqlQuery *query, const gchar * str);
/** Same ::qof_sql_query_run, but just parse/pre-process the query; do
not actually run it over the dataset. The QofBook does not
need to be set before calling this function.
*/
-void qof_sql_query_parse (QofSqlQuery *query, const char * str);
+void qof_sql_query_parse (QofSqlQuery *query, const gchar * str);
/** Return the QofQuery form of the previously parsed query. */
QofQuery * qof_sql_query_get_query (QofSqlQuery *);
More information about the gnucash-changes
mailing list