00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00082 #ifndef QOF_QUERYNEW_H
00083 #define QOF_QUERYNEW_H
00084
00085 #include "guid.h"
00086 #include "qofbook.h"
00087 #include "qofquerycore.h"
00088 #include "qofchoice.h"
00089
00090 #define QOF_MOD_QUERY "qof-query"
00091
00093 typedef struct _QofQuery QofQuery;
00094
00096 typedef enum {
00097 QOF_QUERY_AND=1,
00098 QOF_QUERY_OR,
00099 QOF_QUERY_NAND,
00100 QOF_QUERY_NOR,
00101 QOF_QUERY_XOR
00102 } QofQueryOp;
00103
00105 #define QOF_QUERY_FIRST_TERM QOF_QUERY_AND
00106
00108 #define QUERY_DEFAULT_SORT "QofQueryDefaultSort"
00109
00111 #define QOF_PARAM_BOOK "book"
00112 #define QOF_PARAM_GUID "guid"
00113
00115 #define QOF_PARAM_KVP "kvp"
00116 #define QOF_PARAM_ACTIVE "active"
00117 #define QOF_PARAM_VERSION "version"
00118
00119
00121
00128 void qof_query_init (void);
00129 void qof_query_shutdown (void);
00130
00131
00132
00134
00135
00136 GSList * qof_query_build_param_list (char const *param, ...);
00137
00147 QofQuery * qof_query_create (void);
00148 QofQuery * qof_query_create_for (QofIdTypeConst obj_type);
00149
00151 void qof_query_destroy (QofQuery *q);
00152
00156 void qof_query_search_for (QofQuery *query, QofIdTypeConst obj_type);
00157
00167 void qof_query_set_book (QofQuery *q, QofBook *book);
00168
00169
00194 void qof_query_add_term (QofQuery *query, GSList *param_list,
00195 QofQueryPredData *pred_data, QofQueryOp op);
00196
00198 void qof_query_add_guid_match (QofQuery *q, GSList *param_list,
00199 const GUID *guid, QofQueryOp op);
00201 void qof_query_add_guid_list_match (QofQuery *q, GSList *param_list,
00202 GList *guid_list, QofGuidMatch options,
00203 QofQueryOp op);
00204
00209 void qof_query_add_boolean_match (QofQuery *q,
00210 GSList *param_list,
00211 gboolean value,
00212 QofQueryOp op);
00213
00224 GList * qof_query_run (QofQuery *query);
00225
00230 GList * qof_query_last_run (QofQuery *query);
00231
00235 void qof_query_clear (QofQuery *query);
00236
00243 void qof_query_purge_terms (QofQuery *q, GSList *param_list);
00244
00249 int qof_query_has_terms (QofQuery *q);
00250
00253 int qof_query_num_terms (QofQuery *q);
00254
00256 gboolean qof_query_has_term_type (QofQuery *q, GSList *term_param);
00257 GSList * qof_query_get_term_type (QofQuery *q, GSList *term_param);
00258
00260 QofQuery * qof_query_copy (QofQuery *q);
00261
00273 QofQuery * qof_query_invert(QofQuery *q);
00274
00290 QofQuery * qof_query_merge(QofQuery *q1, QofQuery *q2, QofQueryOp op);
00291
00295 void qof_query_merge_in_place(QofQuery *q1, QofQuery *q2, QofQueryOp op);
00296
00317 void qof_query_set_sort_order (QofQuery *q,
00318 GSList *primary_sort_params,
00319 GSList *secondary_sort_params,
00320 GSList *tertiary_sort_params);
00321
00322 void qof_query_set_sort_options (QofQuery *q, gint prim_op, gint sec_op,
00323 gint tert_op);
00324
00336 void qof_query_set_sort_increasing (QofQuery *q, gboolean prim_inc,
00337 gboolean sec_inc, gboolean tert_inc);
00338
00339
00350 void qof_query_set_max_results (QofQuery *q, int n);
00351
00358 gboolean qof_query_equal (QofQuery *q1, QofQuery *q2);
00359
00363 void qof_query_print (QofQuery *query);
00364
00366 QofIdType qof_query_get_search_for (QofQuery *q);
00367
00369 GList * qof_query_get_books (QofQuery *q);
00370
00371
00372
00373 #endif