GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 <[email protected]> *
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 [email protected] *
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 "kvp_frame.h"
38 #include "qofclass.h"
39 
40 #ifdef __cplusplus
41 extern "C"
42 {
43 #endif
44 
51 
55 typedef enum
56 {
57  QOF_COMPARE_LT = 1,
58  QOF_COMPARE_LTE,
59  QOF_COMPARE_EQUAL,
60  QOF_COMPARE_GT,
61  QOF_COMPARE_GTE,
62  QOF_COMPARE_NEQ,
63  QOF_COMPARE_CONTAINS,
64  QOF_COMPARE_NCONTAINS
66 
70 /* Comparisons for QOF_TYPE_STRING */
71 typedef enum
72 {
73  QOF_STRING_MATCH_NORMAL = 1,
74  QOF_STRING_MATCH_CASEINSENSITIVE
76 
84 typedef enum
85 {
86  QOF_DATE_MATCH_NORMAL = 1,
87  QOF_DATE_MATCH_DAY
88 } QofDateMatch;
89 
102 typedef enum
103 {
104  QOF_NUMERIC_MATCH_DEBIT = 1,
105  QOF_NUMERIC_MATCH_CREDIT,
106  QOF_NUMERIC_MATCH_ANY
108 
109 /* Comparisons for QOF_TYPE_GUID */
110 typedef enum
111 {
115  QOF_GUID_MATCH_NONE,
116  QOF_GUID_MATCH_NULL,
123 } QofGuidMatch;
124 
133 typedef enum
134 {
135  QOF_CHAR_MATCH_ANY = 1,
136  QOF_CHAR_MATCH_NONE
137 } QofCharMatch;
138 
145 {
146  QofType type_name; /* QOF_TYPE_* */
147  QofQueryCompare how;
148 };
149 
152 typedef GSList QofQueryParamList;
153 
156 QofQueryPredData *qof_query_string_predicate (QofQueryCompare how,
157  const gchar *str,
158  QofStringMatch options,
159  gboolean is_regex);
160 
161 QofQueryPredData *qof_query_date_predicate (QofQueryCompare how,
162  QofDateMatch options,
163  Timespec date);
164 
165 QofQueryPredData *qof_query_numeric_predicate (QofQueryCompare how,
166  QofNumericMatch options,
167  gnc_numeric value);
168 
169 QofQueryPredData *qof_query_guid_predicate (QofGuidMatch options, GList *guids);
170 QofQueryPredData *qof_query_int32_predicate (QofQueryCompare how, gint32 val);
171 QofQueryPredData *qof_query_int64_predicate (QofQueryCompare how, gint64 val);
172 QofQueryPredData *qof_query_double_predicate (QofQueryCompare how, double val);
173 QofQueryPredData *qof_query_boolean_predicate (QofQueryCompare how, gboolean val);
174 QofQueryPredData *qof_query_char_predicate (QofCharMatch options,
175  const gchar *chars);
176 QofQueryPredData *qof_query_collect_predicate (QofGuidMatch options,
177  QofCollection *coll);
178 QofQueryPredData *qof_query_choice_predicate (QofGuidMatch options, GList *guids);
179 
185  QofQueryParamList *path,
186  const KvpValue *value);
187 
191  const gchar *path,
192  const KvpValue *value);
193 
196 
199 
205 char * qof_query_core_to_string (QofType, gpointer object, QofParam *getter);
206 
211 int qof_string_number_compare_func (gpointer a, gpointer b, gint options,
212  QofParam *this_param);
213 
214 
215 #ifdef __cplusplus
216 }
217 #endif
218 
219 #endif /* QOF_QUERYCORE_H */
220 /* @} */
221 /* @} */
QofQueryPredData * qof_query_kvp_predicate_path(QofQueryCompare how, const gchar *path, const KvpValue *value)
Date and Time handling routines.
QofQueryPredData * qof_query_kvp_predicate(QofQueryCompare how, QofQueryParamList *path, const KvpValue *value)
A key-value frame system.
void qof_query_core_predicate_free(QofQueryPredData *pdata)
const char * QofType
Definition: qofclass.h:158
An exact-rational-number library for gnucash. (to be renamed qofnumeric.h in libqof2) ...
Use a 64-bit unsigned int timespec.
Definition: gnc-date.h:299
QofStringMatch
Definition: qofquerycore.h:71
GSList QofQueryParamList
Definition: qofquerycore.h:152
QofGuidMatch
Definition: qofquerycore.h:110
char * qof_query_core_to_string(QofType, gpointer object, QofParam *getter)
QofQueryCompare
Definition: qofquerycore.h:55
QofCharMatch
Definition: qofquerycore.h:133
API for registering paramters on objects.
int qof_string_number_compare_func(gpointer a, gpointer b, gint options, QofParam *this_param)
QofDateMatch
Definition: qofquerycore.h:84
gboolean qof_query_date_predicate_get_date(const QofQueryPredData *pd, Timespec *date)
QofQueryPredData * qof_query_core_predicate_copy(const QofQueryPredData *pdata)
QofNumericMatch
Definition: qofquerycore.h:102
struct KvpValueImpl KvpValue
Definition: kvp_frame.h:80