rename gncQueryCore to QofQueryCore

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8701 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2003-06-25 05:14:10 +00:00
parent f435fa83fa
commit edfa2f1151
21 changed files with 831 additions and 737 deletions

View File

@ -3190,19 +3190,19 @@ static QofObject account_object_def = {
gboolean xaccAccountRegister (void)
{
static QueryObjectDef params[] = {
{ ACCOUNT_KVP, QUERYCORE_KVP, (QueryAccess)xaccAccountGetSlots },
{ ACCOUNT_NAME_, QUERYCORE_STRING, (QueryAccess)xaccAccountGetName },
{ ACCOUNT_CODE_, QUERYCORE_STRING, (QueryAccess)xaccAccountGetCode },
{ ACCOUNT_DESCRIPTION_, QUERYCORE_STRING, (QueryAccess)xaccAccountGetDescription },
{ ACCOUNT_NOTES_, QUERYCORE_STRING, (QueryAccess)xaccAccountGetNotes },
{ ACCOUNT_PRESENT_, QUERYCORE_NUMERIC, (QueryAccess)xaccAccountGetPresentBalance },
{ ACCOUNT_BALANCE_, QUERYCORE_NUMERIC, (QueryAccess)xaccAccountGetBalance },
{ ACCOUNT_CLEARED_, QUERYCORE_NUMERIC, (QueryAccess)xaccAccountGetClearedBalance },
{ ACCOUNT_RECONCILED_, QUERYCORE_NUMERIC, (QueryAccess)xaccAccountGetReconciledBalance },
{ ACCOUNT_FUTURE_MINIMUM_, QUERYCORE_NUMERIC, (QueryAccess)xaccAccountGetProjectedMinimumBalance },
{ ACCOUNT_TAX_RELATED, QUERYCORE_BOOLEAN, (QueryAccess)xaccAccountGetTaxRelated },
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)xaccAccountGetBook },
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess)xaccAccountGetGUID },
{ ACCOUNT_KVP, QOF_QUERYCORE_KVP, (QofQueryAccess)xaccAccountGetSlots },
{ ACCOUNT_NAME_, QOF_QUERYCORE_STRING, (QofQueryAccess)xaccAccountGetName },
{ ACCOUNT_CODE_, QOF_QUERYCORE_STRING, (QofQueryAccess)xaccAccountGetCode },
{ ACCOUNT_DESCRIPTION_, QOF_QUERYCORE_STRING, (QofQueryAccess)xaccAccountGetDescription },
{ ACCOUNT_NOTES_, QOF_QUERYCORE_STRING, (QofQueryAccess)xaccAccountGetNotes },
{ ACCOUNT_PRESENT_, QOF_QUERYCORE_NUMERIC, (QofQueryAccess)xaccAccountGetPresentBalance },
{ ACCOUNT_BALANCE_, QOF_QUERYCORE_NUMERIC, (QofQueryAccess)xaccAccountGetBalance },
{ ACCOUNT_CLEARED_, QOF_QUERYCORE_NUMERIC, (QofQueryAccess)xaccAccountGetClearedBalance },
{ ACCOUNT_RECONCILED_, QOF_QUERYCORE_NUMERIC, (QofQueryAccess)xaccAccountGetReconciledBalance },
{ ACCOUNT_FUTURE_MINIMUM_, QOF_QUERYCORE_NUMERIC, (QofQueryAccess)xaccAccountGetProjectedMinimumBalance },
{ ACCOUNT_TAX_RELATED, QOF_QUERYCORE_BOOLEAN, (QofQueryAccess)xaccAccountGetTaxRelated },
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QofQueryAccess)xaccAccountGetBook },
{ QUERY_PARAM_GUID, QOF_QUERYCORE_GUID, (QofQueryAccess)xaccAccountGetGUID },
{ NULL },
};

View File

@ -17,7 +17,6 @@ libgncmod_engine_la_SOURCES = \
Period.c \
Query.c \
QueryNew.c \
QueryCore.c \
QueryObject.c \
SchedXaction.c \
SX-book.c \
@ -45,6 +44,7 @@ libgncmod_engine_la_SOURCES = \
md5.c \
messages.c \
qofbook.c \
qofquerycore.c \
qofobject.c
EXTRA_libgncmod_engine_la_SOURCES = iso-4217-currencies.c
@ -90,6 +90,7 @@ gncinclude_HEADERS = \
kvp-util.h \
messages.h \
qofbook.h \
qofquerycore.h \
qofobject.h
noinst_HEADERS = \
@ -101,7 +102,6 @@ noinst_HEADERS = \
QueryP.h \
QueryNewP.h \
QueryObjectP.h \
QueryCoreP.h \
SchedXactionP.h \
ScrubP.h \
SX-book.h \
@ -117,6 +117,7 @@ noinst_HEADERS = \
gw-engine.h \
gw-kvp.h \
qofbook-p.h \
qofquerycore-p.h \
qofobject-p.h
noinst_SCRIPTS = iso-currencies-to-c
@ -147,10 +148,10 @@ gncscm_DATA = \
gwmoddir = ${GNC_GWRAP_LIBDIR}
gwmod_DATA = \
gw-engine.scm \
gw-kvp.scm \
gw-engine-spec.scm \
gw-kvp-spec.scm
gw-engine.scm \
gw-kvp-spec.scm \
gw-kvp.scm
EXTRA_DIST = \
.cvsignore \

View File

@ -224,7 +224,7 @@ xaccQueryGetLots (Query * q, query_txn_match_t runtype)
void
xaccQueryAddAccountMatch(Query *q, AccountList *acct_list,
guid_match_t how, QueryOp op)
QofGuidMatch how, QueryOp op)
{
GList *list = NULL;
@ -252,23 +252,23 @@ xaccQueryAddAccountMatch(Query *q, AccountList *acct_list,
void
xaccQueryAddAccountGUIDMatch(Query *q, AccountGUIDList *guid_list,
guid_match_t how, QueryOp op)
QofGuidMatch how, QueryOp op)
{
QueryPredData_t pred_data;
QofQueryPredData *pred_data;
GSList *param_list = NULL;
if (!q) return;
pred_data = gncQueryGUIDPredicate (how, guid_list);
pred_data = qof_query_guid_predicate (how, guid_list);
if (!pred_data)
return;
switch (how) {
case GUID_MATCH_ANY:
case GUID_MATCH_NONE:
case QOF_GUID_MATCH_ANY:
case QOF_GUID_MATCH_NONE:
param_list = gncQueryBuildParamList (SPLIT_ACCOUNT, QUERY_PARAM_GUID, NULL);
break;
case GUID_MATCH_ALL:
case QOF_GUID_MATCH_ALL:
param_list = gncQueryBuildParamList (SPLIT_TRANS, TRANS_SPLITLIST,
SPLIT_ACCOUNT_GUID, NULL);
break;
@ -292,7 +292,7 @@ xaccQueryAddSingleAccountMatch(Query *q, Account *acc, QueryOp op)
g_return_if_fail (guid);
list = g_list_prepend (NULL, (gpointer)guid);
xaccQueryAddAccountGUIDMatch (q, list, GUID_MATCH_ANY, op);
xaccQueryAddAccountGUIDMatch (q, list, QOF_GUID_MATCH_ANY, op);
g_list_free (list);
}
@ -301,16 +301,16 @@ xaccQueryAddStringMatch (Query* q, const char *matchstring,
int case_sens, int use_regexp, QueryOp op,
const char * path, ...)
{
QueryPredData_t pred_data;
QofQueryPredData *pred_data;
GSList *param_list;
va_list ap;
if (!path || !q)
return;
pred_data = gncQueryStringPredicate (COMPARE_EQUAL, (char *)matchstring,
(case_sens ? STRING_MATCH_NORMAL :
STRING_MATCH_CASEINSENSITIVE),
pred_data = qof_query_string_predicate (QOF_COMPARE_EQUAL, (char *)matchstring,
(case_sens ? QOF_STRING_MATCH_NORMAL :
QOF_STRING_MATCH_CASEINSENSITIVE),
use_regexp);
if (!pred_data)
return;
@ -323,18 +323,18 @@ xaccQueryAddStringMatch (Query* q, const char *matchstring,
}
void
xaccQueryAddNumericMatch (Query *q, gnc_numeric amount, numeric_match_t sign,
query_compare_t how, QueryOp op,
xaccQueryAddNumericMatch (Query *q, gnc_numeric amount, QofNumericMatch sign,
QofQueryCompare how, QueryOp op,
const char * path, ...)
{
QueryPredData_t pred_data;
QofQueryPredData *pred_data;
GSList *param_list;
va_list ap;
if (!q || !path)
return;
pred_data = gncQueryNumericPredicate (how, sign, amount);
pred_data = qof_query_numeric_predicate (how, sign, amount);
if (!pred_data)
return;
@ -361,7 +361,7 @@ xaccQueryAddDateMatchTS (Query * q,
QueryOp op)
{
Query *tmp_q = NULL;
QueryPredData_t pred_data;
QofQueryPredData *pred_data;
GSList *param_list;
if (!q || (!use_start && !use_end))
@ -370,7 +370,7 @@ xaccQueryAddDateMatchTS (Query * q,
tmp_q = gncQueryCreate ();
if (use_start) {
pred_data = gncQueryDatePredicate (COMPARE_GTE, DATE_MATCH_NORMAL, sts);
pred_data = qof_query_date_predicate (QOF_QOF_COMPARE_GTE, QOF_DATE_MATCH_NORMAL, sts);
if (!pred_data) {
gncQueryDestroy (tmp_q);
return;
@ -381,7 +381,7 @@ xaccQueryAddDateMatchTS (Query * q,
}
if (use_end) {
pred_data = gncQueryDatePredicate (COMPARE_LTE, DATE_MATCH_NORMAL, ets);
pred_data = qof_query_date_predicate (QOF_QOF_COMPARE_LTE, QOF_DATE_MATCH_NORMAL, ets);
if (!pred_data) {
gncQueryDestroy (tmp_q);
return;
@ -445,7 +445,7 @@ xaccQueryAddDateMatchTT(Query * q,
void
xaccQueryAddClearedMatch(Query * q, cleared_match_t how, QueryOp op)
{
QueryPredData_t pred_data;
QofQueryPredData *pred_data;
GSList *param_list;
char chars[6];
int i = 0;
@ -465,7 +465,7 @@ xaccQueryAddClearedMatch(Query * q, cleared_match_t how, QueryOp op)
chars[i++] = VREC;
chars[i] = '\0';
pred_data = gncQueryCharPredicate (CHAR_MATCH_ANY, chars);
pred_data = qof_query_char_predicate (QOF_CHAR_MATCH_ANY, chars);
if (!pred_data)
return;
@ -513,16 +513,16 @@ xaccQueryAddGUIDMatchGL (QueryNew *q, GList *param_list,
void
xaccQueryAddKVPMatch(Query *q, GSList *path, const kvp_value *value,
query_compare_t how, GNCIdType id_type,
QofQueryCompare how, GNCIdType id_type,
QueryOp op)
{
GSList *param_list = NULL;
QueryPredData_t pred_data;
QofQueryPredData *pred_data;
if (!q || !path || !value || !id_type)
return;
pred_data = gncQueryKVPPredicate (how, path, value);
pred_data = qof_query_kvp_predicate (how, path, value);
if (!pred_data)
return;

View File

@ -35,7 +35,7 @@
#include "kvp_frame.h"
#include "QueryNew.h"
#include "QueryCore.h"
#include "qofquerycore.h"
/*
* This function defines a compatibility API from the old Query API to
@ -124,10 +124,10 @@ LotList * xaccQueryGetLots(Query * q, query_txn_match_t type);
*******************************************************************/
void xaccQueryAddAccountMatch(Query *, AccountList *,
guid_match_t how, QueryOp op);
QofGuidMatch how, QueryOp op);
void xaccQueryAddAccountGUIDMatch(Query *, AccountGUIDList *,
guid_match_t, QueryOp);
QofGuidMatch, QueryOp);
void xaccQueryAddSingleAccountMatch(Query *, Account *, QueryOp);
@ -149,7 +149,7 @@ void xaccQueryAddStringMatch (Query* q, const char *matchstring,
NULL)
void xaccQueryAddNumericMatch (Query *q, gnc_numeric amount,
numeric_match_t sign, query_compare_t how,
QofNumericMatch sign, QofQueryCompare how,
QueryOp op, const char * path, ...);
#define xaccQueryAddValueMatch(q,amt,sgn,how,op) \
@ -157,16 +157,16 @@ void xaccQueryAddNumericMatch (Query *q, gnc_numeric amount,
SPLIT_VALUE, NULL)
#define xaccQueryAddSharePriceMatch(q,amt,how,op) \
xaccQueryAddNumericMatch ((q), (amt), NUMERIC_MATCH_ANY, (how), (op), \
xaccQueryAddNumericMatch ((q), (amt), QOF_NUMERIC_MATCH_ANY, (how), (op), \
SPLIT_SHARE_PRICE, NULL)
#define xaccQueryAddSharesMatch(q,amt,how,op) \
xaccQueryAddNumericMatch ((q), (amt), NUMERIC_MATCH_ANY, (how), (op), \
xaccQueryAddNumericMatch ((q), (amt), QOF_NUMERIC_MATCH_ANY, (how), (op), \
SPLIT_AMOUNT, NULL)
#define xaccQueryAddBalanceMatch(q,bal,op) \
xaccQueryAddNumericMatch ((q), gnc_numeric_zero(), NUMERIC_MATCH_ANY, \
((bal) ? COMPARE_EQUAL : COMPARE_NEQ), (op), \
xaccQueryAddNumericMatch ((q), gnc_numeric_zero(), QOF_NUMERIC_MATCH_ANY, \
((bal) ? QOF_COMPARE_EQUAL : QOF_COMPARE_NEQ), (op), \
SPLIT_TRANS, TRANS_IMBALANCE, NULL)
/* The DateMatch queries match transactions whose posted date
@ -208,7 +208,7 @@ void xaccQueryAddGUIDMatchGL (QueryNew *q, GList *param_list,
/* given kvp value is on right side of comparison */
void xaccQueryAddKVPMatch(Query *q, GSList *path, const kvp_value *value,
query_compare_t how, GNCIdType id_type,
QofQueryCompare how, GNCIdType id_type,
QueryOp op);
void xaccQuerySetSortOrder(Query *q, GList *p1, GList *p2, GList *p3);

View File

@ -1,151 +1,5 @@
/********************************************************************\
* QueryCore.h -- API for providing core Query data types *
* Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU> *
* *
* 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 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
#if 0
/** @file QueryCore.h
@breif API for providing core Query data types
@author Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU>
*/
#include "qofquerycore.h"
#ifndef GNC_QUERYCORE_H
#define GNC_QUERYCORE_H
#include <glib.h>
#include "gnc-numeric.h"
#include "gnc-date.h"
#include "kvp_frame.h"
typedef struct query_pred_data *QueryPredData_t;
/** Type of Query Core Objects (String, Date, Numeric, GUID, etc. */
typedef const char * QueryCoreType;
/** The QueryAccess type defines an arbitrary function pointer
* for access functions. This is needed because C doesn't have
* templates, so we just cast a lot. Real functions must be of
* the form:
*
* <param_type> function (object_type *obj);
*/
typedef gpointer (*QueryAccess)(gpointer);
/** Standard Query comparitors, for how to compare objects in a predicate.
* Note that not all core types implement all comparitors
*/
typedef enum {
COMPARE_LT = 1,
COMPARE_LTE,
COMPARE_EQUAL,
COMPARE_GT,
COMPARE_GTE,
COMPARE_NEQ
} query_compare_t;
/** List of known core query data-types...
* Each core query type defines it's set of optional "comparitor qualifiers".
*/
#define QUERYCORE_STRING "string"
typedef enum {
STRING_MATCH_NORMAL = 1,
STRING_MATCH_CASEINSENSITIVE
} string_match_t;
#define QUERYCORE_DATE "date"
typedef enum {
DATE_MATCH_NORMAL = 1,
DATE_MATCH_ROUNDED
} date_match_t;
#define QUERYCORE_NUMERIC "numeric"
#define QUERYCORE_DEBCRED "debcred"
typedef enum {
NUMERIC_MATCH_DEBIT = 1,
NUMERIC_MATCH_CREDIT,
NUMERIC_MATCH_ANY
} numeric_match_t;
#define QUERYCORE_GUID "guid"
typedef enum {
/* These expect a single object and expect the QueryAccess returns GUID* */
GUID_MATCH_ANY = 1,
GUID_MATCH_NONE,
GUID_MATCH_NULL,
/* These expect a GList* of objects and calls the QueryAccess routine
* on each item in the list to obtain a GUID* for each object */
GUID_MATCH_ALL,
/* These expect a single object and expect the QueryAccess function
* to return a GList* of GUID* (the list is the property of the caller) */
GUID_MATCH_LIST_ANY,
} guid_match_t;
#define QUERYCORE_INT32 "gint32"
#define QUERYCORE_INT64 "gint64"
#define QUERYCORE_DOUBLE "double"
#define QUERYCORE_BOOLEAN "boolean"
#define QUERYCORE_KVP "kvp"
/** A CHAR type is for a RECNCell */
#define QUERYCORE_CHAR "character"
typedef enum {
CHAR_MATCH_ANY = 1,
CHAR_MATCH_NONE
} char_match_t;
/** Head of Predicate Data structures. All PData must start like this. */
typedef struct query_pred_data {
QueryCoreType type_name; /* QUERYCORE_* */
query_compare_t how;
} QueryPredDataDef;
/** Core Data Type Predicates */
QueryPredData_t gncQueryStringPredicate (query_compare_t how, char *str,
string_match_t options,
gboolean is_regex);
QueryPredData_t gncQueryDatePredicate (query_compare_t how,
date_match_t options, Timespec date);
QueryPredData_t gncQueryNumericPredicate (query_compare_t how,
numeric_match_t options,
gnc_numeric value);
QueryPredData_t gncQueryGUIDPredicate (guid_match_t options, GList *guids);
QueryPredData_t gncQueryInt32Predicate (query_compare_t how, gint32 val);
QueryPredData_t gncQueryInt64Predicate (query_compare_t how, gint64 val);
QueryPredData_t gncQueryDoublePredicate (query_compare_t how, double val);
QueryPredData_t gncQueryBooleanPredicate (query_compare_t how, gboolean val);
QueryPredData_t gncQueryCharPredicate (char_match_t options,
const char *chars);
QueryPredData_t gncQueryKVPPredicate (query_compare_t how,
GSList *path, const kvp_value *value);
/** Copy a predicate. */
QueryPredData_t gncQueryCorePredicateCopy (QueryPredData_t pdata);
/** Destroy a predicate. */
void gncQueryCorePredicateFree (QueryPredData_t pdata);
/** Return a printable string for a core data object. Caller needs
* to g_free() the returned string.
*/
char * gncQueryCoreToString (char const *type, gpointer object,
QueryAccess fcn);
#endif /* GNC_QUERYCORE_H */
#endif

View File

@ -33,17 +33,18 @@
#include "BackendP.h"
#include "QueryObjectP.h"
#include "QueryCoreP.h"
#include "QueryNewP.h"
#include "qofbook.h"
#include "qofbook-p.h"
#include "qofobject.h"
#include "qofquerycore.h"
#include "qofquerycore-p.h"
static short module = MOD_QUERY;
typedef struct query_new_term {
GSList * param_list;
QueryPredData_t pdata;
QofQueryPredData *pdata;
gboolean invert;
/* These values are filled in during "compilation" of the query
@ -173,7 +174,7 @@ static void free_query_term (QueryNewTerm *qt)
{
if (!qt) return;
gncQueryCorePredicateFree (qt->pdata);
qof_query_core_predicate_free (qt->pdata);
g_slist_free (qt->param_list);
g_slist_free (qt->param_fcns);
g_free (qt);
@ -188,7 +189,7 @@ static QueryNewTerm * copy_query_term (QueryNewTerm *qt)
memcpy (new_qt, qt, sizeof(QueryNewTerm));
new_qt->param_list = g_slist_copy (qt->param_list);
new_qt->param_fcns = g_slist_copy (qt->param_fcns);
new_qt->pdata = gncQueryCorePredicateCopy (qt->pdata);
new_qt->pdata = qof_query_core_predicate_copy (qt->pdata);
return new_qt;
}
@ -274,7 +275,7 @@ static int cmp_func (QueryNewSort_t sort, QuerySort default_sort,
{
GSList *node;
gpointer conva, convb;
QueryAccess get_fcn = NULL; /* to appease the compiler */
QofQueryAccess get_fcn = NULL; /* to appease the compiler */
g_return_val_if_fail (sort, 0);
g_return_val_if_fail (default_sort, 0);
@ -359,7 +360,7 @@ check_object (QueryNew *q, gpointer object)
qt = (QueryNewTerm *)(and_ptr->data);
if (qt->param_fcns && qt->pred_fcn) {
GSList *node;
QueryAccess get_fcn;
QofQueryAccess get_fcn;
gpointer conv_obj = object;
/* iterate through the conversions */
@ -448,7 +449,7 @@ static void compile_sort (QueryNewSort_t sort, GNCIdType obj)
* If not, check if this is the default sort.
*/
if (sort->param_fcns) {
sort->comp_fcn = gncQueryCoreGetCompare (resObj->param_type);
sort->comp_fcn = qof_query_core_get_compare (resObj->param_type);
/* Hrm, perhaps this is an object compare, not a core compare? */
if (sort->comp_fcn == NULL)
@ -482,7 +483,7 @@ static void compile_terms (QueryNew *q)
*/
if (qt->param_fcns)
qt->pred_fcn = gncQueryCoreGetPredicate (resObj->param_type);
qt->pred_fcn = qof_query_core_get_predicate (resObj->param_type);
else
qt->pred_fcn = NULL;
}
@ -598,7 +599,7 @@ gncQueryBuildParamList (char const *param, ...)
}
void gncQueryAddTerm (QueryNew *q, GSList *param_list,
QueryPredData_t pred_data, QueryOp op)
QofQueryPredData *pred_data, QueryOp op)
{
QueryNewTerm *qt;
QueryNew *qr, *qs;
@ -1109,17 +1110,17 @@ void gncQuerySetMaxResults (QueryNew *q, int n)
}
void gncQueryAddGUIDListMatch (QueryNew *q, GSList *param_list,
GList *guid_list, guid_match_t options,
GList *guid_list, QofGuidMatch options,
QueryOp op)
{
QueryPredData_t pdata;
QofQueryPredData *pdata;
if (!q || !param_list) return;
if (!guid_list)
g_return_if_fail (options == GUID_MATCH_NULL);
g_return_if_fail (options == QOF_GUID_MATCH_NULL);
pdata = gncQueryGUIDPredicate (options, guid_list);
pdata = qof_query_guid_predicate (options, guid_list);
gncQueryAddTerm (q, param_list, pdata, op);
}
@ -1134,7 +1135,7 @@ void gncQueryAddGUIDMatch (QueryNew *q, GSList *param_list,
g = g_list_prepend (g, (gpointer)guid);
gncQueryAddGUIDListMatch (q, param_list, g,
g ? GUID_MATCH_ANY : GUID_MATCH_NULL, op);
g ? QOF_GUID_MATCH_ANY : QOF_GUID_MATCH_NULL, op);
g_list_free (g);
}
@ -1156,10 +1157,10 @@ void gncQuerySetBook (QueryNew *q, QofBook *book)
void gncQueryAddBooleanMatch (QueryNew *q, GSList *param_list, gboolean value,
QueryOp op)
{
QueryPredData_t pdata;
QofQueryPredData *pdata;
if (!q || !param_list) return;
pdata = gncQueryBooleanPredicate (COMPARE_EQUAL, value);
pdata = qof_query_boolean_predicate (QOF_COMPARE_EQUAL, value);
gncQueryAddTerm (q, param_list, pdata, op);
}
@ -1169,14 +1170,14 @@ void gncQueryAddBooleanMatch (QueryNew *q, GSList *param_list, gboolean value,
void gncQueryNewInit (void)
{
PINFO("New Query Module Initialization");
gncQueryCoreInit ();
qof_query_core_init ();
gncQueryObjectInit ();
}
void gncQueryNewShutdown (void)
{
gncQueryObjectShutdown ();
gncQueryCoreShutdown ();
qof_query_core_shutdown ();
}
int gncQueryGetMaxResults (QueryNew *q)
@ -1204,7 +1205,7 @@ GSList * gncQueryTermGetParamPath (QueryNewTerm_t qt)
return qt->param_list;
}
QueryPredData_t gncQueryTermGetPredData (QueryNewTerm_t qt)
QofQueryPredData *gncQueryTermGetPredData (QueryNewTerm_t qt)
{
if (!qt)
return NULL;
@ -1259,7 +1260,7 @@ static gboolean gncQueryTermEqual (QueryNewTerm_t qt1, QueryNewTerm_t qt2)
if (qt1->invert != qt2->invert) return FALSE;
if (param_list_cmp (qt1->param_list, qt2->param_list)) return FALSE;
return gncQueryCorePredicateEqual (qt1->pdata, qt2->pdata);
return qof_query_core_predicate_equal (qt1->pdata, qt2->pdata);
}
static gboolean gncQuerySortEqual (QueryNewSort_t qs1, QueryNewSort_t qs2)
@ -1323,15 +1324,15 @@ static GList *gncQueryPrintTerms (QueryNew * query, GList * output);
static GList *gncQueryPrintSorts (QueryNewSort_t s[], const gint numSorts,
GList * output);
static GList *gncQueryPrintAndTerms (GList * terms, GList * output);
static gchar *gncQueryPrintStringForHow (query_compare_t how);
static gchar *gncQueryPrintStringMatch (string_match_t s);
static gchar *gncQueryPrintDateMatch (date_match_t d);
static gchar *gncQueryPrintNumericMatch (numeric_match_t n);
static gchar *gncQueryPrintGuidMatch (guid_match_t g);
static gchar *gncQueryPrintCharMatch (char_match_t c);
static GString *gncQueryPrintPredData (QueryPredData_t pd);
static gchar *gncQueryPrintStringForHow (QofQueryCompare how);
static gchar *gncQueryPrintStringMatch (QofStringMatch s);
static gchar *gncQueryPrintDateMatch (QofDateMatch d);
static gchar *gncQueryPrintNumericMatch (QofNumericMatch n);
static gchar *gncQueryPrintGuidMatch (QofGuidMatch g);
static gchar *gncQueryPrintCharMatch (QofCharMatch c);
static GString *gncQueryPrintPredData (QofQueryPredData *pd);
static GString *gncQueryPrintParamPath (GSList * parmList);
static void gncQueryPrintValueForParam (QueryPredData_t pd, GString * gs);
static void gncQueryPrintValueForParam (QofQueryPredData *pd, GString * gs);
static void gncQueryPrintOutput (GList * output);
/*
@ -1484,7 +1485,7 @@ gncQueryPrintAndTerms (GList * terms, GList * output)
{
const char *prefix = " AND Terms:";
QueryNewTerm_t qt;
QueryPredData_t pd;
QofQueryPredData *pd;
GSList *path;
GList *lst;
gboolean invert;
@ -1528,7 +1529,7 @@ gncQueryPrintParamPath (GSList * parmList)
Process the PredData of the AND terms
*/
static GString *
gncQueryPrintPredData (QueryPredData_t pd)
gncQueryPrintPredData (QofQueryPredData *pd)
{
GString *gs;
@ -1544,26 +1545,26 @@ gncQueryPrintPredData (QueryPredData_t pd)
/*
Get a string representation for the
query_compare_t enum type.
QofQueryCompare enum type.
*/
static gchar *
gncQueryPrintStringForHow (query_compare_t how)
gncQueryPrintStringForHow (QofQueryCompare how)
{
switch (how)
{
case COMPARE_LT:
return "COMPARE_LT";
case COMPARE_LTE:
return "COMPARE_LTE";
case COMPARE_EQUAL:
return "COMPARE_EQUAL";
case COMPARE_GT:
return "COMPARE_GT";
case COMPARE_GTE:
return "COMPARE_GTE";
case COMPARE_NEQ:
return "COMPARE_NEQ";
case QOF_COMPARE_LT:
return "QOF_COMPARE_LT";
case QOF_QOF_COMPARE_LTE:
return "QOF_QOF_COMPARE_LTE";
case QOF_COMPARE_EQUAL:
return "QOF_COMPARE_EQUAL";
case QOF_COMPARE_GT:
return "QOF_COMPARE_GT";
case QOF_QOF_COMPARE_GTE:
return "QOF_QOF_COMPARE_GTE";
case QOF_COMPARE_NEQ:
return "QOF_COMPARE_NEQ";
}
return "INVALID HOW";
@ -1571,10 +1572,10 @@ gncQueryPrintStringForHow (query_compare_t how)
static void
gncQueryPrintValueForParam (QueryPredData_t pd, GString * gs)
gncQueryPrintValueForParam (QofQueryPredData *pd, GString * gs)
{
if (!safe_strcmp (pd->type_name, QUERYCORE_GUID))
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_GUID))
{
GList *node;
query_guid_t pdata = (query_guid_t) pd;
@ -1587,7 +1588,7 @@ gncQueryPrintValueForParam (QueryPredData_t pd, GString * gs)
}
return;
}
if (!safe_strcmp (pd->type_name, QUERYCORE_STRING))
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_STRING))
{
query_string_t pdata = (query_string_t) pd;
g_string_sprintfa (gs, "\n Match type %s",
@ -1597,7 +1598,7 @@ gncQueryPrintValueForParam (QueryPredData_t pd, GString * gs)
pdata->matchstring);
return;
}
if (!safe_strcmp (pd->type_name, QUERYCORE_NUMERIC))
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_NUMERIC))
{
query_numeric_t pdata = (query_numeric_t) pd;
g_string_sprintfa (gs, "\n Match type %s",
@ -1606,7 +1607,7 @@ gncQueryPrintValueForParam (QueryPredData_t pd, GString * gs)
gnc_numeric_to_string (pdata->amount));
return;
}
if (!safe_strcmp (pd->type_name, QUERYCORE_DATE))
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_DATE))
{
query_date_t pdata = (query_date_t) pd;
g_string_sprintfa (gs, "\n Match type %s",
@ -1614,7 +1615,7 @@ gncQueryPrintValueForParam (QueryPredData_t pd, GString * gs)
g_string_sprintfa (gs, " query_date: %s", gnc_print_date (pdata->date));
return;
}
if (!safe_strcmp (pd->type_name, QUERYCORE_CHAR))
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_CHAR))
{
query_char_t pdata = (query_char_t) pd;
g_string_sprintfa (gs, "\n Match type %s",
@ -1622,7 +1623,7 @@ gncQueryPrintValueForParam (QueryPredData_t pd, GString * gs)
g_string_sprintfa (gs, " char list: %s", pdata->char_list);
return;
}
if (!safe_strcmp (pd->type_name, QUERYCORE_KVP))
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_KVP))
{
GSList *node;
query_kvp_t pdata = (query_kvp_t) pd;
@ -1637,76 +1638,76 @@ gncQueryPrintValueForParam (QueryPredData_t pd, GString * gs)
/*
* Print out a string representation of the
* string_match_t enum
* QofStringMatch enum
*/
static gchar *
gncQueryPrintStringMatch (string_match_t s)
gncQueryPrintStringMatch (QofStringMatch s)
{
switch (s)
{
case STRING_MATCH_NORMAL:
return "STRING_MATCH_NORMAL";
case STRING_MATCH_CASEINSENSITIVE:
return "STRING_MATCH_CASEINSENSITIVE";
case QOF_STRING_MATCH_NORMAL:
return "QOF_STRING_MATCH_NORMAL";
case QOF_STRING_MATCH_CASEINSENSITIVE:
return "QOF_STRING_MATCH_CASEINSENSITIVE";
}
return "UNKNOWN MATCH TYPE";
} /* gncQueryPrintStringMatch */
/*
* Print out a string representation of the
* date_match_t enum
* QofDateMatch enum
*/
static gchar *
gncQueryPrintDateMatch (date_match_t d)
gncQueryPrintDateMatch (QofDateMatch d)
{
switch (d)
{
case DATE_MATCH_NORMAL:
return "DATE_MATCH_NORMAL";
case DATE_MATCH_ROUNDED:
return "DATE_MATCH_ROUNDED";
case QOF_DATE_MATCH_NORMAL:
return "QOF_DATE_MATCH_NORMAL";
case QOF_DATE_MATCH_ROUNDED:
return "QOF_DATE_MATCH_ROUNDED";
}
return "UNKNOWN MATCH TYPE";
} /* gncQueryPrintDateMatch */
/*
* Print out a string representation of the
* numeric_match_t enum
* QofNumericMatch enum
*/
static gchar *
gncQueryPrintNumericMatch (numeric_match_t n)
gncQueryPrintNumericMatch (QofNumericMatch n)
{
switch (n)
{
case NUMERIC_MATCH_DEBIT:
return "NUMERIC_MATCH_DEBIT";
case NUMERIC_MATCH_CREDIT:
return "NUMERIC_MATCH_CREDIT";
case NUMERIC_MATCH_ANY:
return "NUMERIC_MATCH_ANY";
case QOF_NUMERIC_MATCH_DEBIT:
return "QOF_NUMERIC_MATCH_DEBIT";
case QOF_NUMERIC_MATCH_CREDIT:
return "QOF_NUMERIC_MATCH_CREDIT";
case QOF_NUMERIC_MATCH_ANY:
return "QOF_NUMERIC_MATCH_ANY";
}
return "UNKNOWN MATCH TYPE";
} /* gncQueryPrintNumericMatch */
/*
* Print out a string representation of the
* guid_match_t enum
* QofGuidMatch enum
*/
static gchar *
gncQueryPrintGuidMatch (guid_match_t g)
gncQueryPrintGuidMatch (QofGuidMatch g)
{
switch (g)
{
case GUID_MATCH_ANY:
return "GUID_MATCH_ANY";
case GUID_MATCH_ALL:
return "GUID_MATCH_ALL";
case GUID_MATCH_NONE:
return "GUID_MATCH_NONE";
case GUID_MATCH_NULL:
return "GUID_MATCH_NULL";
case GUID_MATCH_LIST_ANY:
return "GUID_MATCH_LIST_ANY";
case QOF_GUID_MATCH_ANY:
return "QOF_GUID_MATCH_ANY";
case QOF_GUID_MATCH_ALL:
return "QOF_GUID_MATCH_ALL";
case QOF_GUID_MATCH_NONE:
return "QOF_GUID_MATCH_NONE";
case QOF_GUID_MATCH_NULL:
return "QOF_GUID_MATCH_NULL";
case QOF_GUID_MATCH_LIST_ANY:
return "QOF_GUID_MATCH_LIST_ANY";
}
return "UNKNOWN MATCH TYPE";
@ -1714,17 +1715,17 @@ gncQueryPrintGuidMatch (guid_match_t g)
/*
* Print out a string representation of the
* char_match_t enum
* QofCharMatch enum
*/
static gchar *
gncQueryPrintCharMatch (char_match_t c)
gncQueryPrintCharMatch (QofCharMatch c)
{
switch (c)
{
case CHAR_MATCH_ANY:
return "CHAR_MATCH_ANY";
case CHAR_MATCH_NONE:
return "CHAR_MATCH_NONE";
case QOF_CHAR_MATCH_ANY:
return "QOF_CHAR_MATCH_ANY";
case QOF_CHAR_MATCH_NONE:
return "QOF_CHAR_MATCH_NONE";
}
return "UNKNOWN MATCH TYPE";
} /* gncQueryPrintGuidMatch */

View File

@ -30,7 +30,7 @@
#define GNC_QUERYNEW_H
#include "GNCId.h"
#include "QueryCore.h"
#include "qofquerycore.h"
#include "qofbook.h"
/** A Query */
@ -86,20 +86,20 @@ void gncQuerySetBook (QueryNew *q, QofBook *book);
*
* For example:
*
* acct_name_pred_data = make_string_pred_data(STRING_MATCH_CASEINSENSITIVE,
* acct_name_pred_data = make_string_pred_data(QOF_STRING_MATCH_CASEINSENSITIVE,
* account_name);
* param_list = make_list (SPLIT_ACCOUNT, ACCOUNT_NAME, NULL);
* gncQueryAddTerm (query, param_list, COMPARE_EQUAL,
* gncQueryAddTerm (query, param_list, QOF_COMPARE_EQUAL,
* acct_name_pred_data, QUERY_AND);
*/
void gncQueryAddTerm (QueryNew *query, GSList *param_list,
QueryPredData_t pred_data, QueryOp op);
QofQueryPredData *pred_data, QueryOp op);
void gncQueryAddGUIDMatch (QueryNew *q, GSList *param_list,
const GUID *guid, QueryOp op);
void gncQueryAddGUIDListMatch (QueryNew *q, GSList *param_list,
GList *guid_list, guid_match_t options,
GList *guid_list, QofGuidMatch options,
QueryOp op);
void gncQueryAddBooleanMatch (QueryNew *q, GSList *param_list, gboolean value,

View File

@ -50,7 +50,7 @@ int gncQueryGetMaxResults (QueryNew *q);
GList * gncQueryGetTerms (QueryNew *q);
GSList * gncQueryTermGetParamPath (QueryNewTerm_t queryterm);
QueryPredData_t gncQueryTermGetPredData (QueryNewTerm_t queryterm);
QofQueryPredData *gncQueryTermGetPredData (QueryNewTerm_t queryterm);
gboolean gncQueryTermIsInverted (QueryNewTerm_t queryterm);

View File

@ -108,7 +108,7 @@ const QueryObjectDef * gncQueryObjectGetParameter (GNCIdTypeConst obj_name,
return (g_hash_table_lookup (ht, parameter));
}
QueryAccess gncQueryObjectGetParameterGetter (GNCIdTypeConst obj_name,
QofQueryAccess gncQueryObjectGetParameterGetter (GNCIdTypeConst obj_name,
const char *parameter)
{
const QueryObjectDef *obj;
@ -123,7 +123,7 @@ QueryAccess gncQueryObjectGetParameterGetter (GNCIdTypeConst obj_name,
return NULL;
}
QueryCoreType gncQueryObjectParameterType (GNCIdTypeConst obj_name,
QofQueryCoreType gncQueryObjectParameterType (GNCIdTypeConst obj_name,
const char *param_name)
{
const QueryObjectDef *obj;

View File

@ -28,7 +28,7 @@
#ifndef GNC_QUERYOBJECT_H
#define GNC_QUERYOBJECT_H
#include "QueryCore.h"
#include "qofquerycore.h"
#include "QueryNew.h"
/** This structure is for each queriable parameter in an object
@ -40,8 +40,8 @@
*/
typedef struct query_object_def {
const char * param_name;
QueryCoreType param_type;
QueryAccess param_getfcn;
QofQueryCoreType param_type;
QofQueryAccess param_getfcn;
} QueryObjectDef;
/** This function is the default sort function for a particular object type */
@ -66,9 +66,9 @@ void gncQueryObjectRegister (GNCIdTypeConst obj_name,
* #define MY_QUERY_OBJ_TRANS "trans"
*
* static QueryObjectDef myQueryObjectParams[] = {
* { MY_QUERY_OBJ_MEMO, QUERYCORE_STRING, myMemoGetter },
* { MY_QUERY_OBJ_VALUE, QUERYCORE_NUMERIC, myValueGetter },
* { MY_QUERY_OBJ_DATE, QUERYCORE_DATE, myDateGetter },
* { MY_QUERY_OBJ_MEMO, QOF_QUERYCORE_STRING, myMemoGetter },
* { MY_QUERY_OBJ_VALUE, QOF_QUERYCORE_NUMERIC, myValueGetter },
* { MY_QUERY_OBJ_DATE, QOF_QUERYCORE_DATE, myDateGetter },
* { MY_QUERY_OBJ_ACCOUNT, GNC_ID_ACCOUNT, myAccountGetter },
* { MY_QUERY_OBJ_TRANS, GNC_ID_TRANS, myTransactionGetter },
* NULL };
@ -78,7 +78,7 @@ void gncQueryObjectRegister (GNCIdTypeConst obj_name,
*/
/** Return the core datatype of the specified object's parameter */
QueryCoreType gncQueryObjectParameterType (GNCIdTypeConst obj_name,
QofQueryCoreType gncQueryObjectParameterType (GNCIdTypeConst obj_name,
const char *param_name);
/** Return the registered Object Definition for the requested parameter */
@ -86,7 +86,7 @@ const QueryObjectDef * gncQueryObjectGetParameter (GNCIdTypeConst obj_name,
const char *parameter);
/** Return the object's parameter getter function */
QueryAccess gncQueryObjectGetParameterGetter (GNCIdTypeConst obj_name,
QofQueryAccess gncQueryObjectGetParameterGetter (GNCIdTypeConst obj_name,
const char *parameter);

View File

@ -3592,38 +3592,38 @@ static gpointer no_op (gpointer obj)
gboolean xaccSplitRegister (void)
{
static const QueryObjectDef params[] = {
{ SPLIT_KVP, QUERYCORE_KVP, (QueryAccess)xaccSplitGetSlots },
{ SPLIT_DATE_RECONCILED, QUERYCORE_DATE,
(QueryAccess)xaccSplitRetDateReconciledTS },
{ "d-share-amount", QUERYCORE_DOUBLE,
(QueryAccess)DxaccSplitGetShareAmount },
{ "d-share-int64", QUERYCORE_INT64, (QueryAccess)xaccSplitGetGUID },
{ SPLIT_BALANCE, QUERYCORE_NUMERIC, (QueryAccess)xaccSplitGetBalance },
{ SPLIT_CLEARED_BALANCE, QUERYCORE_NUMERIC,
(QueryAccess)xaccSplitGetClearedBalance },
{ SPLIT_RECONCILED_BALANCE, QUERYCORE_NUMERIC,
(QueryAccess)xaccSplitGetReconciledBalance },
{ SPLIT_MEMO, QUERYCORE_STRING, (QueryAccess)xaccSplitGetMemo },
{ SPLIT_ACTION, QUERYCORE_STRING, (QueryAccess)xaccSplitGetAction },
{ SPLIT_RECONCILE, QUERYCORE_CHAR, (QueryAccess)xaccSplitGetReconcile },
{ SPLIT_AMOUNT, QUERYCORE_NUMERIC, (QueryAccess)xaccSplitGetAmount },
{ SPLIT_SHARE_PRICE, QUERYCORE_NUMERIC,
(QueryAccess)xaccSplitGetSharePrice },
{ SPLIT_VALUE, QUERYCORE_DEBCRED, (QueryAccess)xaccSplitGetValue },
{ SPLIT_TYPE, QUERYCORE_STRING, (QueryAccess)xaccSplitGetType },
{ SPLIT_VOIDED_AMOUNT, QUERYCORE_NUMERIC,
(QueryAccess)xaccSplitVoidFormerAmount },
{ SPLIT_VOIDED_VALUE, QUERYCORE_NUMERIC,
(QueryAccess)xaccSplitVoidFormerValue },
{ SPLIT_LOT, GNC_ID_LOT, (QueryAccess)xaccSplitGetLot },
{ SPLIT_TRANS, GNC_ID_TRANS, (QueryAccess)xaccSplitGetParent },
{ SPLIT_ACCOUNT, GNC_ID_ACCOUNT, (QueryAccess)xaccSplitGetAccount },
{ SPLIT_ACCOUNT_GUID, QUERYCORE_GUID, split_account_guid_getter },
{ SPLIT_KVP, QOF_QUERYCORE_KVP, (QofQueryAccess)xaccSplitGetSlots },
{ SPLIT_DATE_RECONCILED, QOF_QUERYCORE_DATE,
(QofQueryAccess)xaccSplitRetDateReconciledTS },
{ "d-share-amount", QOF_QUERYCORE_DOUBLE,
(QofQueryAccess)DxaccSplitGetShareAmount },
{ "d-share-int64", QOF_QUERYCORE_INT64, (QofQueryAccess)xaccSplitGetGUID },
{ SPLIT_BALANCE, QOF_QUERYCORE_NUMERIC, (QofQueryAccess)xaccSplitGetBalance },
{ SPLIT_CLEARED_BALANCE, QOF_QUERYCORE_NUMERIC,
(QofQueryAccess)xaccSplitGetClearedBalance },
{ SPLIT_RECONCILED_BALANCE, QOF_QUERYCORE_NUMERIC,
(QofQueryAccess)xaccSplitGetReconciledBalance },
{ SPLIT_MEMO, QOF_QUERYCORE_STRING, (QofQueryAccess)xaccSplitGetMemo },
{ SPLIT_ACTION, QOF_QUERYCORE_STRING, (QofQueryAccess)xaccSplitGetAction },
{ SPLIT_RECONCILE, QOF_QUERYCORE_CHAR, (QofQueryAccess)xaccSplitGetReconcile },
{ SPLIT_AMOUNT, QOF_QUERYCORE_NUMERIC, (QofQueryAccess)xaccSplitGetAmount },
{ SPLIT_SHARE_PRICE, QOF_QUERYCORE_NUMERIC,
(QofQueryAccess)xaccSplitGetSharePrice },
{ SPLIT_VALUE, QOF_QUERYCORE_DEBCRED, (QofQueryAccess)xaccSplitGetValue },
{ SPLIT_TYPE, QOF_QUERYCORE_STRING, (QofQueryAccess)xaccSplitGetType },
{ SPLIT_VOIDED_AMOUNT, QOF_QUERYCORE_NUMERIC,
(QofQueryAccess)xaccSplitVoidFormerAmount },
{ SPLIT_VOIDED_VALUE, QOF_QUERYCORE_NUMERIC,
(QofQueryAccess)xaccSplitVoidFormerValue },
{ SPLIT_LOT, GNC_ID_LOT, (QofQueryAccess)xaccSplitGetLot },
{ SPLIT_TRANS, GNC_ID_TRANS, (QofQueryAccess)xaccSplitGetParent },
{ SPLIT_ACCOUNT, GNC_ID_ACCOUNT, (QofQueryAccess)xaccSplitGetAccount },
{ SPLIT_ACCOUNT_GUID, QOF_QUERYCORE_GUID, split_account_guid_getter },
{ SPLIT_ACCT_FULLNAME, SPLIT_ACCT_FULLNAME, no_op },
{ SPLIT_CORR_ACCT_NAME, SPLIT_CORR_ACCT_NAME, no_op },
{ SPLIT_CORR_ACCT_CODE, SPLIT_CORR_ACCT_CODE, no_op },
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)xaccSplitGetBook },
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess) xaccSplitGetGUID },
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QofQueryAccess)xaccSplitGetBook },
{ QUERY_PARAM_GUID, QOF_QUERYCORE_GUID, (QofQueryAccess) xaccSplitGetGUID },
{ NULL },
};
@ -3670,22 +3670,22 @@ trans_is_balanced_p (const Transaction *txn)
gboolean xaccTransRegister (void)
{
static QueryObjectDef params[] = {
{ TRANS_KVP, QUERYCORE_KVP, (QueryAccess)xaccTransGetSlots },
{ TRANS_NUM, QUERYCORE_STRING, (QueryAccess)xaccTransGetNum },
{ TRANS_DESCRIPTION, QUERYCORE_STRING, (QueryAccess)xaccTransGetDescription },
{ TRANS_DATE_ENTERED, QUERYCORE_DATE, (QueryAccess)xaccTransRetDateEnteredTS },
{ TRANS_DATE_POSTED, QUERYCORE_DATE, (QueryAccess)xaccTransRetDatePostedTS },
{ TRANS_DATE_DUE, QUERYCORE_DATE, (QueryAccess)xaccTransRetDateDueTS },
{ TRANS_IMBALANCE, QUERYCORE_NUMERIC, (QueryAccess)xaccTransGetImbalance },
{ TRANS_NOTES, QUERYCORE_STRING, (QueryAccess)xaccTransGetNotes },
{ TRANS_IS_BALANCED, QUERYCORE_BOOLEAN, (QueryAccess)trans_is_balanced_p },
{ TRANS_TYPE, QUERYCORE_CHAR, (QueryAccess)xaccTransGetTxnType },
{ TRANS_VOID_STATUS, QUERYCORE_BOOLEAN, (QueryAccess)xaccTransGetVoidStatus },
{ TRANS_VOID_REASON, QUERYCORE_STRING, (QueryAccess)xaccTransGetVoidReason },
{ TRANS_VOID_TIME, QUERYCORE_DATE, (QueryAccess)xaccTransGetVoidTime },
{ TRANS_SPLITLIST, GNC_ID_SPLIT, (QueryAccess)xaccTransGetSplitList },
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)xaccTransGetBook },
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess)xaccTransGetGUID },
{ TRANS_KVP, QOF_QUERYCORE_KVP, (QofQueryAccess)xaccTransGetSlots },
{ TRANS_NUM, QOF_QUERYCORE_STRING, (QofQueryAccess)xaccTransGetNum },
{ TRANS_DESCRIPTION, QOF_QUERYCORE_STRING, (QofQueryAccess)xaccTransGetDescription },
{ TRANS_DATE_ENTERED, QOF_QUERYCORE_DATE, (QofQueryAccess)xaccTransRetDateEnteredTS },
{ TRANS_DATE_POSTED, QOF_QUERYCORE_DATE, (QofQueryAccess)xaccTransRetDatePostedTS },
{ TRANS_DATE_DUE, QOF_QUERYCORE_DATE, (QofQueryAccess)xaccTransRetDateDueTS },
{ TRANS_IMBALANCE, QOF_QUERYCORE_NUMERIC, (QofQueryAccess)xaccTransGetImbalance },
{ TRANS_NOTES, QOF_QUERYCORE_STRING, (QofQueryAccess)xaccTransGetNotes },
{ TRANS_IS_BALANCED, QOF_QUERYCORE_BOOLEAN, (QofQueryAccess)trans_is_balanced_p },
{ TRANS_TYPE, QOF_QUERYCORE_CHAR, (QofQueryAccess)xaccTransGetTxnType },
{ TRANS_VOID_STATUS, QOF_QUERYCORE_BOOLEAN, (QofQueryAccess)xaccTransGetVoidStatus },
{ TRANS_VOID_REASON, QOF_QUERYCORE_STRING, (QofQueryAccess)xaccTransGetVoidReason },
{ TRANS_VOID_TIME, QOF_QUERYCORE_DATE, (QofQueryAccess)xaccTransGetVoidTime },
{ TRANS_SPLITLIST, GNC_ID_SPLIT, (QofQueryAccess)xaccTransGetSplitList },
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QofQueryAccess)xaccTransGetBook },
{ QUERY_PARAM_GUID, QOF_QUERYCORE_GUID, (QofQueryAccess)xaccTransGetGUID },
{ NULL },
};

View File

@ -32,7 +32,6 @@
#include "Backend.h"
#include "Group.h"
#include "QueryNewP.h"
#include "QueryCoreP.h"
#include "engine-helpers.h"
#include "glib-helpers.h"
#include "gnc-date.h"
@ -41,6 +40,8 @@
#include "gnc-numeric.h"
#include "guile-mappings.h"
#include "qofbook.h"
#include "qofquerycore.h"
#include "qofquerycore-p.h"
static short module = MOD_ENGINE;
@ -230,146 +231,146 @@ gnc_gw_enum_scm2val (const char *typestr, SCM enum_scm)
return scm_num2int (scm, SCM_ARG1, __FUNCTION__);
}
/* query_compare_t */
/* QofQueryCompare */
static SCM
gnc_query_compare2scm (query_compare_t how)
gnc_query_compare2scm (QofQueryCompare how)
{
return gnc_gw_enum_val2scm ("<gnc:query-compare-how>", how);
}
static query_compare_t
static QofQueryCompare
gnc_query_scm2compare (SCM how_scm)
{
return gnc_gw_enum_scm2val ("<gnc:query-compare-how>", how_scm);
}
/* string_match_t */
/* QofStringMatch */
static SCM
gnc_query_string2scm (string_match_t how)
gnc_query_string2scm (QofStringMatch how)
{
return gnc_gw_enum_val2scm ("<gnc:string-match-how>", how);
}
static string_match_t
static QofStringMatch
gnc_query_scm2string (SCM how_scm)
{
return gnc_gw_enum_scm2val ("<gnc:string-match-how>", how_scm);
}
/* date_match_t */
/* QofDateMatch */
static SCM
gnc_query_date2scm (date_match_t how)
gnc_query_date2scm (QofDateMatch how)
{
return gnc_gw_enum_val2scm ("<gnc:date-match-how>", how);
}
static date_match_t
static QofDateMatch
gnc_query_scm2date (SCM how_scm)
{
return gnc_gw_enum_scm2val ("<gnc:date-match-how>", how_scm);
}
/* numeric_match_t */
/* QofNumericMatch */
static SCM
gnc_query_numericop2scm (numeric_match_t how)
gnc_query_numericop2scm (QofNumericMatch how)
{
return gnc_gw_enum_val2scm ("<gnc:numeric-match-how>", how);
}
static numeric_match_t
static QofNumericMatch
gnc_query_scm2numericop (SCM how_scm)
{
return gnc_gw_enum_scm2val ("<gnc:numeric-match-how>", how_scm);
}
/* guid_match_t */
/* QofGuidMatch */
static SCM
gnc_query_guid2scm (guid_match_t how)
gnc_query_guid2scm (QofGuidMatch how)
{
return gnc_gw_enum_val2scm ("<gnc:guid-match-how>", how);
}
static guid_match_t
static QofGuidMatch
gnc_query_scm2guid (SCM how_scm)
{
return gnc_gw_enum_scm2val ("<gnc:guid-match-how>", how_scm);
}
/* char_match_t */
/* QofCharMatch */
static SCM
gnc_query_char2scm (char_match_t how)
gnc_query_char2scm (QofCharMatch how)
{
return gnc_gw_enum_val2scm ("<gnc:char-match-how>", how);
}
static char_match_t
static QofCharMatch
gnc_query_scm2char (SCM how_scm)
{
return gnc_gw_enum_scm2val ("<gnc:char-match-how>", how_scm);
}
static guid_match_t
static QofGuidMatch
gnc_scm2acct_match_how (SCM how_scm)
{
guid_match_t res;
QofGuidMatch res;
char *how = gh_symbol2newstr (how_scm, NULL);
if (!safe_strcmp (how, "acct-match-all"))
res = GUID_MATCH_ALL;
res = QOF_GUID_MATCH_ALL;
else if (!safe_strcmp (how, "acct-match-any"))
res = GUID_MATCH_ANY;
res = QOF_GUID_MATCH_ANY;
else if (!safe_strcmp (how, "acct-match-none"))
res = GUID_MATCH_NONE;
res = QOF_GUID_MATCH_NONE;
else {
PINFO ("invalid account match: %s", how);
res = GUID_MATCH_NULL;
res = QOF_GUID_MATCH_NULL;
}
if (how) free (how);
return res;
}
static query_compare_t
static QofQueryCompare
gnc_scm2amt_match_how (SCM how_scm)
{
query_compare_t res;
QofQueryCompare res;
char *how = gh_symbol2newstr (how_scm, NULL);
if (!safe_strcmp (how, "amt-match-atleast"))
res = COMPARE_GTE;
res = QOF_QOF_COMPARE_GTE;
else if (!safe_strcmp (how, "amt-match-atmost"))
res = COMPARE_LTE;
res = QOF_QOF_COMPARE_LTE;
else if (!safe_strcmp (how, "amt-match-exactly"))
res = COMPARE_EQUAL;
res = QOF_COMPARE_EQUAL;
else {
PINFO ("invalid amount match: %s", how);
res = COMPARE_EQUAL;
res = QOF_COMPARE_EQUAL;
}
if (how) free (how);
return res;
}
static query_compare_t
static QofQueryCompare
gnc_scm2kvp_match_how (SCM how_scm)
{
query_compare_t res;
QofQueryCompare res;
char *how = gh_symbol2newstr (how_scm, NULL);
if (!safe_strcmp (how, "kvp-match-lt"))
res = COMPARE_LT;
res = QOF_COMPARE_LT;
else if (!safe_strcmp (how, "kvp-match-lte"))
res = COMPARE_LTE;
res = QOF_QOF_COMPARE_LTE;
else if (!safe_strcmp (how, "kvp-match-eq"))
res = COMPARE_EQUAL;
res = QOF_COMPARE_EQUAL;
else if (!safe_strcmp (how, "kvp-match-gte"))
res = COMPARE_GTE;
res = QOF_QOF_COMPARE_GTE;
else if (!safe_strcmp (how, "kvp-match-gt"))
res = COMPARE_GT;
res = QOF_COMPARE_GT;
else {
PINFO ("invalid kvp match: %s", how);
res = COMPARE_EQUAL;
res = QOF_COMPARE_EQUAL;
}
if (how) free (how);
@ -865,7 +866,7 @@ static SCM
gnc_queryterm2scm (QueryNewTerm_t qt)
{
SCM qt_scm = SCM_EOL;
QueryPredData_t pd = NULL;
QofQueryPredData *pd = NULL;
qt_scm = scm_cons (gnc_query_path2scm (gncQueryTermGetParamPath (qt)),
qt_scm);
@ -875,53 +876,53 @@ gnc_queryterm2scm (QueryNewTerm_t qt)
qt_scm = scm_cons (scm_str2symbol (pd->type_name), qt_scm);
qt_scm = scm_cons (gnc_query_compare2scm (pd->how), qt_scm);
if (!safe_strcmp (pd->type_name, QUERYCORE_STRING)) {
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_STRING)) {
query_string_t pdata = (query_string_t) pd;
qt_scm = scm_cons (gnc_query_string2scm (pdata->options), qt_scm);
qt_scm = scm_cons (SCM_BOOL (pdata->is_regex), qt_scm);
qt_scm = scm_cons (scm_makfrom0str (pdata->matchstring), qt_scm);
} else if (!safe_strcmp (pd->type_name, QUERYCORE_DATE)) {
} else if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_DATE)) {
query_date_t pdata = (query_date_t) pd;
qt_scm = scm_cons (gnc_query_date2scm (pdata->options), qt_scm);
qt_scm = scm_cons (gnc_timespec2timepair (pdata->date), qt_scm);
} else if (!safe_strcmp (pd->type_name, QUERYCORE_NUMERIC)) {
} else if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_NUMERIC)) {
query_numeric_t pdata = (query_numeric_t) pd;
qt_scm = scm_cons (gnc_query_numericop2scm (pdata->options), qt_scm);
qt_scm = scm_cons (gnc_query_numeric2scm (pdata->amount), qt_scm);
} else if (!safe_strcmp (pd->type_name, QUERYCORE_GUID)) {
} else if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_GUID)) {
query_guid_t pdata = (query_guid_t) pd;
qt_scm = scm_cons (gnc_query_guid2scm (pdata->options), qt_scm);
qt_scm = scm_cons (gnc_guid_glist2scm (pdata->guids), qt_scm);
} else if (!safe_strcmp (pd->type_name, QUERYCORE_INT64)) {
} else if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_INT64)) {
query_int64_t pdata = (query_int64_t) pd;
qt_scm = scm_cons (gnc_gint64_to_scm (pdata->val), qt_scm);
} else if (!safe_strcmp (pd->type_name, QUERYCORE_DOUBLE)) {
} else if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_DOUBLE)) {
query_double_t pdata = (query_double_t) pd;
qt_scm = scm_cons (scm_make_real (pdata->val), qt_scm);
} else if (!safe_strcmp (pd->type_name, QUERYCORE_BOOLEAN)) {
} else if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_BOOLEAN)) {
query_boolean_t pdata = (query_boolean_t) pd;
qt_scm = scm_cons (SCM_BOOL (pdata->val), qt_scm);
} else if (!safe_strcmp (pd->type_name, QUERYCORE_CHAR)) {
} else if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_CHAR)) {
query_char_t pdata = (query_char_t) pd;
qt_scm = scm_cons (gnc_query_char2scm (pdata->options), qt_scm);
qt_scm = scm_cons (scm_makfrom0str (pdata->char_list), qt_scm);
} else if (!safe_strcmp (pd->type_name, QUERYCORE_KVP)) {
} else if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_KVP)) {
query_kvp_t pdata = (query_kvp_t) pd;
qt_scm = scm_cons (gnc_query_path2scm (pdata->path), qt_scm);
@ -939,12 +940,12 @@ static Query *
gnc_scm2query_term_query_v2 (SCM qt_scm)
{
Query *q = NULL;
QueryPredData_t pd = NULL;
QofQueryPredData *pd = NULL;
SCM scm;
char *type = NULL;
GSList *path = NULL;
gboolean inverted = FALSE;
query_compare_t compare_how;
QofQueryCompare compare_how;
if (!SCM_LISTP (qt_scm) || SCM_NULLP (qt_scm))
return NULL;
@ -971,7 +972,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
break;
type = gh_symbol2newstr (scm, NULL);
/* query_compare_t */
/* QofQueryCompare */
scm = SCM_CAR (qt_scm);
qt_scm = SCM_CDR (qt_scm);
if (SCM_NULLP (scm))
@ -980,8 +981,8 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
/* Now compute the predicate */
if (!safe_strcmp (type, QUERYCORE_STRING)) {
string_match_t options;
if (!safe_strcmp (type, QOF_QUERYCORE_STRING)) {
QofStringMatch options;
gboolean is_regex;
char *matchstring;
@ -1003,12 +1004,12 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
break;
matchstring = gh_scm2newstr (scm, NULL);
pd = gncQueryStringPredicate (compare_how, matchstring,
pd = qof_query_string_predicate (compare_how, matchstring,
options, is_regex);
free (matchstring);
} else if (!safe_strcmp (type, QUERYCORE_DATE)) {
date_match_t options;
} else if (!safe_strcmp (type, QOF_QUERYCORE_DATE)) {
QofDateMatch options;
Timespec date;
scm = SCM_CAR (qt_scm);
@ -1023,10 +1024,10 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
break;
date = gnc_timepair2timespec (scm);
pd = gncQueryDatePredicate (compare_how, options, date);
pd = qof_query_date_predicate (compare_how, options, date);
} else if (!safe_strcmp (type, QUERYCORE_NUMERIC)) {
numeric_match_t options;
} else if (!safe_strcmp (type, QOF_QUERYCORE_NUMERIC)) {
QofNumericMatch options;
gnc_numeric val;
scm = SCM_CAR (qt_scm);
@ -1041,10 +1042,10 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
break;
val = gnc_query_scm2numeric (scm);
pd = gncQueryNumericPredicate (compare_how, options, val);
pd = qof_query_numeric_predicate (compare_how, options, val);
} else if (!safe_strcmp (type, QUERYCORE_GUID)) {
guid_match_t options;
} else if (!safe_strcmp (type, QOF_QUERYCORE_GUID)) {
QofGuidMatch options;
GList *guids;
scm = SCM_CAR (qt_scm);
@ -1059,11 +1060,11 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
break;
guids = gnc_scm2guid_glist (scm);
pd = gncQueryGUIDPredicate (options, guids);
pd = qof_query_guid_predicate (options, guids);
gnc_guid_glist_free (guids);
} else if (!safe_strcmp (type, QUERYCORE_INT64)) {
} else if (!safe_strcmp (type, QOF_QUERYCORE_INT64)) {
gint64 val;
scm = SCM_CAR (qt_scm);
@ -1072,9 +1073,9 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
break;
val = gnc_scm_to_gint64 (scm);
pd = gncQueryInt64Predicate (compare_how, val);
pd = qof_query_int64_predicate (compare_how, val);
} else if (!safe_strcmp (type, QUERYCORE_DOUBLE)) {
} else if (!safe_strcmp (type, QOF_QUERYCORE_DOUBLE)) {
double val;
scm = SCM_CAR (qt_scm);
@ -1083,9 +1084,9 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
break;
val = scm_num2dbl (scm, __FUNCTION__);
pd = gncQueryDoublePredicate (compare_how, val);
pd = qof_query_double_predicate (compare_how, val);
} else if (!safe_strcmp (type, QUERYCORE_BOOLEAN)) {
} else if (!safe_strcmp (type, QOF_QUERYCORE_BOOLEAN)) {
gboolean val;
scm = SCM_CAR (qt_scm);
@ -1094,10 +1095,10 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
break;
val = SCM_NFALSEP (scm);
pd = gncQueryBooleanPredicate (compare_how, val);
pd = qof_query_boolean_predicate (compare_how, val);
} else if (!safe_strcmp (type, QUERYCORE_CHAR)) {
char_match_t options;
} else if (!safe_strcmp (type, QOF_QUERYCORE_CHAR)) {
QofCharMatch options;
char *char_list;
scm = SCM_CAR (qt_scm);
@ -1112,10 +1113,10 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
break;
char_list = gh_scm2newstr (scm, NULL);
pd = gncQueryCharPredicate (options, char_list);
pd = qof_query_char_predicate (options, char_list);
free (char_list);
} else if (!safe_strcmp (type, QUERYCORE_KVP)) {
} else if (!safe_strcmp (type, QOF_QUERYCORE_KVP)) {
GSList *kvp_path;
kvp_value *value;
@ -1133,7 +1134,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
}
value = gnc_scm2kvp_value (scm);
pd = gncQueryKVPPredicate (compare_how, kvp_path, value);
pd = qof_query_kvp_predicate (compare_how, kvp_path, value);
gnc_query_path_free (kvp_path);
kvp_value_delete (value);
@ -1249,8 +1250,8 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
ok = TRUE;
} else if (!safe_strcmp (pd_type, "pd-amount")) {
query_compare_t how;
numeric_match_t amt_sgn;
QofQueryCompare how;
QofNumericMatch amt_sgn;
double amount;
gnc_numeric val;
@ -1294,7 +1295,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
}
} else if (!safe_strcmp (pd_type, "pd-account")) {
guid_match_t how;
QofGuidMatch how;
GList *account_guids;
/* how */
@ -1432,7 +1433,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
} else if (!safe_strcmp (pd_type, "pd-kvp")) {
GSList *path;
kvp_value *value;
query_compare_t how;
QofQueryCompare how;
GNCIdType where;
/* how */

View File

@ -330,10 +330,10 @@ gnc_lot_get_latest_split (GNCLot *lot)
void gnc_lot_register (void)
{
static const QueryObjectDef params[] = {
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)gnc_lot_get_book },
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess)gnc_lot_get_guid },
{ LOT_IS_CLOSED, QUERYCORE_BOOLEAN, (QueryAccess)gnc_lot_is_closed },
{ LOT_BALANCE, QUERYCORE_NUMERIC, (QueryAccess)gnc_lot_get_balance },
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QofQueryAccess)gnc_lot_get_book },
{ QUERY_PARAM_GUID, QOF_QUERYCORE_GUID, (QofQueryAccess)gnc_lot_get_guid },
{ LOT_IS_CLOSED, QOF_QUERYCORE_BOOLEAN, (QofQueryAccess)gnc_lot_is_closed },
{ LOT_BALANCE, QOF_QUERYCORE_NUMERIC, (QofQueryAccess)gnc_lot_get_balance },
{ NULL },
};

View File

@ -127,29 +127,29 @@
(gw:enum-add-value! wt "QUERY_NOR" 'query-nor)
(gw:enum-add-value! wt "QUERY_XOR" 'query-xor))
(let ((wt (gw:wrap-enumeration ws '<gnc:query-compare-how> "query_compare_t")))
(gw:enum-add-value! wt "COMPARE_LT" 'query-compare-lt)
(gw:enum-add-value! wt "COMPARE_LTE" 'query-compare-lte)
(gw:enum-add-value! wt "COMPARE_EQUAL" 'query-compare-equal)
(gw:enum-add-value! wt "COMPARE_GT" 'query-compare-gt)
(gw:enum-add-value! wt "COMPARE_GTE" 'query-compare-gte)
(gw:enum-add-value! wt "COMPARE_NEQ" 'query-compare-neq)
(let ((wt (gw:wrap-enumeration ws '<gnc:query-compare-how> "QofQueryCompare")))
(gw:enum-add-value! wt "QOF_COMPARE_LT" 'query-compare-lt)
(gw:enum-add-value! wt "QOF_QOF_COMPARE_LTE" 'query-compare-lte)
(gw:enum-add-value! wt "QOF_COMPARE_EQUAL" 'query-compare-equal)
(gw:enum-add-value! wt "QOF_COMPARE_GT" 'query-compare-gt)
(gw:enum-add-value! wt "QOF_QOF_COMPARE_GTE" 'query-compare-gte)
(gw:enum-add-value! wt "QOF_COMPARE_NEQ" 'query-compare-neq)
#t)
(let ((wt (gw:wrap-enumeration ws '<gnc:string-match-how> "string_match_t")))
(gw:enum-add-value! wt "STRING_MATCH_NORMAL" 'string-match-normal)
(gw:enum-add-value! wt "STRING_MATCH_CASEINSENSITIVE" 'string-match-caseinsensitive)
(let ((wt (gw:wrap-enumeration ws '<gnc:string-match-how> "QofStringMatch")))
(gw:enum-add-value! wt "QOF_STRING_MATCH_NORMAL" 'string-match-normal)
(gw:enum-add-value! wt "QOF_STRING_MATCH_CASEINSENSITIVE" 'string-match-caseinsensitive)
#t)
(let ((wt (gw:wrap-enumeration ws '<gnc:date-match-how> "date_match_t")))
(gw:enum-add-value! wt "DATE_MATCH_NORMAL" 'date-match-normal)
(gw:enum-add-value! wt "DATE_MATCH_ROUNDED" 'date-match-rounded)
(let ((wt (gw:wrap-enumeration ws '<gnc:date-match-how> "QofDateMatch")))
(gw:enum-add-value! wt "QOF_DATE_MATCH_NORMAL" 'date-match-normal)
(gw:enum-add-value! wt "QOF_DATE_MATCH_ROUNDED" 'date-match-rounded)
#t)
(let ((wt (gw:wrap-enumeration ws '<gnc:numeric-match-how> "numeric_match_t")))
(gw:enum-add-value! wt "NUMERIC_MATCH_ANY" 'amt-sgn-match-either)
(gw:enum-add-value! wt "NUMERIC_MATCH_CREDIT" 'amt-sgn-match-credit)
(gw:enum-add-value! wt "NUMERIC_MATCH_DEBIT" 'amt-sgn-match-debit)
(let ((wt (gw:wrap-enumeration ws '<gnc:numeric-match-how> "QofNumericMatch")))
(gw:enum-add-value! wt "QOF_NUMERIC_MATCH_ANY" 'amt-sgn-match-either)
(gw:enum-add-value! wt "QOF_NUMERIC_MATCH_CREDIT" 'amt-sgn-match-credit)
(gw:enum-add-value! wt "QOF_NUMERIC_MATCH_DEBIT" 'amt-sgn-match-debit)
#t)
(let ((wt (gw:wrap-enumeration ws '<gnc:cleared-match-how> "cleared_match_t")))
@ -160,17 +160,17 @@
(gw:enum-add-value! wt "CLEARED_VOIDED" 'cleared-match-voided)
#t)
(let ((wt (gw:wrap-enumeration ws '<gnc:guid-match-how> "guid_match_t")))
(gw:enum-add-value! wt "GUID_MATCH_ALL" 'guid-match-all)
(gw:enum-add-value! wt "GUID_MATCH_ANY" 'guid-match-any)
(gw:enum-add-value! wt "GUID_MATCH_NULL" 'guid-match-null)
(gw:enum-add-value! wt "GUID_MATCH_NONE" 'guid-match-none)
(gw:enum-add-value! wt "GUID_MATCH_LIST_ANY" 'guid-match-list-any)
(let ((wt (gw:wrap-enumeration ws '<gnc:guid-match-how> "QofGuidMatch")))
(gw:enum-add-value! wt "QOF_GUID_MATCH_ALL" 'guid-match-all)
(gw:enum-add-value! wt "QOF_GUID_MATCH_ANY" 'guid-match-any)
(gw:enum-add-value! wt "QOF_GUID_MATCH_NULL" 'guid-match-null)
(gw:enum-add-value! wt "QOF_GUID_MATCH_NONE" 'guid-match-none)
(gw:enum-add-value! wt "QOF_GUID_MATCH_LIST_ANY" 'guid-match-list-any)
#t)
(let ((wt (gw:wrap-enumeration ws '<gnc:char-match-how> "char_match_t")))
(gw:enum-add-value! wt "CHAR_MATCH_ANY" 'char-match-any)
(gw:enum-add-value! wt "CHAR_MATCH_NONE" 'char-match-none)
(let ((wt (gw:wrap-enumeration ws '<gnc:char-match-how> "QofCharMatch")))
(gw:enum-add-value! wt "QOF_CHAR_MATCH_ANY" 'char-match-any)
(gw:enum-add-value! wt "QOF_CHAR_MATCH_NONE" 'char-match-none)
#t)
(let ((wt (gw:wrap-enumeration ws '<gnc:query-txn-match-t> "query_txn_match_t")))

View File

@ -293,8 +293,8 @@ qof_book_get_counter (QofBook *book, const char *counter_name)
gboolean qof_book_register (void)
{
static QueryObjectDef params[] = {
{ QOF_BOOK_KVP, QUERYCORE_KVP, (QueryAccess)qof_book_get_slots },
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess)qof_book_get_guid },
{ QOF_BOOK_KVP, QOF_QUERYCORE_KVP, (QofQueryAccess)qof_book_get_slots },
{ QUERY_PARAM_GUID, QOF_QUERYCORE_GUID, (QofQueryAccess)qof_book_get_guid },
{ NULL },
};

View File

@ -1,5 +1,5 @@
/********************************************************************\
* QueryCoreP.h -- Internal API for providing core Query data types *
* qofquerycore-p.h -- Private API for providing core Query data types *
* Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU> *
* *
* This program is free software; you can redistribute it and/or *
@ -21,8 +21,8 @@
* *
\********************************************************************/
#ifndef GNC_QUERYCOREP_H
#define GNC_QUERYCOREP_H
#ifndef QOF_QUERYCOREP_H
#define QOF_QUERYCOREP_H
#include <sys/types.h>
#include <time.h>
@ -30,11 +30,11 @@
#include <regex.h>
#include <string.h>
#include "QueryCore.h"
#include "qofquerycore.h"
/* Initalize the Query Core registry and install the default type handlers */
void gncQueryCoreInit(void);
void gncQueryCoreShutdown (void);
void qof_query_core_init(void);
void qof_query_core_shutdown (void);
/*
* An arbitrary Query Predicate. Given the gnucash object and the
@ -43,8 +43,8 @@ void gncQueryCoreShutdown (void);
* predicate data
*/
typedef int (*QueryPredicate) (gpointer object,
QueryAccess get_fcn,
QueryPredData_t pdata);
QofQueryAccess get_fcn,
QofQueryPredData *pdata);
/* A callback for how to compare two (same-type) objects based on a
* common get_fcn (parameter member), using the provided comparrison
@ -52,19 +52,19 @@ typedef int (*QueryPredicate) (gpointer object,
*/
typedef int (*QueryCompare) (gpointer a, gpointer b,
gint compare_options,
QueryAccess get_fcn);
QofQueryAccess get_fcn);
/* Lookup functions */
QueryPredicate gncQueryCoreGetPredicate (char const *type);
QueryCompare gncQueryCoreGetCompare (char const *type);
QueryPredicate qof_query_core_get_predicate (char const *type);
QueryCompare qof_query_core_get_compare (char const *type);
/* Compare two predicates */
gboolean gncQueryCorePredicateEqual (QueryPredData_t p1, QueryPredData_t p2);
gboolean qof_query_core_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2);
/* Predicate Data Structures:
*
* These are defined such that you can cast between these types and
* a QueryPredData_t.
* a QofQueryPredData.
*
* Note that these are provided for READ ONLY PURPOSES. You should NEVER
* write into these structures, change them, or use them to create a
@ -72,61 +72,61 @@ gboolean gncQueryCorePredicateEqual (QueryPredData_t p1, QueryPredData_t p2);
*/
typedef struct {
QueryPredDataDef pd;
string_match_t options;
QofQueryPredData pd;
QofStringMatch options;
gboolean is_regex;
char * matchstring;
regex_t compiled;
} query_string_def, *query_string_t;
typedef struct {
QueryPredDataDef pd;
date_match_t options;
QofQueryPredData pd;
QofDateMatch options;
Timespec date;
} query_date_def, *query_date_t;
typedef struct {
QueryPredDataDef pd;
numeric_match_t options;
QofQueryPredData pd;
QofNumericMatch options;
gnc_numeric amount;
} query_numeric_def, *query_numeric_t;
typedef struct {
QueryPredDataDef pd;
guid_match_t options;
QofQueryPredData pd;
QofGuidMatch options;
GList * guids;
} query_guid_def, *query_guid_t;
typedef struct {
QueryPredDataDef pd;
QofQueryPredData pd;
gint32 val;
} query_int32_def, *query_int32_t;
typedef struct {
QueryPredDataDef pd;
QofQueryPredData pd;
gint64 val;
} query_int64_def, *query_int64_t;
typedef struct {
QueryPredDataDef pd;
QofQueryPredData pd;
double val;
} query_double_def, *query_double_t;
typedef struct {
QueryPredDataDef pd;
QofQueryPredData pd;
gboolean val;
} query_boolean_def, *query_boolean_t;
typedef struct {
QueryPredDataDef pd;
char_match_t options;
QofQueryPredData pd;
QofCharMatch options;
char * char_list;
} query_char_def, *query_char_t;
typedef struct {
QueryPredDataDef pd;
QofQueryPredData pd;
GSList * path;
kvp_value * value;
} query_kvp_def, *query_kvp_t;
#endif /* GNC_QUERYCOREP_H */
#endif /* QOF_QUERYCOREP_H */

File diff suppressed because it is too large Load Diff

152
src/engine/qofquerycore.h Normal file
View File

@ -0,0 +1,152 @@
/********************************************************************\
* qofquerycore.h -- API for providing core Query data types *
* Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU> *
* *
* 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 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
/** @file qofquerycore.h
@breif API for providing core Query data types
@author Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU>
*/
#ifndef QOF_QUERYCORE_H
#define QOF_QUERYCORE_H
#include <glib.h>
#include "gnc-numeric.h"
#include "gnc-date.h"
#include "kvp_frame.h"
/** Type of Query Core Objects (String, Date, Numeric, GUID, etc. */
typedef const char * QofQueryCoreType;
typedef struct _QofQueryPredData QofQueryPredData;
/** The QofQueryAccess type defines an arbitrary function pointer
* for access functions. This is needed because C doesn't have
* templates, so we just cast a lot. Real functions must be of
* the form:
*
* <param_type> function (object_type *obj);
*/
typedef gpointer (*QofQueryAccess)(gpointer);
/** Standard Query comparitors, for how to compare objects in a predicate.
* Note that not all core types implement all comparitors
*/
typedef enum {
QOF_COMPARE_LT = 1,
QOF_QOF_COMPARE_LTE,
QOF_COMPARE_EQUAL,
QOF_COMPARE_GT,
QOF_QOF_COMPARE_GTE,
QOF_COMPARE_NEQ
} QofQueryCompare;
/** List of known core query data-types...
* Each core query type defines it's set of optional "comparitor qualifiers".
*/
#define QOF_QUERYCORE_STRING "string"
typedef enum {
QOF_STRING_MATCH_NORMAL = 1,
QOF_STRING_MATCH_CASEINSENSITIVE
} QofStringMatch;
#define QOF_QUERYCORE_DATE "date"
typedef enum {
QOF_DATE_MATCH_NORMAL = 1,
QOF_DATE_MATCH_ROUNDED
} QofDateMatch;
#define QOF_QUERYCORE_NUMERIC "numeric"
#define QOF_QUERYCORE_DEBCRED "debcred"
typedef enum {
QOF_NUMERIC_MATCH_DEBIT = 1,
QOF_NUMERIC_MATCH_CREDIT,
QOF_NUMERIC_MATCH_ANY
} QofNumericMatch;
#define QOF_QUERYCORE_GUID "guid"
typedef enum {
/* These expect a single object and expect the QofQueryAccess returns GUID* */
QOF_GUID_MATCH_ANY = 1,
QOF_GUID_MATCH_NONE,
QOF_GUID_MATCH_NULL,
/* These expect a GList* of objects and calls the QofQueryAccess routine
* on each item in the list to obtain a GUID* for each object */
QOF_GUID_MATCH_ALL,
/* These expect a single object and expect the QofQueryAccess function
* to return a GList* of GUID* (the list is the property of the caller) */
QOF_GUID_MATCH_LIST_ANY,
} QofGuidMatch;
#define QOF_QUERYCORE_INT32 "gint32"
#define QOF_QUERYCORE_INT64 "gint64"
#define QOF_QUERYCORE_DOUBLE "double"
#define QOF_QUERYCORE_BOOLEAN "boolean"
#define QOF_QUERYCORE_KVP "kvp"
/** A CHAR type is for a RECNCell */
#define QOF_QUERYCORE_CHAR "character"
typedef enum {
QOF_CHAR_MATCH_ANY = 1,
QOF_CHAR_MATCH_NONE
} QofCharMatch;
/** Head of Predicate Data structures. All PData must start like this. */
struct _QofQueryPredData {
QofQueryCoreType type_name; /* QUERYCORE_* */
QofQueryCompare how;
};
/** Core Data Type Predicates */
QofQueryPredData *qof_query_string_predicate (QofQueryCompare how, char *str,
QofStringMatch options,
gboolean is_regex);
QofQueryPredData *qof_query_date_predicate (QofQueryCompare how,
QofDateMatch options, Timespec date);
QofQueryPredData *qof_query_numeric_predicate (QofQueryCompare how,
QofNumericMatch options,
gnc_numeric value);
QofQueryPredData *qof_query_guid_predicate (QofGuidMatch options, GList *guids);
QofQueryPredData *qof_query_int32_predicate (QofQueryCompare how, gint32 val);
QofQueryPredData *qof_query_int64_predicate (QofQueryCompare how, gint64 val);
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);
QofQueryPredData *qof_query_kvp_predicate (QofQueryCompare how,
GSList *path, const kvp_value *value);
/** Copy a predicate. */
QofQueryPredData *qof_query_core_predicate_copy (QofQueryPredData *pdata);
/** Destroy a predicate. */
void qof_query_core_predicate_free (QofQueryPredData *pdata);
/** Return a printable string for a core data object. Caller needs
* to g_free() the returned string.
*/
char * qof_query_core_to_string (char const *type, gpointer object,
QofQueryAccess fcn);
#endif /* QOF_QUERYCORE_H */

View File

@ -15,6 +15,7 @@
#include "gnc-engine.h"
#include "gnc-engine-util.h"
#include "Transaction.h"
#include "qofquerycore.h"
#include "test-engine-stuff.h"
#include "test-stuff.h"
@ -1377,7 +1378,7 @@ get_random_query(void)
xaccQueryAddAccountGUIDMatch
(q,
guids,
get_random_int_in_range (1, GUID_MATCH_NONE),
get_random_int_in_range (1, QOF_GUID_MATCH_NONE),
get_random_queryop ());
free_random_guids (guids);
break;
@ -1452,7 +1453,7 @@ get_random_query(void)
xaccQueryAddKVPMatch (q,
path,
value,
get_random_int_in_range (1, COMPARE_NEQ),
get_random_int_in_range (1, QOF_COMPARE_NEQ),
get_random_id_type (),
get_random_queryop ());
kvp_value_delete (value);
@ -1483,7 +1484,7 @@ get_random_query(void)
xaccQueryAddSharePriceMatch
(q,
get_random_gnc_numeric (),
get_random_int_in_range (1, COMPARE_NEQ),
get_random_int_in_range (1, QOF_COMPARE_NEQ),
get_random_queryop ());
break;
@ -1491,7 +1492,7 @@ get_random_query(void)
xaccQueryAddSharesMatch
(q,
get_random_gnc_numeric (),
get_random_int_in_range (1, COMPARE_NEQ),
get_random_int_in_range (1, QOF_COMPARE_NEQ),
get_random_queryop ());
break;
@ -1499,8 +1500,8 @@ get_random_query(void)
xaccQueryAddValueMatch
(q,
get_random_gnc_numeric (),
get_random_int_in_range (1, NUMERIC_MATCH_ANY),
get_random_int_in_range (1, COMPARE_NEQ),
get_random_int_in_range (1, QOF_NUMERIC_MATCH_ANY),
get_random_int_in_range (1, QOF_COMPARE_NEQ),
get_random_queryop ());
break;
@ -1638,7 +1639,7 @@ add_kvp_value_query (const char *key, kvp_value *value, gpointer data)
add_kvp_value_query, data);
else
xaccQueryAddKVPMatch (kqd->q, kqd->path, value,
COMPARE_EQUAL, kqd->where,
QOF_COMPARE_EQUAL, kqd->where,
QUERY_AND);
node = g_slist_last (kqd->path);
@ -1710,16 +1711,16 @@ make_trans_query (Transaction *trans, TestQueryTypes query_types)
TRUE, FALSE, QUERY_AND);
n = xaccSplitGetValue (s);
xaccQueryAddValueMatch (q, n, NUMERIC_MATCH_ANY,
COMPARE_EQUAL, QUERY_AND);
xaccQueryAddValueMatch (q, n, QOF_NUMERIC_MATCH_ANY,
QOF_COMPARE_EQUAL, QUERY_AND);
n = xaccSplitGetAmount (s);
xaccQueryAddSharesMatch (q, n, COMPARE_EQUAL, QUERY_AND);
xaccQueryAddSharesMatch (q, n, QOF_COMPARE_EQUAL, QUERY_AND);
if (include_price)
{
n = xaccSplitGetSharePrice (s);
xaccQueryAddSharePriceMatch (q, n, COMPARE_EQUAL, QUERY_AND);
xaccQueryAddSharePriceMatch (q, n, QOF_COMPARE_EQUAL, QUERY_AND);
}
{
@ -1773,7 +1774,7 @@ make_trans_query (Transaction *trans, TestQueryTypes query_types)
Split * split = node->data;
list = g_list_prepend (list, xaccSplitGetAccount (split));
}
xaccQueryAddAccountMatch (q, list, GUID_MATCH_ALL, QUERY_AND);
xaccQueryAddAccountMatch (q, list, QOF_GUID_MATCH_ALL, QUERY_AND);
g_list_free (list);
/* GUID_MATCH_NONE */
@ -1781,7 +1782,7 @@ make_trans_query (Transaction *trans, TestQueryTypes query_types)
list = g_list_prepend (list, get_random_guid ());
list = g_list_prepend (list, get_random_guid ());
list = g_list_prepend (list, get_random_guid ());
xaccQueryAddAccountGUIDMatch (q, list, GUID_MATCH_NONE, QUERY_AND);
xaccQueryAddAccountGUIDMatch (q, list, QOF_GUID_MATCH_NONE, QUERY_AND);
/* GUID_MATCH_ANY */
{
@ -1789,7 +1790,7 @@ make_trans_query (Transaction *trans, TestQueryTypes query_types)
*guid = *xaccAccountGetGUID (a);
list = g_list_prepend (list, guid);
}
xaccQueryAddAccountGUIDMatch (q, list, GUID_MATCH_ANY, QUERY_AND);
xaccQueryAddAccountGUIDMatch (q, list, QOF_GUID_MATCH_ANY, QUERY_AND);
for (node = list; node; node = node->next)
g_free (node->data);

View File

@ -7,8 +7,9 @@
#include "messages.h"
#include "QueryObjectP.h"
#include "QueryCoreP.h"
#include "QueryNew.h"
#include "qofquerycore.h"
#include "qofquerycore-p.h"
#include "test-stuff.h"
@ -30,7 +31,7 @@ static int test_core_param (gpointer a)
static void test_query_object (void)
{
static QueryObjectDef params[] = {
{ TEST_PARAM, TEST_CORE, (QueryAccess)test_core_param },
{ TEST_PARAM, TEST_CORE, (QofQueryAccess)test_core_param },
{ NULL },
};
@ -51,7 +52,7 @@ static void test_query_object (void)
"gncQueryObjectGetParamter (NULL, TEST_PARAM)");
do_test (gncQueryObjectGetParameterGetter (TEST_MODULE_NAME, TEST_PARAM)
== (QueryAccess)test_core_param,
== (QofQueryAccess)test_core_param,
"gncQueryObjectGetParameterGetter");
do_test (safe_strcmp (gncQueryObjectParameterType (TEST_MODULE_NAME,

View File

@ -13,30 +13,83 @@ foreach (@files)
while (<AF>)
{
s/GncObject_t/QofObject/g;
s/gncObjectLookup/qof_object_lookup/g;
s/gncObjectRegister/qof_object_register/g;
s/gncObjectGetTypeLabel/qof_object_get_type_label/g;
s/gncObjectRegisterBackend/qof_object_register_backend/g;
s/gncObjectLookupBackend/qof_object_lookup_backend/g;
s/gncObjectForeachBackend/qof_object_foreach_backend/g;
s/gncObjectInitialize/qof_object_initialize/g;
# s/GncObject_t/QofObject/g;
# s/gncObjectLookup/qof_object_lookup/g;
# s/gncObjectRegister/qof_object_register/g;
# s/gncObjectGetTypeLabel/qof_object_get_type_label/g;
# s/gncObjectRegisterBackend/qof_object_register_backend/g;
# s/gncObjectLookupBackend/qof_object_lookup_backend/g;
# s/gncObjectForeachBackend/qof_object_foreach_backend/g;
# s/gncObjectInitialize/qof_object_initialize/g;
s/gncObjectShutdown/qof_object_shutdown/g;
s/gncObjectBookBegin/qof_object_book_begin/g;
s/gncObjectBookEnd/qof_object_book_end/g;
s/gncObjectIsDirty/qof_object_is_dirty/g;
s/gncObjectMarkClean/qof_object_mark_clean/g;
# s/gncObjectShutdown/qof_object_shutdown/g;
# s/gncObjectBookBegin/qof_object_book_begin/g;
# s/gncObjectBookEnd/qof_object_book_end/g;
# s/gncObjectIsDirty/qof_object_is_dirty/g;
# s/gncObjectMarkClean/qof_object_mark_clean/g;
s/gncObjectForeachType/qof_object_foreach_type/g;
s/gncObjectForeach/qof_object_foreach/g;
s/gncObjectPrintable/qof_object_printable/g;
s/gncObjectx/qof_object_x/g;
s/gncObjectx/qof_object_x/g;
s/gncObjectx/qof_object_x/g;
# s/gncObjectForeachType/qof_object_foreach_type/g;
# s/gncObjectForeach/qof_object_foreach/g;
# s/gncObjectPrintable/qof_object_printable/g;
# s/gncObjectx/qof_object_x/g;
# s/gncObjectx/qof_object_x/g;
# s/gncObjectx/qof_object_x/g;
s/foreachTypeCB/QofForeachTypeCB/g;
s/foreachBackendTypeCB/QofForeachBackendTypeCB/g;
# s/foreachTypeCB/QofForeachTypeCB/g;
# s/foreachBackendTypeCB/QofForeachBackendTypeCB/g;
# s/gncQueryStringPredicate/qof_query_string_predicate/g;
# s/gncQueryDatePredicate/qof_query_date_predicate/g;
# s/gncQueryNumericPredicate/qof_query_numeric_predicate/g;
# s/gncQueryGUIDPredicate/qof_query_guid_predicate/g;
# s/gncQueryInt32Predicate/qof_query_int32_predicate/g;
# s/gncQueryInt64Predicate/qof_query_int64_predicate/g;
# s/gncQueryDoublePredicate/qof_query_double_predicate/g;
# s/gncQueryBooleanPredicate/qof_query_boolean_predicate/g;
# s/gncQueryCharPredicate/qof_query_char_predicate/g;
# s/gncQueryKVPPredicate/qof_query_kvp_predicate/g;
# s/gncQueryCorePredicateFree/qof_query_core_predicate_free/g;
# s/COMPARE_LT/QOF_COMPARE_LT/g;
# s/COMPARE_LTE/QOF_COMPARE_LTE/g;
# s/COMPARE_EQUAL/QOF_COMPARE_EQUAL/g;
# s/COMPARE_GT/QOF_COMPARE_GT/g;
# s/COMPARE_GTE/QOF_COMPARE_GTE/g;
# s/COMPARE_NEQ/QOF_COMPARE_NEQ/g;
# s/STRING_MATCH_NORMAL/QOF_STRING_MATCH_NORMAL/g;
# s/STRING_MATCH_CASEINSENSITIVE/QOF_STRING_MATCH_CASEINSENSITIVE/g;
# s/DATE_MATCH_NORMAL/QOF_DATE_MATCH_NORMAL/g;
# s/DATE_MATCH_ROUNDED/QOF_DATE_MATCH_ROUNDED/g;
# s/NUMERIC_MATCH_ANY/QOF_NUMERIC_MATCH_ANY/g;
# s/NUMERIC_MATCH_CREDIT/QOF_NUMERIC_MATCH_CREDIT/g;
# s/NUMERIC_MATCH_DEBIT/QOF_NUMERIC_MATCH_DEBIT/g;
# s/GUID_MATCH_ANY/QOF_GUID_MATCH_ANY/g;
# s/GUID_MATCH_NONE/QOF_GUID_MATCH_NONE/g;
# s/GUID_MATCH_NULL/QOF_GUID_MATCH_NULL/g;
# s/GUID_MATCH_ALL/QOF_GUID_MATCH_ALL/g;
# s/GUID_MATCH_LIST_ANY/QOF_GUID_MATCH_LIST_ANY/g;
# s/CHAR_MATCH_ANY/QOF_CHAR_MATCH_ANY/g;
# s/CHAR_MATCH_NONE/QOF_CHAR_MATCH_NONE/g;
s/char_match_t/QofCharMatch/g;
s/guid_match_t/QofGuidMatch/g;
s/numeric_match_t/QofNumericMatch/g;
s/date_match_t/QofDateMatch/g;
s/string_match_t/QofStringMatch/g;
s/query_compare_t/QofQueryCompare/g;
s/gncQueryCoreInit/qof_query_core_init/g;
s/gncQueryCoreShutdown/qof_query_core_shutdown/g;
s/gncQueryCoreGetPredicate/qof_query_core_get_predicate/g;
s/gncQueryCoreGetCompare/qof_query_core_get_compare/g;
s/gncQueryCorePredicateEqual/qof_query_core_predicate_equal/g;
print OF $_;
}
close OF;