예제 #1
0
파일: Query.c 프로젝트: fraga/gnucash
void
xaccQueryAddClearedMatch(QofQuery * q, cleared_match_t how, QofQueryOp op)
{
    QofQueryPredData *pred_data;
    GSList *param_list;
    char chars[6];
    int i = 0;

    if (!q)
        return;

    if (how & CLEARED_CLEARED)
        chars[i++] = CREC;
    if (how & CLEARED_RECONCILED)
        chars[i++] = YREC;
    if (how & CLEARED_FROZEN)
        chars[i++] = FREC;
    if (how & CLEARED_NO)
        chars[i++] = NREC;
    if (how & CLEARED_VOIDED)
        chars[i++] = VREC;
    chars[i] = '\0';

    pred_data = qof_query_char_predicate (QOF_CHAR_MATCH_ANY, chars);
    if (!pred_data)
        return;

    param_list = qof_query_build_param_list (SPLIT_RECONCILE, NULL);

    qof_query_add_term (q, param_list, pred_data, op);
}
예제 #2
0
static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
{
    GNCSearchReconciled *fi = (GNCSearchReconciled *)fe;
    char chars[6];
    cleared_match_t value;
    int i;

    g_return_val_if_fail (fi, NULL);
    g_return_val_if_fail (IS_GNCSEARCH_RECONCILED (fi), NULL);

    /* This code should look a lot like xaccQueryAddClearedMatch() */

    value = fi->value;
    i = 0;

    if (value & CLEARED_CLEARED)
        chars[i++] = CREC;
    if (value & CLEARED_RECONCILED)
        chars[i++] = YREC;
    if (value & CLEARED_FROZEN)
        chars[i++] = FREC;
    if (value & CLEARED_NO)
        chars[i++] = NREC;
    if (value & CLEARED_VOIDED)
        chars[i++] = VREC;
    chars[i] = '\0';

    return qof_query_char_predicate (fi->how, chars);
}