QOF: qofquery.h Source File

QOF 0.7.5

qofquery.h
Go to the documentation of this file.
1 /********************************************************************\
2 * qofquery.h -- find objects that match a certain expression. *
3 * *
4 * This program is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU General Public License as *
6 * published by the Free Software Foundation; either version 2 of *
7 * the License, or (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License*
15 * along with this program; if not, contact: *
16 * *
17 * Free Software Foundation Voice: +1-617-542-5942 *
18 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19 * Boston, MA 02110-1301, USA gnu@gnu.org *
20 * *
21 \********************************************************************/
22
74 #ifndef QOF_QUERYNEW_H
75 #define QOF_QUERYNEW_H
76
77 #include "guid.h"
78 #include "qofbook.h"
79 #include "qofquerycore.h"
80 #include "qofchoice.h"
81
82 #define QOF_MOD_QUERY "qof-query"
83
85 typedef struct _QofQuery QofQuery;
86
88 typedef enum
89 {
90 QOF_QUERY_AND = 1,
91 QOF_QUERY_OR,
92 QOF_QUERY_NAND,
93 QOF_QUERY_NOR,
94 QOF_QUERY_XOR
95 } QofQueryOp;
96
98 #define QOF_QUERY_FIRST_TERM QOF_QUERY_AND
99
101 #define QUERY_DEFAULT_SORT "QofQueryDefaultSort"
102
104 #define QOF_PARAM_BOOK "book"
105 #define QOF_PARAM_GUID "guid"
106
108 #define QOF_PARAM_KVP "kvp"
109 #define QOF_PARAM_ACTIVE "active"
110 #define QOF_PARAM_VERSION "version"
111
121 void qof_query_init (void);
122 void qof_query_shutdown (void);
129 GSList *qof_query_build_param_list (gchar const *param, ...);
130
140 QofQuery *qof_query_create (void);
141
143 QofQuery *qof_query_create_for (QofIdTypeConst obj_type);
144
146 void qof_query_destroy (QofQuery * q);
147
151 void
152 qof_query_search_for (QofQuery * query, QofIdTypeConst obj_type);
153
163 void qof_query_set_book (QofQuery * q, QofBook * book);
164
191 void qof_query_add_term (QofQuery * query, GSList * param_list,
192 QofQueryPredData * pred_data, QofQueryOp op);
193
195 void qof_query_add_guid_match (QofQuery * q, GSList * param_list,
196 const GUID * guid, QofQueryOp op);
198 void qof_query_add_guid_list_match (QofQuery * q, GSList * param_list,
199 GList * guid_list, QofGuidMatch options,
200 QofQueryOp op);
201
206 void qof_query_add_boolean_match (QofQuery * q,
207 GSList * param_list,
208 gboolean value, QofQueryOp op);
209
220 GList *
221 qof_query_run (QofQuery * query);
222
227 GList *
228 qof_query_last_run (QofQuery * query);
229
233 void qof_query_clear (QofQuery * query);
234
240 void qof_query_purge_terms (QofQuery * q, GSList * param_list);
241
246 gint qof_query_has_terms (QofQuery * q);
247
250 gint qof_query_num_terms (QofQuery * q);
251
253 gboolean
254 qof_query_has_term_type (QofQuery * q, GSList * term_param);
255 GSList *
256 qof_query_get_term_type (QofQuery * q, GSList * term_param);
257
259 QofQuery *qof_query_copy (QofQuery * q);
260
272 QofQuery *
273 qof_query_invert (QofQuery * q);
274
290 QofQuery *
291 qof_query_merge (QofQuery * q1, QofQuery * q2, QofQueryOp op);
292
296 void
297 qof_query_merge_in_place (QofQuery * q1, QofQuery * q2, QofQueryOp op);
298
319 void qof_query_set_sort_order (QofQuery * q,
320 GSList * primary_sort_params,
321 GSList * secondary_sort_params,
322 GSList * tertiary_sort_params);
323
324 void qof_query_set_sort_options (QofQuery * q, gint prim_op, gint sec_op,
325 gint tert_op);
326
338 void
339 qof_query_set_sort_increasing (QofQuery * q, gboolean prim_inc,
340 gboolean sec_inc, gboolean tert_inc);
341
352 void qof_query_set_max_results (QofQuery * q, gint n);
353
360 gboolean qof_query_equal (QofQuery * q1, QofQuery * q2);
361
363 QofIdType qof_query_get_search_for (QofQuery * q);
364
366 GList *qof_query_get_books (QofQuery * q);
367
370 #endif /* QOF_QUERYNEW_H */
qof_query_num_terms
gint qof_query_num_terms(QofQuery *q)
Definition: qofquery.c:941
qof_query_get_search_for
QofIdType qof_query_get_search_for(QofQuery *q)
Definition: qofquery.c:1400
qof_query_has_term_type
gboolean qof_query_has_term_type(QofQuery *q, GSList *term_param)
Definition: qofquery.c:953
QofIdType
const gchar * QofIdType
Definition: qofid.h:81
qof_query_equal
gboolean qof_query_equal(QofQuery *q1, QofQuery *q2)
Definition: qofquery.c:1512
guid.h
globally unique ID User API
qof_query_copy
QofQuery * qof_query_copy(QofQuery *q)
Definition: qofquery.c:1009
qof_query_set_sort_increasing
void qof_query_set_sort_increasing(QofQuery *q, gboolean prim_inc, gboolean sec_inc, gboolean tert_inc)
Definition: qofquery.c:1282
qof_query_purge_terms
void qof_query_purge_terms(QofQuery *q, GSList *param_list)
Definition: qofquery.c:717
QofQuery
struct _QofQuery QofQuery
Definition: qofquery.h:85
qof_query_create_for
QofQuery * qof_query_create_for(QofIdTypeConst obj_type)
Definition: qofquery.c:922
qofquerycore.h
API for providing core Query data types.
qof_query_destroy
void qof_query_destroy(QofQuery *q)
Definition: qofquery.c:998
QofGuidMatch
QofGuidMatch
Definition: qofquerycore.h:104
qof_query_init
void qof_query_init(void)
Definition: qofquery.c:1375
qof_query_add_term
void qof_query_add_term(QofQuery *query, GSList *param_list, QofQueryPredData *pred_data, QofQueryOp op)
Definition: qofquery.c:691
qof_query_set_book
void qof_query_set_book(QofQuery *q, QofBook *book)
Definition: qofquery.c:1335
qof_query_set_sort_order
void qof_query_set_sort_order(QofQuery *q, GSList *primary_sort_params, GSList *secondary_sort_params, GSList *tertiary_sort_params)
Definition: qofquery.c:1247
qof_query_has_terms
gint qof_query_has_terms(QofQuery *q)
Definition: qofquery.c:933
qof_query_merge
QofQuery * qof_query_merge(QofQuery *q1, QofQuery *q2, QofQueryOp op)
Definition: qofquery.c:1127
qof_query_add_guid_list_match
void qof_query_add_guid_list_match(QofQuery *q, GSList *param_list, GList *guid_list, QofGuidMatch options, QofQueryOp op)
Definition: qofquery.c:1301
qof_query_invert
QofQuery * qof_query_invert(QofQuery *q)
Definition: qofquery.c:1043
qof_query_clear
void qof_query_clear(QofQuery *query)
Definition: qofquery.c:886
_GUID
Definition: guid.h:53
qofbook.h
Encapsulate all the information about a dataset.
qof_query_last_run
GList * qof_query_last_run(QofQuery *query)
Definition: qofquery.c:877
qof_query_add_guid_match
void qof_query_add_guid_match(QofQuery *q, GSList *param_list, const GUID *guid, QofQueryOp op)
Definition: qofquery.c:1317
QofQueryOp
QofQueryOp
Definition: qofquery.h:88
qof_query_run
GList * qof_query_run(QofQuery *query)
Definition: qofquery.c:757
QofIdTypeConst
const gchar * QofIdTypeConst
Definition: qofid.h:83
_QofQueryPredData
Definition: qofquerycore.h:138
qofchoice.h
Linking one entity to other entities of many possible types.
_QofBook
Definition: qofbook-p.h:48
qof_query_set_max_results
void qof_query_set_max_results(QofQuery *q, gint n)
Definition: qofquery.c:1293
qof_query_add_boolean_match
void qof_query_add_boolean_match(QofQuery *q, GSList *param_list, gboolean value, QofQueryOp op)
Definition: qofquery.c:1360
qof_query_create
QofQuery * qof_query_create(void)
Definition: qofquery.c:900
qof_query_search_for
void qof_query_search_for(QofQuery *query, QofIdTypeConst obj_type)
Definition: qofquery.c:909
qof_query_get_books
GList * qof_query_get_books(QofQuery *q)
Definition: qofquery.c:1352
qof_query_merge_in_place
void qof_query_merge_in_place(QofQuery *q1, QofQuery *q2, QofQueryOp op)
Definition: qofquery.c:1234