mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
rename QOF_QUERYCORE_DATE to QOF_TYPE_DATE, etc
so that these can be used 'generically' git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9419 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -188,9 +188,9 @@ xaccCloneAccountSimple(const Account *from, QofBook *book)
|
||||
}
|
||||
|
||||
Account *
|
||||
xaccCloneAccount (const Account *from, QofBook *book)
|
||||
xaccCloneAccount (const Account *from, QofBook *book,
|
||||
const char * gemini_path)
|
||||
{
|
||||
time_t now;
|
||||
Account *ret;
|
||||
|
||||
if (!from || !book) return NULL;
|
||||
@@ -199,7 +199,6 @@ xaccCloneAccount (const Account *from, QofBook *book)
|
||||
ret = g_new (Account, 1);
|
||||
g_return_val_if_fail (ret, NULL);
|
||||
|
||||
now = time(0);
|
||||
xaccInitAccount (ret, book);
|
||||
|
||||
/* Do not Begin/CommitEdit() here; give the caller
|
||||
@@ -218,13 +217,21 @@ xaccCloneAccount (const Account *from, QofBook *book)
|
||||
ret->non_standard_scu = from->non_standard_scu;
|
||||
ret->core_dirty = TRUE;
|
||||
|
||||
/* Make a note of where the copy came from */
|
||||
gnc_kvp_gemini (ret->kvp_data, now, "acct_guid", &from->guid,
|
||||
"book_guid", &from->book->guid,
|
||||
NULL);
|
||||
gnc_kvp_gemini (from->kvp_data, now, "acct_guid", &ret->guid,
|
||||
"book_guid", &book->guid,
|
||||
NULL);
|
||||
if (gemini_path)
|
||||
{
|
||||
time_t now;
|
||||
now = time(0);
|
||||
|
||||
/* Make a note of where the copy came from */
|
||||
gnc_kvp_bag_add (ret->kvp_data, gemini_path, now,
|
||||
"acct_guid", &from->guid,
|
||||
"book_guid", &from->book->guid,
|
||||
NULL);
|
||||
gnc_kvp_bag_add (from->kvp_data, gemini_path, now,
|
||||
"acct_guid", &ret->guid,
|
||||
"book_guid", &book->guid,
|
||||
NULL);
|
||||
}
|
||||
|
||||
LEAVE (" ");
|
||||
return ret;
|
||||
@@ -3001,19 +3008,19 @@ static QofObject account_object_def = {
|
||||
gboolean xaccAccountRegister (void)
|
||||
{
|
||||
static QofQueryObject params[] = {
|
||||
{ ACCOUNT_KVP, QOF_QUERYCORE_KVP, (QofAccessFunc)xaccAccountGetSlots },
|
||||
{ ACCOUNT_NAME_, QOF_QUERYCORE_STRING, (QofAccessFunc)xaccAccountGetName },
|
||||
{ ACCOUNT_CODE_, QOF_QUERYCORE_STRING, (QofAccessFunc)xaccAccountGetCode },
|
||||
{ ACCOUNT_DESCRIPTION_, QOF_QUERYCORE_STRING, (QofAccessFunc)xaccAccountGetDescription },
|
||||
{ ACCOUNT_NOTES_, QOF_QUERYCORE_STRING, (QofAccessFunc)xaccAccountGetNotes },
|
||||
{ ACCOUNT_PRESENT_, QOF_QUERYCORE_NUMERIC, (QofAccessFunc)xaccAccountGetPresentBalance },
|
||||
{ ACCOUNT_BALANCE_, QOF_QUERYCORE_NUMERIC, (QofAccessFunc)xaccAccountGetBalance },
|
||||
{ ACCOUNT_CLEARED_, QOF_QUERYCORE_NUMERIC, (QofAccessFunc)xaccAccountGetClearedBalance },
|
||||
{ ACCOUNT_RECONCILED_, QOF_QUERYCORE_NUMERIC, (QofAccessFunc)xaccAccountGetReconciledBalance },
|
||||
{ ACCOUNT_FUTURE_MINIMUM_, QOF_QUERYCORE_NUMERIC, (QofAccessFunc)xaccAccountGetProjectedMinimumBalance },
|
||||
{ ACCOUNT_TAX_RELATED, QOF_QUERYCORE_BOOLEAN, (QofAccessFunc)xaccAccountGetTaxRelated },
|
||||
{ QOF_QUERY_PARAM_BOOK, GNC_ID_BOOK, (QofAccessFunc)xaccAccountGetBook },
|
||||
{ QOF_QUERY_PARAM_GUID, QOF_QUERYCORE_GUID, (QofAccessFunc)xaccAccountGetGUID },
|
||||
{ ACCOUNT_KVP, QOF_TYPE_KVP, (QofAccessFunc)xaccAccountGetSlots },
|
||||
{ ACCOUNT_NAME_, QOF_TYPE_STRING, (QofAccessFunc)xaccAccountGetName },
|
||||
{ ACCOUNT_CODE_, QOF_TYPE_STRING, (QofAccessFunc)xaccAccountGetCode },
|
||||
{ ACCOUNT_DESCRIPTION_, QOF_TYPE_STRING, (QofAccessFunc)xaccAccountGetDescription },
|
||||
{ ACCOUNT_NOTES_, QOF_TYPE_STRING, (QofAccessFunc)xaccAccountGetNotes },
|
||||
{ ACCOUNT_PRESENT_, QOF_TYPE_NUMERIC, (QofAccessFunc)xaccAccountGetPresentBalance },
|
||||
{ ACCOUNT_BALANCE_, QOF_TYPE_NUMERIC, (QofAccessFunc)xaccAccountGetBalance },
|
||||
{ ACCOUNT_CLEARED_, QOF_TYPE_NUMERIC, (QofAccessFunc)xaccAccountGetClearedBalance },
|
||||
{ ACCOUNT_RECONCILED_, QOF_TYPE_NUMERIC, (QofAccessFunc)xaccAccountGetReconciledBalance },
|
||||
{ ACCOUNT_FUTURE_MINIMUM_, QOF_TYPE_NUMERIC, (QofAccessFunc)xaccAccountGetProjectedMinimumBalance },
|
||||
{ ACCOUNT_TAX_RELATED, QOF_TYPE_BOOLEAN, (QofAccessFunc)xaccAccountGetTaxRelated },
|
||||
{ QOF_QUERY_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)xaccAccountGetBook },
|
||||
{ QOF_QUERY_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)xaccAccountGetGUID },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
||||
@@ -105,10 +105,15 @@ typedef enum
|
||||
/** Constructor */
|
||||
Account * xaccMallocAccount (QofBook *book);
|
||||
|
||||
/** The xaccCloneAccount() does the same as xaccCloneAccountSimple, except that it
|
||||
* also uses the 'gemini' kvp value to mark the account from
|
||||
* which it was copied. */
|
||||
Account * xaccCloneAccount (const Account *from, QofBook *book);
|
||||
/** The xaccCloneAccount() does the same as xaccCloneAccountSimple(),
|
||||
* except that it also also places a pair of GUID-pointers
|
||||
* of each account to the other, in the other's kvp slot.
|
||||
* The guid pointers are stored under the under the kvp
|
||||
* path "gemini_path". If gemini_path is NULL, then this
|
||||
* routine is identical to xaccCloneAccountSimple().
|
||||
*/
|
||||
Account * xaccCloneAccount (const Account *from, QofBook *book,
|
||||
const char * gemini_path);
|
||||
|
||||
/** The xaccCloneAccountSimple() routine makes a simple copy of the
|
||||
* indicated account, placing it in the indicated book. It copies
|
||||
|
||||
@@ -816,7 +816,7 @@ xaccGroupCopyGroup (AccountGroup *to, AccountGroup *from)
|
||||
|
||||
/* This will copy the basic data and the KVP. It will
|
||||
* not copy any splits/transactions. It will gemini. */
|
||||
to_acc = xaccCloneAccount (from_acc, to->book);
|
||||
to_acc = xaccCloneAccount (from_acc, to->book, "gemini");
|
||||
|
||||
xaccAccountBeginEdit (to_acc);
|
||||
to->accounts = g_list_insert_sorted (to->accounts, to_acc,
|
||||
@@ -825,7 +825,7 @@ xaccGroupCopyGroup (AccountGroup *to, AccountGroup *from)
|
||||
to_acc->parent = to;
|
||||
to_acc->core_dirty = TRUE;
|
||||
|
||||
/* copy child accounts too. */
|
||||
/* Copy child accounts too. */
|
||||
if (from_acc->children)
|
||||
{
|
||||
to_acc->children = xaccMallocAccountGroup (to->book);
|
||||
|
||||
@@ -583,8 +583,12 @@ gnc_book_partition_txn (QofBook *dest_book, QofBook *src_book, QofQuery *query)
|
||||
|
||||
/* Make note of the sibling books */
|
||||
now = time(0);
|
||||
gnc_kvp_gemini (src_book->kvp_data, now, "book_guid", &dest_book->guid, NULL);
|
||||
gnc_kvp_gemini (dest_book->kvp_data, now, "book_guid", &src_book->guid, NULL);
|
||||
gnc_kvp_bag_add (src_book->kvp_data, "gemini", now,
|
||||
"book_guid", &dest_book->guid,
|
||||
NULL);
|
||||
gnc_kvp_bag_add (dest_book->kvp_data, "gemini", now,
|
||||
"book_guid", &src_book->guid,
|
||||
NULL);
|
||||
LEAVE (" ");
|
||||
}
|
||||
|
||||
@@ -819,7 +823,7 @@ gnc_book_close_period (QofBook *existing_book, Timespec calve_date,
|
||||
if (!existing_book) return NULL;
|
||||
ENTER (" date=%s memo=%s", gnc_print_date(calve_date), memo);
|
||||
|
||||
/* Setup closuing book */
|
||||
/* Setup closing book */
|
||||
closing_book = qof_book_new();
|
||||
qof_book_set_backend (closing_book, existing_book->backend);
|
||||
closing_book->book_open = 'n';
|
||||
|
||||
@@ -55,14 +55,14 @@
|
||||
|
||||
#define gncQueryCorePredicateEqual qof_query_core_predicate_equal
|
||||
|
||||
#define QUERYCORE_GUID QOF_QUERYCORE_GUID
|
||||
#define QUERYCORE_DEBCRED QOF_QUERYCORE_DEBCRED
|
||||
#define QUERYCORE_BOOLEAN QOF_QUERYCORE_BOOLEAN
|
||||
#define QUERYCORE_NUMERIC QOF_QUERYCORE_NUMERIC
|
||||
#define QUERYCORE_STRING QOF_QUERYCORE_STRING
|
||||
#define QUERYCORE_DATE QOF_QUERYCORE_DATE
|
||||
#define QUERYCORE_INT64 QOF_QUERYCORE_INT64
|
||||
#define QUERYCORE_DOUBLE QOF_QUERYCORE_DOUBLE
|
||||
#define QUERYCORE_GUID QOF_TYPE_GUID
|
||||
#define QUERYCORE_DEBCRED QOF_TYPE_DEBCRED
|
||||
#define QUERYCORE_BOOLEAN QOF_TYPE_BOOLEAN
|
||||
#define QUERYCORE_NUMERIC QOF_TYPE_NUMERIC
|
||||
#define QUERYCORE_STRING QOF_TYPE_STRING
|
||||
#define QUERYCORE_DATE QOF_TYPE_DATE
|
||||
#define QUERYCORE_INT64 QOF_TYPE_INT64
|
||||
#define QUERYCORE_DOUBLE QOF_TYPE_DOUBLE
|
||||
|
||||
#define QueryAccess QofAccessFunc
|
||||
#define gncQueryCoreToString qof_query_core_to_string
|
||||
|
||||
@@ -3433,41 +3433,41 @@ static gpointer no_op (gpointer obj)
|
||||
gboolean xaccSplitRegister (void)
|
||||
{
|
||||
static const QofQueryObject params[] = {
|
||||
{ SPLIT_KVP, QOF_QUERYCORE_KVP, (QofAccessFunc)xaccSplitGetSlots },
|
||||
{ SPLIT_DATE_RECONCILED, QOF_QUERYCORE_DATE,
|
||||
{ SPLIT_KVP, QOF_TYPE_KVP, (QofAccessFunc)xaccSplitGetSlots },
|
||||
{ SPLIT_DATE_RECONCILED, QOF_TYPE_DATE,
|
||||
(QofAccessFunc)xaccSplitRetDateReconciledTS },
|
||||
|
||||
/* d-* are depricated query params, should not be used in new
|
||||
* queries, should be removed from old queries. */
|
||||
{ "d-share-amount", QOF_QUERYCORE_DOUBLE,
|
||||
{ "d-share-amount", QOF_TYPE_DOUBLE,
|
||||
(QofAccessFunc)DxaccSplitGetShareAmount },
|
||||
{ "d-share-int64", QOF_QUERYCORE_INT64, (QofAccessFunc)xaccSplitGetGUID },
|
||||
{ SPLIT_BALANCE, QOF_QUERYCORE_NUMERIC, (QofAccessFunc)xaccSplitGetBalance },
|
||||
{ SPLIT_CLEARED_BALANCE, QOF_QUERYCORE_NUMERIC,
|
||||
{ "d-share-int64", QOF_TYPE_INT64, (QofAccessFunc)xaccSplitGetGUID },
|
||||
{ SPLIT_BALANCE, QOF_TYPE_NUMERIC, (QofAccessFunc)xaccSplitGetBalance },
|
||||
{ SPLIT_CLEARED_BALANCE, QOF_TYPE_NUMERIC,
|
||||
(QofAccessFunc)xaccSplitGetClearedBalance },
|
||||
{ SPLIT_RECONCILED_BALANCE, QOF_QUERYCORE_NUMERIC,
|
||||
{ SPLIT_RECONCILED_BALANCE, QOF_TYPE_NUMERIC,
|
||||
(QofAccessFunc)xaccSplitGetReconciledBalance },
|
||||
{ SPLIT_MEMO, QOF_QUERYCORE_STRING, (QofAccessFunc)xaccSplitGetMemo },
|
||||
{ SPLIT_ACTION, QOF_QUERYCORE_STRING, (QofAccessFunc)xaccSplitGetAction },
|
||||
{ SPLIT_RECONCILE, QOF_QUERYCORE_CHAR, (QofAccessFunc)xaccSplitGetReconcile },
|
||||
{ SPLIT_AMOUNT, QOF_QUERYCORE_NUMERIC, (QofAccessFunc)xaccSplitGetAmount },
|
||||
{ SPLIT_SHARE_PRICE, QOF_QUERYCORE_NUMERIC,
|
||||
{ SPLIT_MEMO, QOF_TYPE_STRING, (QofAccessFunc)xaccSplitGetMemo },
|
||||
{ SPLIT_ACTION, QOF_TYPE_STRING, (QofAccessFunc)xaccSplitGetAction },
|
||||
{ SPLIT_RECONCILE, QOF_TYPE_CHAR, (QofAccessFunc)xaccSplitGetReconcile },
|
||||
{ SPLIT_AMOUNT, QOF_TYPE_NUMERIC, (QofAccessFunc)xaccSplitGetAmount },
|
||||
{ SPLIT_SHARE_PRICE, QOF_TYPE_NUMERIC,
|
||||
(QofAccessFunc)xaccSplitGetSharePrice },
|
||||
{ SPLIT_VALUE, QOF_QUERYCORE_DEBCRED, (QofAccessFunc)xaccSplitGetValue },
|
||||
{ SPLIT_TYPE, QOF_QUERYCORE_STRING, (QofAccessFunc)xaccSplitGetType },
|
||||
{ SPLIT_VOIDED_AMOUNT, QOF_QUERYCORE_NUMERIC,
|
||||
{ SPLIT_VALUE, QOF_TYPE_DEBCRED, (QofAccessFunc)xaccSplitGetValue },
|
||||
{ SPLIT_TYPE, QOF_TYPE_STRING, (QofAccessFunc)xaccSplitGetType },
|
||||
{ SPLIT_VOIDED_AMOUNT, QOF_TYPE_NUMERIC,
|
||||
(QofAccessFunc)xaccSplitVoidFormerAmount },
|
||||
{ SPLIT_VOIDED_VALUE, QOF_QUERYCORE_NUMERIC,
|
||||
{ SPLIT_VOIDED_VALUE, QOF_TYPE_NUMERIC,
|
||||
(QofAccessFunc)xaccSplitVoidFormerValue },
|
||||
{ SPLIT_LOT, GNC_ID_LOT, (QofAccessFunc)xaccSplitGetLot },
|
||||
{ SPLIT_TRANS, GNC_ID_TRANS, (QofAccessFunc)xaccSplitGetParent },
|
||||
{ SPLIT_ACCOUNT, GNC_ID_ACCOUNT, (QofAccessFunc)xaccSplitGetAccount },
|
||||
{ SPLIT_ACCOUNT_GUID, QOF_QUERYCORE_GUID, split_account_guid_getter },
|
||||
{ SPLIT_ACCOUNT_GUID, QOF_TYPE_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 },
|
||||
{ QOF_QUERY_PARAM_BOOK, GNC_ID_BOOK, (QofAccessFunc)xaccSplitGetBook },
|
||||
{ QOF_QUERY_PARAM_GUID, QOF_QUERYCORE_GUID, (QofAccessFunc) xaccSplitGetGUID },
|
||||
{ QOF_QUERY_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)xaccSplitGetBook },
|
||||
{ QOF_QUERY_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc) xaccSplitGetGUID },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
@@ -3514,22 +3514,22 @@ trans_is_balanced_p (const Transaction *txn)
|
||||
gboolean xaccTransRegister (void)
|
||||
{
|
||||
static QofQueryObject params[] = {
|
||||
{ TRANS_KVP, QOF_QUERYCORE_KVP, (QofAccessFunc)xaccTransGetSlots },
|
||||
{ TRANS_NUM, QOF_QUERYCORE_STRING, (QofAccessFunc)xaccTransGetNum },
|
||||
{ TRANS_DESCRIPTION, QOF_QUERYCORE_STRING, (QofAccessFunc)xaccTransGetDescription },
|
||||
{ TRANS_DATE_ENTERED, QOF_QUERYCORE_DATE, (QofAccessFunc)xaccTransRetDateEnteredTS },
|
||||
{ TRANS_DATE_POSTED, QOF_QUERYCORE_DATE, (QofAccessFunc)xaccTransRetDatePostedTS },
|
||||
{ TRANS_DATE_DUE, QOF_QUERYCORE_DATE, (QofAccessFunc)xaccTransRetDateDueTS },
|
||||
{ TRANS_IMBALANCE, QOF_QUERYCORE_NUMERIC, (QofAccessFunc)xaccTransGetImbalance },
|
||||
{ TRANS_NOTES, QOF_QUERYCORE_STRING, (QofAccessFunc)xaccTransGetNotes },
|
||||
{ TRANS_IS_BALANCED, QOF_QUERYCORE_BOOLEAN, (QofAccessFunc)trans_is_balanced_p },
|
||||
{ TRANS_TYPE, QOF_QUERYCORE_CHAR, (QofAccessFunc)xaccTransGetTxnType },
|
||||
{ TRANS_VOID_STATUS, QOF_QUERYCORE_BOOLEAN, (QofAccessFunc)xaccTransGetVoidStatus },
|
||||
{ TRANS_VOID_REASON, QOF_QUERYCORE_STRING, (QofAccessFunc)xaccTransGetVoidReason },
|
||||
{ TRANS_VOID_TIME, QOF_QUERYCORE_DATE, (QofAccessFunc)xaccTransGetVoidTime },
|
||||
{ TRANS_KVP, QOF_TYPE_KVP, (QofAccessFunc)xaccTransGetSlots },
|
||||
{ TRANS_NUM, QOF_TYPE_STRING, (QofAccessFunc)xaccTransGetNum },
|
||||
{ TRANS_DESCRIPTION, QOF_TYPE_STRING, (QofAccessFunc)xaccTransGetDescription },
|
||||
{ TRANS_DATE_ENTERED, QOF_TYPE_DATE, (QofAccessFunc)xaccTransRetDateEnteredTS },
|
||||
{ TRANS_DATE_POSTED, QOF_TYPE_DATE, (QofAccessFunc)xaccTransRetDatePostedTS },
|
||||
{ TRANS_DATE_DUE, QOF_TYPE_DATE, (QofAccessFunc)xaccTransRetDateDueTS },
|
||||
{ TRANS_IMBALANCE, QOF_TYPE_NUMERIC, (QofAccessFunc)xaccTransGetImbalance },
|
||||
{ TRANS_NOTES, QOF_TYPE_STRING, (QofAccessFunc)xaccTransGetNotes },
|
||||
{ TRANS_IS_BALANCED, QOF_TYPE_BOOLEAN, (QofAccessFunc)trans_is_balanced_p },
|
||||
{ TRANS_TYPE, QOF_TYPE_CHAR, (QofAccessFunc)xaccTransGetTxnType },
|
||||
{ TRANS_VOID_STATUS, QOF_TYPE_BOOLEAN, (QofAccessFunc)xaccTransGetVoidStatus },
|
||||
{ TRANS_VOID_REASON, QOF_TYPE_STRING, (QofAccessFunc)xaccTransGetVoidReason },
|
||||
{ TRANS_VOID_TIME, QOF_TYPE_DATE, (QofAccessFunc)xaccTransGetVoidTime },
|
||||
{ TRANS_SPLITLIST, GNC_ID_SPLIT, (QofAccessFunc)xaccTransGetSplitList },
|
||||
{ QOF_QUERY_PARAM_BOOK, GNC_ID_BOOK, (QofAccessFunc)xaccTransGetBook },
|
||||
{ QOF_QUERY_PARAM_GUID, QOF_QUERYCORE_GUID, (QofAccessFunc)xaccTransGetGUID },
|
||||
{ QOF_QUERY_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)xaccTransGetBook },
|
||||
{ QOF_QUERY_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)xaccTransGetGUID },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
||||
@@ -877,53 +877,53 @@ gnc_queryterm2scm (QofQueryTerm *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, QOF_QUERYCORE_STRING)) {
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_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, QOF_QUERYCORE_DATE)) {
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_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, QOF_QUERYCORE_NUMERIC)) {
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_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, QOF_QUERYCORE_GUID)) {
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_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, QOF_QUERYCORE_INT64)) {
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_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, QOF_QUERYCORE_DOUBLE)) {
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_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, QOF_QUERYCORE_BOOLEAN)) {
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_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, QOF_QUERYCORE_CHAR)) {
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_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, QOF_QUERYCORE_KVP)) {
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_KVP)) {
|
||||
query_kvp_t pdata = (query_kvp_t) pd;
|
||||
|
||||
qt_scm = scm_cons (gnc_query_path2scm (pdata->path), qt_scm);
|
||||
@@ -982,7 +982,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
/* Now compute the predicate */
|
||||
|
||||
if (!safe_strcmp (type, QOF_QUERYCORE_STRING)) {
|
||||
if (!safe_strcmp (type, QOF_TYPE_STRING)) {
|
||||
QofStringMatch options;
|
||||
gboolean is_regex;
|
||||
char *matchstring;
|
||||
@@ -1009,7 +1009,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
options, is_regex);
|
||||
free (matchstring);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_QUERYCORE_DATE)) {
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_DATE)) {
|
||||
QofDateMatch options;
|
||||
Timespec date;
|
||||
|
||||
@@ -1027,7 +1027,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
pd = qof_query_date_predicate (compare_how, options, date);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_QUERYCORE_NUMERIC)) {
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_NUMERIC)) {
|
||||
QofNumericMatch options;
|
||||
gnc_numeric val;
|
||||
|
||||
@@ -1045,7 +1045,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
pd = qof_query_numeric_predicate (compare_how, options, val);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_QUERYCORE_GUID)) {
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_GUID)) {
|
||||
QofGuidMatch options;
|
||||
GList *guids;
|
||||
|
||||
@@ -1065,7 +1065,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
gnc_guid_glist_free (guids);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_QUERYCORE_INT64)) {
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_INT64)) {
|
||||
gint64 val;
|
||||
|
||||
scm = SCM_CAR (qt_scm);
|
||||
@@ -1076,7 +1076,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
pd = qof_query_int64_predicate (compare_how, val);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_QUERYCORE_DOUBLE)) {
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_DOUBLE)) {
|
||||
double val;
|
||||
|
||||
scm = SCM_CAR (qt_scm);
|
||||
@@ -1087,7 +1087,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
pd = qof_query_double_predicate (compare_how, val);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_QUERYCORE_BOOLEAN)) {
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_BOOLEAN)) {
|
||||
gboolean val;
|
||||
|
||||
scm = SCM_CAR (qt_scm);
|
||||
@@ -1098,7 +1098,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
|
||||
pd = qof_query_boolean_predicate (compare_how, val);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_QUERYCORE_CHAR)) {
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_CHAR)) {
|
||||
QofCharMatch options;
|
||||
char *char_list;
|
||||
|
||||
@@ -1117,7 +1117,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
pd = qof_query_char_predicate (options, char_list);
|
||||
free (char_list);
|
||||
|
||||
} else if (!safe_strcmp (type, QOF_QUERYCORE_KVP)) {
|
||||
} else if (!safe_strcmp (type, QOF_TYPE_KVP)) {
|
||||
GSList *kvp_path;
|
||||
KvpValue *value;
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "gnc-trace.h"
|
||||
#include "Transaction.h"
|
||||
#include "TransactionP.h"
|
||||
#include "qofquery.h"
|
||||
#include "qofqueryobject.h"
|
||||
#include "qofbook.h"
|
||||
#include "qofbook-p.h"
|
||||
@@ -378,10 +379,10 @@ gnc_lot_get_latest_split (GNCLot *lot)
|
||||
void gnc_lot_register (void)
|
||||
{
|
||||
static const QofQueryObject params[] = {
|
||||
{ QOF_QUERY_PARAM_BOOK, GNC_ID_BOOK, (QofAccessFunc)gnc_lot_get_book },
|
||||
{ QOF_QUERY_PARAM_GUID, QOF_QUERYCORE_GUID, (QofAccessFunc)gnc_lot_get_guid },
|
||||
{ LOT_IS_CLOSED, QOF_QUERYCORE_BOOLEAN, (QofAccessFunc)gnc_lot_is_closed },
|
||||
{ LOT_BALANCE, QOF_QUERYCORE_NUMERIC, (QofAccessFunc)gnc_lot_get_balance },
|
||||
{ QOF_QUERY_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)gnc_lot_get_book },
|
||||
{ QOF_QUERY_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)gnc_lot_get_guid },
|
||||
{ LOT_IS_CLOSED, QOF_TYPE_BOOLEAN, (QofAccessFunc)gnc_lot_is_closed },
|
||||
{ LOT_BALANCE, QOF_TYPE_NUMERIC, (QofAccessFunc)gnc_lot_get_balance },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
||||
@@ -2154,10 +2154,10 @@ gnc_pricedb_register (void)
|
||||
static QofQueryObject params[] = {
|
||||
{ PRICE_COMMODITY, GNC_ID_COMMODITY, (QofAccessFunc)gnc_price_get_commodity },
|
||||
{ PRICE_CURRENCY, GNC_ID_COMMODITY, (QofAccessFunc)gnc_price_get_currency },
|
||||
{ PRICE_DATE, QOF_QUERYCORE_DATE, (QofAccessFunc)gnc_price_get_time },
|
||||
{ PRICE_SOURCE, QOF_QUERYCORE_STRING, (QofAccessFunc)gnc_price_get_source },
|
||||
{ PRICE_TYPE, QOF_QUERYCORE_STRING, (QofAccessFunc)gnc_price_get_type },
|
||||
{ PRICE_VALUE, QOF_QUERYCORE_NUMERIC, (QofAccessFunc)gnc_price_get_value },
|
||||
{ PRICE_DATE, QOF_TYPE_DATE, (QofAccessFunc)gnc_price_get_time },
|
||||
{ PRICE_SOURCE, QOF_TYPE_STRING, (QofAccessFunc)gnc_price_get_source },
|
||||
{ PRICE_TYPE, QOF_TYPE_STRING, (QofAccessFunc)gnc_price_get_type },
|
||||
{ PRICE_VALUE, QOF_TYPE_NUMERIC, (QofAccessFunc)gnc_price_get_value },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
||||
@@ -70,10 +70,6 @@
|
||||
KvpFrame * gnc_kvp_bag_add (KvpFrame *kvp_root, const char *path, time_t secs,
|
||||
const char *first_name, ...);
|
||||
|
||||
/* Equivalent to gnc_kvp_bag_add(kvp_root, "gemini", secs, firstname, ...); */
|
||||
void gnc_kvp_gemini (KvpFrame *kvp_root, time_t secs,
|
||||
const char *first_name, ...);
|
||||
|
||||
|
||||
/** The gnc_kvp_bag_merge() routine will move the bag contents from
|
||||
* the 'kvp_from', to the 'into' bag. It will then delete the
|
||||
|
||||
@@ -83,17 +83,6 @@ gnc_kvp_bag_add (KvpFrame *pwd, const char * path,
|
||||
return cwd;
|
||||
}
|
||||
|
||||
/* ================================================================ */
|
||||
|
||||
void
|
||||
gnc_kvp_gemini (KvpFrame *kvp_root, time_t secs, const char *first_name, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, first_name);
|
||||
gnc_kvp_array_va (kvp_root, "gemini", secs, first_name, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
/* ================================================================ */
|
||||
|
||||
#define MATCH_GUID(elt) { \
|
||||
|
||||
@@ -286,8 +286,8 @@ qof_book_get_counter (QofBook *book, const char *counter_name)
|
||||
gboolean qof_book_register (void)
|
||||
{
|
||||
static QofQueryObject params[] = {
|
||||
{ QOF_BOOK_KVP, QOF_QUERYCORE_KVP, (QofAccessFunc)qof_book_get_slots },
|
||||
{ QOF_QUERY_PARAM_GUID, QOF_QUERYCORE_GUID, (QofAccessFunc)qof_book_get_guid },
|
||||
{ QOF_BOOK_KVP, QOF_TYPE_KVP, (QofAccessFunc)qof_book_get_slots },
|
||||
{ QOF_QUERY_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_book_get_guid },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
*/
|
||||
|
||||
/** This file defines an API that adds types to the GUID's.
|
||||
* GUID's with types cna be used to identify and reference
|
||||
* typed entities.
|
||||
* GUID's with types can be used to identify and reference
|
||||
* typed entities.
|
||||
*
|
||||
* GUID Identifiers can be used to reference QOF Objects.
|
||||
* Identifiers are globally-unique and permanent, i.e., once
|
||||
@@ -41,11 +41,8 @@
|
||||
* identifier for its lifetime.
|
||||
*
|
||||
* Identifiers can be encoded as hex strings.
|
||||
*/
|
||||
|
||||
#include "guid.h"
|
||||
|
||||
/** GUID Identifiers are 'typed' with strings. The native ids used
|
||||
*
|
||||
* GUID Identifiers are 'typed' with strings. The native ids used
|
||||
* by QOF are defined below. An id with type QOF_ID_NONE does not
|
||||
* refer to any entity, although that may change (???). An id with
|
||||
* type QOF_ID_NULL does not refer to any entity, and will never refer
|
||||
@@ -55,6 +52,8 @@
|
||||
* type of the identifier.
|
||||
*/
|
||||
|
||||
#include "guid.h"
|
||||
|
||||
typedef const char * QofIdType;
|
||||
typedef const char * QofIdTypeConst;
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
*/
|
||||
#define QOF_OBJECT_VERSION 1
|
||||
|
||||
|
||||
typedef struct _QofObject QofObject;
|
||||
typedef void (*QofForeachTypeCB) (QofObject *type, gpointer user_data);
|
||||
typedef void (*QofForeachBackendTypeCB) (QofIdTypeConst type,
|
||||
|
||||
@@ -1632,7 +1632,7 @@ static void
|
||||
qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
|
||||
{
|
||||
|
||||
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_GUID))
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_GUID))
|
||||
{
|
||||
GList *node;
|
||||
query_guid_t pdata = (query_guid_t) pd;
|
||||
@@ -1645,7 +1645,7 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_STRING))
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_STRING))
|
||||
{
|
||||
query_string_t pdata = (query_string_t) pd;
|
||||
g_string_sprintfa (gs, "\n Match type %s",
|
||||
@@ -1655,7 +1655,7 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
|
||||
pdata->matchstring);
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_NUMERIC))
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_NUMERIC))
|
||||
{
|
||||
query_numeric_t pdata = (query_numeric_t) pd;
|
||||
g_string_sprintfa (gs, "\n Match type %s",
|
||||
@@ -1664,7 +1664,7 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
|
||||
gnc_numeric_to_string (pdata->amount));
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_KVP))
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_KVP))
|
||||
{
|
||||
GSList *node;
|
||||
query_kvp_t pdata = (query_kvp_t) pd;
|
||||
@@ -1674,25 +1674,25 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_INT64))
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_INT64))
|
||||
{
|
||||
query_int64_t pdata = (query_int64_t) pd;
|
||||
g_string_sprintfa (gs, " int64: %lld", pdata->val);
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_INT32))
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_INT32))
|
||||
{
|
||||
query_int32_t pdata = (query_int32_t) pd;
|
||||
g_string_sprintfa (gs, " int32: %d", pdata->val);
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_DOUBLE))
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_DOUBLE))
|
||||
{
|
||||
query_double_t pdata = (query_double_t) pd;
|
||||
g_string_sprintfa (gs, " double: %20.16g", pdata->val);
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_DATE))
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_DATE))
|
||||
{
|
||||
query_date_t pdata = (query_date_t) pd;
|
||||
g_string_sprintfa (gs, "\n Match type %s",
|
||||
@@ -1700,7 +1700,7 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
|
||||
g_string_sprintfa (gs, " query_date: %s", gnc_print_date (pdata->date));
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_CHAR))
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_CHAR))
|
||||
{
|
||||
query_char_t pdata = (query_char_t) pd;
|
||||
g_string_sprintfa (gs, "\n Match type %s",
|
||||
@@ -1708,7 +1708,7 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
|
||||
g_string_sprintfa (gs, " char list: %s", pdata->char_list);
|
||||
return;
|
||||
}
|
||||
if (!safe_strcmp (pd->type_name, QOF_QUERYCORE_BOOLEAN))
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_BOOLEAN))
|
||||
{
|
||||
query_boolean_t pdata = (query_boolean_t) pd;
|
||||
g_string_sprintfa (gs, " boolean: %s", pdata->val?"TRUE":"FALSE");
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
#define QOF_QUERYNEW_H
|
||||
|
||||
#include "guid.h"
|
||||
#include "qofquerycore.h"
|
||||
#include "qofbook.h"
|
||||
#include "qofquerycore.h"
|
||||
|
||||
/** A Query */
|
||||
typedef struct _QofQuery QofQuery;
|
||||
|
||||
@@ -64,7 +64,7 @@ static void qof_query_register_core_object (char const *type_name,
|
||||
QueryPredicateEqual pred_equal);
|
||||
/* An example:
|
||||
*
|
||||
* qof_query_register_core_object (QOF_QUERYCORE_STRING, string_match_predicate,
|
||||
* qof_query_register_core_object (QOF_TYPE_STRING, string_match_predicate,
|
||||
* string_compare_fcn, string_free_pdata,
|
||||
* string_print_fcn, pred_equal_fcn);
|
||||
*/
|
||||
@@ -74,35 +74,35 @@ static QueryPredDataFree gncQueryCoreGetPredFree (char const *type);
|
||||
|
||||
/* Core Type Predicate helpers */
|
||||
typedef const char * (*query_string_getter) (gpointer);
|
||||
static const char * query_string_type = QOF_QUERYCORE_STRING;
|
||||
static const char * query_string_type = QOF_TYPE_STRING;
|
||||
|
||||
typedef Timespec (*query_date_getter) (gpointer);
|
||||
static const char * query_date_type = QOF_QUERYCORE_DATE;
|
||||
static const char * query_date_type = QOF_TYPE_DATE;
|
||||
|
||||
typedef gnc_numeric (*query_numeric_getter) (gpointer);
|
||||
static const char * query_numeric_type = QOF_QUERYCORE_NUMERIC;
|
||||
static const char * query_numeric_type = QOF_TYPE_NUMERIC;
|
||||
|
||||
typedef GList * (*query_glist_getter) (gpointer);
|
||||
typedef const GUID * (*query_guid_getter) (gpointer);
|
||||
static const char * query_guid_type = QOF_QUERYCORE_GUID;
|
||||
static const char * query_guid_type = QOF_TYPE_GUID;
|
||||
|
||||
typedef gint32 (*query_int32_getter) (gpointer);
|
||||
static const char * query_int32_type = QOF_QUERYCORE_INT32;
|
||||
static const char * query_int32_type = QOF_TYPE_INT32;
|
||||
|
||||
typedef gint64 (*query_int64_getter) (gpointer);
|
||||
static const char * query_int64_type = QOF_QUERYCORE_INT64;
|
||||
static const char * query_int64_type = QOF_TYPE_INT64;
|
||||
|
||||
typedef double (*query_double_getter) (gpointer);
|
||||
static const char * query_double_type = QOF_QUERYCORE_DOUBLE;
|
||||
static const char * query_double_type = QOF_TYPE_DOUBLE;
|
||||
|
||||
typedef gboolean (*query_boolean_getter) (gpointer);
|
||||
static const char * query_boolean_type = QOF_QUERYCORE_BOOLEAN;
|
||||
static const char * query_boolean_type = QOF_TYPE_BOOLEAN;
|
||||
|
||||
typedef char (*query_char_getter) (gpointer);
|
||||
static const char * query_char_type = QOF_QUERYCORE_CHAR;
|
||||
static const char * query_char_type = QOF_TYPE_CHAR;
|
||||
|
||||
typedef KvpFrame * (*query_kvp_getter) (gpointer);
|
||||
static const char * query_kvp_type = QOF_QUERYCORE_KVP;
|
||||
static const char * query_kvp_type = QOF_TYPE_KVP;
|
||||
|
||||
/* Tables for predicate storage and lookup */
|
||||
static gboolean initialized = FALSE;
|
||||
@@ -138,7 +138,7 @@ static GHashTable *predEqualTable = NULL;
|
||||
/********************************************************************/
|
||||
/* TYPE-HANDLING FUNCTIONS */
|
||||
|
||||
/* QOF_QUERYCORE_STRING */
|
||||
/* QOF_TYPE_STRING */
|
||||
|
||||
static int string_match_predicate (gpointer object, QofAccessFunc get_fcn,
|
||||
QofQueryPredData *pd)
|
||||
@@ -264,7 +264,7 @@ static char * string_to_string (gpointer object, QofAccessFunc get)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* QOF_QUERYCORE_DATE */
|
||||
/* QOF_TYPE_DATE */
|
||||
|
||||
static int date_compare (Timespec ta, Timespec tb, QofDateMatch options)
|
||||
{
|
||||
@@ -382,7 +382,7 @@ static char * date_to_string (gpointer object, QofAccessFunc get)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* QOF_QUERYCORE_NUMERIC */
|
||||
/* QOF_TYPE_NUMERIC */
|
||||
|
||||
static int numeric_match_predicate (gpointer object, QofAccessFunc get_fcn,
|
||||
QofQueryPredData* pd)
|
||||
@@ -502,7 +502,7 @@ static char * debcred_to_string (gpointer object, QofAccessFunc get)
|
||||
return g_strdup (gnc_numeric_to_string (num));
|
||||
}
|
||||
|
||||
/* QOF_QUERYCORE_GUID */
|
||||
/* QOF_TYPE_GUID */
|
||||
|
||||
static int guid_match_predicate (gpointer object, QofAccessFunc get_fcn,
|
||||
QofQueryPredData *pd)
|
||||
@@ -662,7 +662,7 @@ qof_query_guid_predicate (QofGuidMatch options, GList *guids)
|
||||
}
|
||||
|
||||
/* ================================================================ */
|
||||
/* QOF_QUERYCORE_INT32 */
|
||||
/* QOF_TYPE_INT32 */
|
||||
|
||||
static int int32_match_predicate (gpointer object, QofAccessFunc get_fcn,
|
||||
QofQueryPredData *pd)
|
||||
@@ -749,7 +749,7 @@ static char * int32_to_string (gpointer object, QofAccessFunc get)
|
||||
}
|
||||
|
||||
/* ================================================================ */
|
||||
/* QOF_QUERYCORE_INT64 */
|
||||
/* QOF_TYPE_INT64 */
|
||||
|
||||
static int int64_match_predicate (gpointer object, QofAccessFunc get_fcn,
|
||||
QofQueryPredData *pd)
|
||||
@@ -836,7 +836,7 @@ static char * int64_to_string (gpointer object, QofAccessFunc get)
|
||||
}
|
||||
|
||||
/* ================================================================ */
|
||||
/* QOF_QUERYCORE_DOUBLE */
|
||||
/* QOF_TYPE_DOUBLE */
|
||||
|
||||
static int double_match_predicate (gpointer object, QofAccessFunc get_fcn,
|
||||
QofQueryPredData *pd)
|
||||
@@ -922,7 +922,7 @@ static char * double_to_string (gpointer object, QofAccessFunc get)
|
||||
return g_strdup_printf ("%f", num);
|
||||
}
|
||||
|
||||
/* QOF_QUERYCORE_BOOLEAN */
|
||||
/* QOF_TYPE_BOOLEAN */
|
||||
|
||||
static int boolean_match_predicate (gpointer object, QofAccessFunc get_fcn,
|
||||
QofQueryPredData *pd)
|
||||
@@ -1001,7 +1001,7 @@ static char * boolean_to_string (gpointer object, QofAccessFunc get)
|
||||
return g_strdup_printf ("%s", (num ? "X" : ""));
|
||||
}
|
||||
|
||||
/* QOF_QUERYCORE_CHAR */
|
||||
/* QOF_TYPE_CHAR */
|
||||
|
||||
static int char_match_predicate (gpointer object, QofAccessFunc get_fcn,
|
||||
QofQueryPredData *pd)
|
||||
@@ -1082,7 +1082,7 @@ static char * char_to_string (gpointer object, QofAccessFunc get)
|
||||
return g_strdup_printf ("%c", num);
|
||||
}
|
||||
|
||||
/* QOF_QUERYCORE_KVP */
|
||||
/* QOF_TYPE_KVP */
|
||||
|
||||
static int kvp_match_predicate (gpointer object, QofAccessFunc get_fcn,
|
||||
QofQueryPredData *pd)
|
||||
@@ -1204,37 +1204,37 @@ static void init_tables (void)
|
||||
QueryToString toString;
|
||||
QueryPredicateEqual pred_equal;
|
||||
} knownTypes[] = {
|
||||
{ QOF_QUERYCORE_STRING, string_match_predicate, string_compare_func,
|
||||
{ QOF_TYPE_STRING, string_match_predicate, string_compare_func,
|
||||
string_copy_predicate, string_free_pdata, string_to_string,
|
||||
string_predicate_equal },
|
||||
{ QOF_QUERYCORE_DATE, date_match_predicate, date_compare_func,
|
||||
{ QOF_TYPE_DATE, date_match_predicate, date_compare_func,
|
||||
date_copy_predicate, date_free_pdata, date_to_string,
|
||||
date_predicate_equal },
|
||||
{ QOF_QUERYCORE_DEBCRED, numeric_match_predicate, numeric_compare_func,
|
||||
{ QOF_TYPE_DEBCRED, numeric_match_predicate, numeric_compare_func,
|
||||
numeric_copy_predicate, numeric_free_pdata, debcred_to_string,
|
||||
numeric_predicate_equal },
|
||||
{ QOF_QUERYCORE_NUMERIC, numeric_match_predicate, numeric_compare_func,
|
||||
{ QOF_TYPE_NUMERIC, numeric_match_predicate, numeric_compare_func,
|
||||
numeric_copy_predicate, numeric_free_pdata, numeric_to_string,
|
||||
numeric_predicate_equal },
|
||||
{ QOF_QUERYCORE_GUID, guid_match_predicate, NULL,
|
||||
{ QOF_TYPE_GUID, guid_match_predicate, NULL,
|
||||
guid_copy_predicate, guid_free_pdata, NULL,
|
||||
guid_predicate_equal },
|
||||
{ QOF_QUERYCORE_INT32, int32_match_predicate, int32_compare_func,
|
||||
{ QOF_TYPE_INT32, int32_match_predicate, int32_compare_func,
|
||||
int32_copy_predicate, int32_free_pdata, int32_to_string,
|
||||
int32_predicate_equal },
|
||||
{ QOF_QUERYCORE_INT64, int64_match_predicate, int64_compare_func,
|
||||
{ QOF_TYPE_INT64, int64_match_predicate, int64_compare_func,
|
||||
int64_copy_predicate, int64_free_pdata, int64_to_string,
|
||||
int64_predicate_equal },
|
||||
{ QOF_QUERYCORE_DOUBLE, double_match_predicate, double_compare_func,
|
||||
{ QOF_TYPE_DOUBLE, double_match_predicate, double_compare_func,
|
||||
double_copy_predicate, double_free_pdata, double_to_string,
|
||||
double_predicate_equal },
|
||||
{ QOF_QUERYCORE_BOOLEAN, boolean_match_predicate, boolean_compare_func,
|
||||
{ QOF_TYPE_BOOLEAN, boolean_match_predicate, boolean_compare_func,
|
||||
boolean_copy_predicate, boolean_free_pdata, boolean_to_string,
|
||||
boolean_predicate_equal },
|
||||
{ QOF_QUERYCORE_CHAR, char_match_predicate, char_compare_func,
|
||||
{ QOF_TYPE_CHAR, char_match_predicate, char_compare_func,
|
||||
char_copy_predicate, char_free_pdata, char_to_string,
|
||||
char_predicate_equal },
|
||||
{ QOF_QUERYCORE_KVP, kvp_match_predicate, NULL, kvp_copy_predicate,
|
||||
{ QOF_TYPE_KVP, kvp_match_predicate, NULL, kvp_copy_predicate,
|
||||
kvp_free_pdata, NULL, kvp_predicate_equal },
|
||||
};
|
||||
|
||||
|
||||
@@ -26,29 +26,18 @@
|
||||
@author Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU>
|
||||
*/
|
||||
|
||||
#ifndef QOF_QUERYCORE_H
|
||||
#define QOF_QUERYCORE_H
|
||||
#ifndef QOF_TYPE_H
|
||||
#define QOF_TYPE_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;
|
||||
#include "qofqueryobject.h"
|
||||
|
||||
typedef struct _QofQueryPredData QofQueryPredData;
|
||||
|
||||
/** The QofAccessFunc 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 (*QofAccessFunc)(gpointer);
|
||||
|
||||
/** Standard Query comparitors, for how to compare objects in a predicate.
|
||||
* Note that not all core types implement all comparitors
|
||||
*/
|
||||
@@ -64,27 +53,26 @@ typedef enum {
|
||||
/** List of known core query data-types...
|
||||
* Each core query type defines it's set of optional "comparitor qualifiers".
|
||||
*/
|
||||
#define QOF_QUERYCORE_STRING "string"
|
||||
/* Comparisons for QOF_TYPE_STRING */
|
||||
typedef enum {
|
||||
QOF_STRING_MATCH_NORMAL = 1,
|
||||
QOF_STRING_MATCH_CASEINSENSITIVE
|
||||
} QofStringMatch;
|
||||
|
||||
#define QOF_QUERYCORE_DATE "date"
|
||||
/* Comparisons for QOF_TYPE_DATE */
|
||||
typedef enum {
|
||||
QOF_DATE_MATCH_NORMAL = 1,
|
||||
QOF_DATE_MATCH_ROUNDED
|
||||
} QofDateMatch;
|
||||
|
||||
#define QOF_QUERYCORE_NUMERIC "numeric"
|
||||
#define QOF_QUERYCORE_DEBCRED "debcred"
|
||||
/* Comparisons for QOF_TYPE_NUMERIC, QOF_TYPE_DEBCRED */
|
||||
typedef enum {
|
||||
QOF_NUMERIC_MATCH_DEBIT = 1,
|
||||
QOF_NUMERIC_MATCH_CREDIT,
|
||||
QOF_NUMERIC_MATCH_ANY
|
||||
} QofNumericMatch;
|
||||
|
||||
#define QOF_QUERYCORE_GUID "guid"
|
||||
/* Comparisons for QOF_TYPE_GUID */
|
||||
typedef enum {
|
||||
/** These expect a single object and expect the
|
||||
* QofAccessFunc returns GUID* */
|
||||
@@ -99,14 +87,12 @@ typedef enum {
|
||||
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"
|
||||
/** No extended comparisons for QOF_TYPE_INT32, QOF_TYPE_INT64,
|
||||
* QOF_TYPE_DOUBLE, QOF_TYPE_BOOLEAN, QOF_TYPE_KVP
|
||||
*/
|
||||
|
||||
/** A CHAR type is for a RECNCell */
|
||||
#define QOF_QUERYCORE_CHAR "character"
|
||||
/* Comparisons for QOF_TYPE_CHAR */
|
||||
typedef enum {
|
||||
QOF_CHAR_MATCH_ANY = 1,
|
||||
QOF_CHAR_MATCH_NONE
|
||||
@@ -114,7 +100,7 @@ typedef enum {
|
||||
|
||||
/** Head of Predicate Data structures. All PData must start like this. */
|
||||
struct _QofQueryPredData {
|
||||
QofQueryCoreType type_name; /* QUERYCORE_* */
|
||||
QofType type_name; /* QOF_TYPE_* */
|
||||
QofQueryCompare how;
|
||||
};
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ QofAccessFunc qof_query_object_get_parameter_getter (QofIdTypeConst obj_name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QofQueryCoreType qof_query_object_parameter_type (QofIdTypeConst obj_name,
|
||||
QofType qof_query_object_parameter_type (QofIdTypeConst obj_name,
|
||||
const char *param_name)
|
||||
{
|
||||
const QofQueryObject *obj;
|
||||
|
||||
@@ -28,8 +28,32 @@
|
||||
#ifndef QOF_QUERYOBJECT_H
|
||||
#define QOF_QUERYOBJECT_H
|
||||
|
||||
#include "qofquery.h"
|
||||
#include "qofquerycore.h"
|
||||
// #include "qofquery.h"
|
||||
#include "qofid.h"
|
||||
|
||||
#define QOF_TYPE_STRING "string"
|
||||
#define QOF_TYPE_DATE "date"
|
||||
#define QOF_TYPE_NUMERIC "numeric"
|
||||
#define QOF_TYPE_DEBCRED "debcred"
|
||||
#define QOF_TYPE_GUID "guid"
|
||||
#define QOF_TYPE_INT32 "gint32"
|
||||
#define QOF_TYPE_INT64 "gint64"
|
||||
#define QOF_TYPE_DOUBLE "double"
|
||||
#define QOF_TYPE_BOOLEAN "boolean"
|
||||
#define QOF_TYPE_KVP "kvp"
|
||||
#define QOF_TYPE_CHAR "character"
|
||||
|
||||
/** Type of Paramters (String, Date, Numeric, GUID, etc.) */
|
||||
typedef const char * QofType;
|
||||
|
||||
/** The QofAccessFunc 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 (*QofAccessFunc)(gpointer);
|
||||
|
||||
/** This structure is for each queriable parameter in an object
|
||||
*
|
||||
@@ -41,8 +65,8 @@
|
||||
typedef struct _QofQueryObject
|
||||
{
|
||||
const char * param_name;
|
||||
QofQueryCoreType param_type;
|
||||
QofAccessFunc param_getfcn;
|
||||
QofType param_type;
|
||||
QofAccessFunc param_getfcn;
|
||||
} QofQueryObject;
|
||||
|
||||
/** This function is the default sort function for a particular object type */
|
||||
@@ -67,19 +91,19 @@ void qof_query_object_register (QofIdTypeConst obj_name,
|
||||
* #define MY_QUERY_OBJ_TRANS "trans"
|
||||
*
|
||||
* static QofQueryObject myQueryObjectParams[] = {
|
||||
* { 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_MEMO, QOF_TYPE_STRING, myMemoGetter },
|
||||
* { MY_QUERY_OBJ_VALUE, QOF_TYPE_NUMERIC, myValueGetter },
|
||||
* { MY_QUERY_OBJ_DATE, QOF_TYPE_DATE, myDateGetter },
|
||||
* { MY_QUERY_OBJ_ACCOUNT, GNC_ID_ACCOUNT, myAccountGetter },
|
||||
* { MY_QUERY_OBJ_TRANS, GNC_ID_TRANS, myTransactionGetter },
|
||||
* NULL };
|
||||
*
|
||||
* qof_query_object_registerParamters ("myObjectName", myQueryObjectCompare,
|
||||
* qof_query_object_register ("myObjectName", myQueryObjectCompare,
|
||||
* &myQueryObjectParams);
|
||||
*/
|
||||
|
||||
/** Return the core datatype of the specified object's parameter */
|
||||
QofQueryCoreType qof_query_object_parameter_type (QofIdTypeConst obj_name,
|
||||
QofType qof_query_object_parameter_type (QofIdTypeConst obj_name,
|
||||
const char *param_name);
|
||||
|
||||
/** Return the registered Object Definition for the requested parameter */
|
||||
|
||||
Reference in New Issue
Block a user