QOF  0.8.7
qofquerycore-p.h
1 /********************************************************************\
2  * qofquerycore-p.h -- Private API for providing core Query data types *
3  * Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU> *
4  * Copyright (C) 2006 Neil Williams <linux@codehelp.co.uk> *
5  * *
6  * This program is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU General Public License as *
8  * published by the Free Software Foundation; either version 2 of *
9  * the License, or (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License*
17  * along with this program; if not, contact: *
18  * *
19  * Free Software Foundation Voice: +1-617-542-5942 *
20  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
21  * Boston, MA 02110-1301, USA gnu@gnu.org *
22  * *
23 \********************************************************************/
24 
25 #ifndef QOF_QUERYCOREP_H
26 #define QOF_QUERYCOREP_H
27 
28 #include <sys/types.h>
29 #include <time.h>
30 #include <regex.h>
31 #include <string.h>
32 
33 #include "qofquerycore.h"
34 
35 /* Initalize the Query Core registry and install the default type handlers */
36 void qof_query_core_init (void);
37 void qof_query_core_shutdown (void);
38 
39 /*
40  * An arbitrary Query Predicate. Given the object and the
41  * particular parameter get-function (obtained from the registry by
42  * the Query internals), compare the object's parameter to the
43  * predicate data.
44  */
45 typedef gint (*QofQueryPredicateFunc) (gpointer object,
46  QofParam * getter,
47  QofQueryPredData * pdata);
48 
49 /* A callback for how to compare two (same-type) objects based on a
50  * common getter (parameter member), using the provided comparison
51  * options (which are the type-specific options).
52  */
53 typedef gint (*QofCompareFunc) (gpointer a, gpointer b,
54  gint compare_options, QofParam * getter);
55 
56 /* Lookup functions */
57 QofQueryPredicateFunc qof_query_core_get_predicate (gchar const *type);
58 QofCompareFunc qof_query_core_get_compare (gchar const *type);
59 
60 /* Compare two predicates */
61 gboolean qof_query_core_predicate_equal (QofQueryPredData * p1,
62  QofQueryPredData * p2);
63 
64 /* Predicate Data Structures:
65  *
66  * These are defined such that you can cast between these types and
67  * a QofQueryPredData.
68  *
69  * Note that these are provided for READ ONLY PURPOSES. You should NEVER
70  * write into these structures, change them, or use them to create a
71  * Query.
72  */
73 
74 typedef struct
75 {
77  QofStringMatch options;
78  gboolean is_regex;
79  gchar *matchstring;
80  regex_t compiled;
82 
83 typedef struct
84 {
86  QofDateMatch options;
87  QofTime *qt;
89 
90 typedef struct
91 {
93  QofNumericMatch options;
94  QofNumeric amount;
96 
97 typedef struct
98 {
100  QofGuidMatch options;
101  GList *guids;
103 
104 typedef struct
105 {
106  QofQueryPredData pd;
107  gint32 val;
109 
110 typedef struct
111 {
112  QofQueryPredData pd;
113  gint64 val;
115 
116 typedef struct
117 {
118  QofQueryPredData pd;
119  double val;
121 
122 typedef struct
123 {
124  QofQueryPredData pd;
125  gboolean val;
127 
128 typedef struct
129 {
130  QofQueryPredData pd;
131  QofCharMatch options;
132  gchar *char_list;
134 
135 typedef struct
136 {
137  QofQueryPredData pd;
138  GSList *path;
139  KvpValue *value;
141 
142 typedef struct
143 {
144  QofQueryPredData pd;
145  QofGuidMatch options;
146  QofCollection *coll;
147  GList *guids;
149 
150 typedef struct
151 {
152  QofQueryPredData pd;
153  QofGuidMatch options;
154  const GUID *guid;
155  GList *guids;
157 
158 #endif /* QOF_QUERYCOREP_H */
QofStringMatch
Definition: qofquerycore.h:65
struct QofCollection_s QofCollection
Definition: qofid.h:138
struct _KvpValue KvpValue
Definition: kvpframe.h:78
API for providing core Query data types.
QofGuidMatch
Definition: qofquerycore.h:104
QofCharMatch
Definition: qofquerycore.h:127
Definition: guid.h:53
struct QofTime64 QofTime
Use a 64-bit signed int QofTime.
Definition: qoftime.h:112
QofDateMatch
Definition: qofquerycore.h:78
QofNumericMatch
Definition: qofquerycore.h:96