GnuCash c935c2f+
Loading...
Searching...
No Matches
qofquerycore.h
Go to the documentation of this file.
1/********************************************************************\
2 * qofquerycore.h -- API for providing core Query data types *
3 * Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU> *
4 * *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License as *
7 * published by the Free Software Foundation; either version 2 of *
8 * the License, or (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License*
16 * along with this program; if not, contact: *
17 * *
18 * Free Software Foundation Voice: +1-617-542-5942 *
19 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
20 * Boston, MA 02110-1301, USA gnu@gnu.org *
21 * *
22\********************************************************************/
23
32#ifndef QOF_QUERYCORE_H
33#define QOF_QUERYCORE_H
34
35#include "gnc-numeric.h"
36#include "gnc-date.h"
37#include "qofclass.h"
38
39#ifdef __cplusplus
40extern "C"
41{
42#endif
43
49typedef struct _QofQueryPredData QofQueryPredData;
50
54typedef enum
55{
56 QOF_COMPARE_LT = 1,
57 QOF_COMPARE_LTE,
58 QOF_COMPARE_EQUAL,
59 QOF_COMPARE_GT,
60 QOF_COMPARE_GTE,
61 QOF_COMPARE_NEQ,
62 QOF_COMPARE_CONTAINS,
63 QOF_COMPARE_NCONTAINS
65
69/* Comparisons for QOF_TYPE_STRING */
70typedef enum
71{
72 QOF_STRING_MATCH_NORMAL = 1,
73 QOF_STRING_MATCH_CASEINSENSITIVE
75
83typedef enum
84{
85 QOF_DATE_MATCH_NORMAL = 1,
86 QOF_DATE_MATCH_DAY
88
101typedef enum
102{
103 QOF_NUMERIC_MATCH_DEBIT = 1,
104 QOF_NUMERIC_MATCH_CREDIT,
105 QOF_NUMERIC_MATCH_ANY
107
108/* Comparisons for QOF_TYPE_GUID */
109typedef enum
110{
114 QOF_GUID_MATCH_NONE,
115 QOF_GUID_MATCH_NULL,
123
132typedef enum
133{
134 QOF_CHAR_MATCH_ANY = 1,
135 QOF_CHAR_MATCH_NONE
137
144{
145 QofType type_name; /* QOF_TYPE_* */
146 QofQueryCompare how;
147};
148
151typedef GSList QofQueryParamList;
152
155QofQueryPredData *qof_query_string_predicate (QofQueryCompare how,
156 const gchar *str,
157 QofStringMatch options,
158 gboolean is_regex);
159
160QofQueryPredData *qof_query_date_predicate (QofQueryCompare how,
161 QofDateMatch options,
162 time64 date);
163
164QofQueryPredData *qof_query_numeric_predicate (QofQueryCompare how,
165 QofNumericMatch options,
166 gnc_numeric value);
167
168QofQueryPredData *qof_query_guid_predicate (QofGuidMatch options, GList *guids);
169QofQueryPredData *qof_query_int32_predicate (QofQueryCompare how, gint32 val);
170QofQueryPredData *qof_query_int64_predicate (QofQueryCompare how, gint64 val);
171QofQueryPredData *qof_query_double_predicate (QofQueryCompare how, double val);
172QofQueryPredData *qof_query_boolean_predicate (QofQueryCompare how, gboolean val);
173QofQueryPredData *qof_query_char_predicate (QofCharMatch options,
174 const gchar *chars);
175QofQueryPredData *qof_query_choice_predicate (QofGuidMatch options, GList *guids);
176
178QofQueryPredData *qof_query_core_predicate_copy (const QofQueryPredData *pdata);
179
181void qof_query_core_predicate_free (QofQueryPredData *pdata);
182
184gboolean qof_query_date_predicate_get_date (const QofQueryPredData *pd, time64 *date);
185gboolean qof_query_char_predicate_get_char (const QofQueryPredData *pd, char **chars);
186
190char * qof_query_core_to_string (QofType, gpointer object, QofParam *getter);
191
196int qof_string_number_compare_func (gpointer a, gpointer b, gint options,
197 QofParam *this_param);
198
199
200#ifdef __cplusplus
201}
202#endif
203
204#endif /* QOF_QUERYCORE_H */
205/* @} */
206/* @} */
Date and Time handling routines.
An exact-rational-number library for gnucash.
const char * QofType
Type of Parameters (String, Date, Numeric, GncGUID, etc.)
Definition qofclass.h:104
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition gnc-date.h:87
QofNumericMatch
Comparisons for QOF_TYPE_NUMERIC, QOF_TYPE_DEBCRED.
QofQueryPredData * qof_query_core_predicate_copy(const QofQueryPredData *pdata)
Copy a predicate.
QofDateMatch
Comparisons for QOF_TYPE_DATE The QOF_DATE_MATCH_DAY comparison rounds the two time values to mid-day...
void qof_query_core_predicate_free(QofQueryPredData *pdata)
Destroy a predicate.
QofCharMatch
A CHAR type is for a RECNCell, Comparisons for QOF_TYPE_CHAR 'ANY' will match any character in the st...
gboolean qof_query_date_predicate_get_date(const QofQueryPredData *pd, time64 *date)
Retrieve a predicate.
GSList QofQueryParamList
A list of parameters (QofIdType) used to describe a parameter to use in a predicate or when sorting.
char * qof_query_core_to_string(QofType, gpointer object, QofParam *getter)
Return a printable string for a core data object.
QofGuidMatch
QofStringMatch
List of known core query data-types... Each core query type defines it's set of optional "comparator ...
int qof_string_number_compare_func(gpointer a, gpointer b, gint options, QofParam *this_param)
Compare two parameter(strings) as if they are numbers! the two objects, a and b, are the objects bein...
QofQueryCompare
Standard Query comparators, for how to compare objects in a predicate.
@ QOF_GUID_MATCH_ALL
These expect a GList* of objects and calls the QofAccessFunc routine on each item in the list to obta...
@ QOF_GUID_MATCH_ANY
These expect a single object and expect the QofAccessFunc returns GncGUID*.
@ QOF_GUID_MATCH_LIST_ANY
These expect a single object and expect the QofAccessFunc function to return a GList* of GncGUID* (th...
API for registering parameters on objects.
No extended comparisons for QOF_TYPE_INT32, QOF_TYPE_INT64, QOF_TYPE_DOUBLE, QOF_TYPE_BOOLEAN.