QOF: qofquerycore-p.h Source File

QOF 0.7.5

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

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 {
76 QofQueryPredData pd;
77 QofStringMatch options;
78 gboolean is_regex;
79 gchar *matchstring;
80 regex_t compiled;
81 } query_string_def, *query_string_t;
82
83 typedef struct
84 {
85 QofQueryPredData pd;
86 QofDateMatch options;
87 QofTime *qt;
88 } query_time_def, *query_time_t;
89
90 typedef struct
91 {
92 QofQueryPredData pd;
93 QofNumericMatch options;
94 QofNumeric amount;
95 } query_numeric_def, *query_numeric_t;
96
97 typedef struct
98 {
99 QofQueryPredData pd;
100 QofGuidMatch options;
101 GList *guids;
102 } query_guid_def, *query_guid_t;
103
104 typedef struct
105 {
106 QofQueryPredData pd;
107 gint32 val;
108 } query_int32_def, *query_int32_t;
109
110 typedef struct
111 {
112 QofQueryPredData pd;
113 gint64 val;
114 } query_int64_def, *query_int64_t;
115
116 typedef struct
117 {
118 QofQueryPredData pd;
119 double val;
120 } query_double_def, *query_double_t;
121
122 typedef struct
123 {
124 QofQueryPredData pd;
125 gboolean val;
126 } query_boolean_def, *query_boolean_t;
127
128 typedef struct
129 {
130 QofQueryPredData pd;
131 QofCharMatch options;
132 gchar *char_list;
133 } query_char_def, *query_char_t;
134
135 typedef struct
136 {
137 QofQueryPredData pd;
138 GSList *path;
139 KvpValue *value;
140 } query_kvp_def, *query_kvp_t;
141
142 typedef struct
143 {
144 QofQueryPredData pd;
145 QofGuidMatch options;
146 QofCollection *coll;
147 GList *guids;
148 } query_coll_def, *query_coll_t;
149
150 typedef struct
151 {
152 QofQueryPredData pd;
153 QofGuidMatch options;
154 const GUID *guid;
155 GList *guids;
156 } query_choice_def, *query_choice_t;
157
158 #endif /* QOF_QUERYCOREP_H */
query_string_def
Definition: qofquerycore-p.h:74
_QofParam
Definition: qofclass.h:195
query_boolean_def
Definition: qofquerycore-p.h:122
query_guid_def
Definition: qofquerycore-p.h:97
QofStringMatch
QofStringMatch
Definition: qofquerycore.h:65
query_time_def
Definition: qofquerycore-p.h:83
query_numeric_def
Definition: qofquerycore-p.h:90
query_int64_def
Definition: qofquerycore-p.h:110
QofCollection
struct QofCollection_s QofCollection
Definition: qofid.h:138
KvpValue
struct _KvpValue KvpValue
Definition: kvpframe.h:78
qofquerycore.h
API for providing core Query data types.
QofGuidMatch
QofGuidMatch
Definition: qofquerycore.h:104
query_int32_def
Definition: qofquerycore-p.h:104
query_double_def
Definition: qofquerycore-p.h:116
query_char_def
Definition: qofquerycore-p.h:128
_QofNumeric
Definition: qofnumeric.h:52
query_choice_def
Definition: qofquerycore-p.h:150
QofCharMatch
QofCharMatch
Definition: qofquerycore.h:127
_GUID
Definition: guid.h:53
query_kvp_def
Definition: qofquerycore-p.h:135
_QofQueryPredData
Definition: qofquerycore.h:138
query_coll_def
Definition: qofquerycore-p.h:142
QofTime
struct QofTime64 QofTime
Use a 64-bit signed int QofTime.
Definition: qoftime.h:120
QofDateMatch
QofDateMatch
Definition: qofquerycore.h:78
QofNumericMatch
QofNumericMatch
Definition: qofquerycore.h:96