QOF  0.8.7
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 
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 
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 
260 
272 QofQuery *
274 
290 QofQuery *
292 
296 void
298 
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 
364 
366 GList *qof_query_get_books (QofQuery * q);
367 
370 #endif /* QOF_QUERYNEW_H */
gint qof_query_num_terms(QofQuery *q)
Definition: qofquery.c:941
QofIdType qof_query_get_search_for(QofQuery *q)
Definition: qofquery.c:1400
gboolean qof_query_has_term_type(QofQuery *q, GSList *term_param)
Definition: qofquery.c:953
const gchar * QofIdType
Definition: qofid.h:81
gboolean qof_query_equal(QofQuery *q1, QofQuery *q2)
Definition: qofquery.c:1512
globally unique ID User API
QofQuery * qof_query_copy(QofQuery *q)
Definition: qofquery.c:1009
void qof_query_set_sort_increasing(QofQuery *q, gboolean prim_inc, gboolean sec_inc, gboolean tert_inc)
Definition: qofquery.c:1282
void qof_query_purge_terms(QofQuery *q, GSList *param_list)
Definition: qofquery.c:717
struct _QofQuery QofQuery
Definition: qofquery.h:85
QofQuery * qof_query_create_for(QofIdTypeConst obj_type)
Definition: qofquery.c:922
API for providing core Query data types.
void qof_query_destroy(QofQuery *q)
Definition: qofquery.c:998
QofGuidMatch
Definition: qofquerycore.h:104
void qof_query_init(void)
Definition: qofquery.c:1375
void qof_query_add_term(QofQuery *query, GSList *param_list, QofQueryPredData *pred_data, QofQueryOp op)
Definition: qofquery.c:691
void qof_query_set_book(QofQuery *q, QofBook *book)
Definition: qofquery.c:1335
void qof_query_set_sort_order(QofQuery *q, GSList *primary_sort_params, GSList *secondary_sort_params, GSList *tertiary_sort_params)
Definition: qofquery.c:1247
gint qof_query_has_terms(QofQuery *q)
Definition: qofquery.c:933
QofQuery * qof_query_merge(QofQuery *q1, QofQuery *q2, QofQueryOp op)
Definition: qofquery.c:1127
void qof_query_add_guid_list_match(QofQuery *q, GSList *param_list, GList *guid_list, QofGuidMatch options, QofQueryOp op)
Definition: qofquery.c:1301
QofQuery * qof_query_invert(QofQuery *q)
Definition: qofquery.c:1043
void qof_query_clear(QofQuery *query)
Definition: qofquery.c:886
Definition: guid.h:53
Encapsulate all the information about a dataset.
GList * qof_query_last_run(QofQuery *query)
Definition: qofquery.c:877
void qof_query_add_guid_match(QofQuery *q, GSList *param_list, const GUID *guid, QofQueryOp op)
Definition: qofquery.c:1317
QofQueryOp
Definition: qofquery.h:88
GList * qof_query_run(QofQuery *query)
Definition: qofquery.c:757
const gchar * QofIdTypeConst
Definition: qofid.h:83
Linking one entity to other entities of many possible types.
void qof_query_set_max_results(QofQuery *q, gint n)
Definition: qofquery.c:1293
void qof_query_add_boolean_match(QofQuery *q, GSList *param_list, gboolean value, QofQueryOp op)
Definition: qofquery.c:1360
QofQuery * qof_query_create(void)
Definition: qofquery.c:900
void qof_query_search_for(QofQuery *query, QofIdTypeConst obj_type)
Definition: qofquery.c:909
GList * qof_query_get_books(QofQuery *q)
Definition: qofquery.c:1352
void qof_query_merge_in_place(QofQuery *q1, QofQuery *q2, QofQueryOp op)
Definition: qofquery.c:1234