create xaccQueryAddGUIDMatchGL() and wrap it. This is a special function

that takes a GUID (instead of a const GUID *) and a GList (instead of
a GSList) and performs an gncQueryAddGUIDMatch().

Add Lots to the query infrastructure, so we can add Lot-based lookups
and queries.

Add SPLIT_LOT parameter and wrap it.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7041 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2002-06-28 04:20:46 +00:00
parent 6470316116
commit 8f63db0411
8 changed files with 47 additions and 0 deletions

View File

@ -514,6 +514,22 @@ xaccQueryAddGUIDMatch(Query * q, const GUID *guid,
gncQueryAddGUIDMatch (q, param_list, guid, op);
}
void
xaccQueryAddGUIDMatchGL (QueryNew *q, GList *param_list,
GUID guid, QueryOp op)
{
GSList *params = NULL;
GList *node;
for (node = param_list; node; node = node->next)
params = g_slist_prepend (params, node->data);
params = g_slist_reverse (params);
g_list_free (param_list);
gncQueryAddGUIDMatch (q, params, &guid, op);
}
void
xaccQueryAddKVPMatch(Query *q, GSList *path, const kvp_value *value,
query_compare_t how, GNCIdType id_type,

View File

@ -202,6 +202,8 @@ typedef enum {
void xaccQueryAddClearedMatch(Query * q, cleared_match_t how, QueryOp op);
void xaccQueryAddGUIDMatch(Query * q, const GUID *guid,
GNCIdType id_type, QueryOp op);
void xaccQueryAddGUIDMatchGL (QueryNew *q, GList *param_list,
GUID guid, QueryOp op);
/* given kvp value is on right side of comparison */
void xaccQueryAddKVPMatch(Query *q, GSList *path, const kvp_value *value,

View File

@ -3206,6 +3206,7 @@ gboolean xaccSplitRegister (void)
(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 },

View File

@ -536,6 +536,7 @@ Timespec xaccTransGetVoidTime(Transaction *tr);
#define SPLIT_TYPE "type"
#define SPLIT_VOIDED_AMOUNT "voided-amount"
#define SPLIT_VOIDED_VALUE "voided-value"
#define SPLIT_LOT "lot"
#define SPLIT_TRANS "trans"
#define SPLIT_ACCOUNT "account"
#define SPLIT_ACCOUNT_GUID "account-guid" /* for guid_match_all */

View File

@ -33,6 +33,7 @@
#include "TransactionP.h"
#include "AccountP.h"
#include "gnc-book-p.h"
#include "gnc-lot-p.h"
static GList * engine_init_hooks = NULL;
static int engine_is_initialized = 0;
@ -84,6 +85,7 @@ gnc_engine_init(int argc, char ** argv)
xaccTransRegister ();
xaccAccountRegister ();
gnc_book_register ();
gnc_lot_register ();
/* call any engine hooks */
for (cur = engine_init_hooks; cur; cur = cur->next)

View File

@ -67,5 +67,8 @@ struct gnc_lot_struct
void gnc_lot_set_guid(GNCLot *lot, GUID guid);
/* Register with the Query engine */
void gnc_lot_register (void);
#endif /* GNC_LOT_P_H */

View File

@ -42,6 +42,7 @@
#include "gnc-lot-p.h"
#include "Transaction.h"
#include "TransactionP.h"
#include "QueryObject.h"
/* This static indicates the debugging module that this .o belongs to. */
static short module = MOD_LOT;
@ -261,4 +262,15 @@ gnc_lot_remove_split (GNCLot *lot, Split *split)
}
}
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 },
{ NULL },
};
gncQueryObjectRegister (GNC_ID_LOT, NULL, params);
}
/* ========================== END OF FILE ========================= */

View File

@ -264,6 +264,7 @@
; Definitions for query parameter names
;
(gw:wrap-value ws 'gnc:query-default-sort '<gnc:id-type> "QUERY_DEFAULT_SORT")
(gw:wrap-value ws 'gnc:split-lot '<gnc:id-type> "SPLIT_LOT")
(gw:wrap-value ws 'gnc:split-trans '<gnc:id-type> "SPLIT_TRANS")
(gw:wrap-value ws 'gnc:split-account '<gnc:id-type> "SPLIT_ACCOUNT")
(gw:wrap-value ws 'gnc:split-value '<gnc:id-type> "SPLIT_VALUE")
@ -1880,6 +1881,15 @@ of having a parent transaction with which one is working...")
'((<gnc:Query*> q) (<gnc:cleared-match-how> cleared-how) (<gnc:query-op> how))
"match splits against the cleared state.")
(gw:wrap-function
ws
'gnc:query-add-guid-match
'<gw:void>
"xaccQueryAddGUIDMatchGL"
'((<gnc:Query*> q) ((gw:glist-of <gnc:id-type> callee-owned) param_path)
(<gnc:guid-scm> guid) (<gnc:query-op> how))
"Add a GUID match against the specified param_path")
(gw:wrap-function
ws
'gnc:query-set-sort-order