00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00074 #ifndef QOF_QUERYNEW_H
00075 #define QOF_QUERYNEW_H
00076
00077 #include "guid.h"
00078 #include "qofbook.h"
00079 #include "qofquerycore.h"
00080 #include "qofchoice.h"
00081
00082 #define QOF_MOD_QUERY "qof-query"
00083
00085 typedef struct _QofQuery QofQuery;
00086
00088 typedef enum
00089 {
00090 QOF_QUERY_AND = 1,
00091 QOF_QUERY_OR,
00092 QOF_QUERY_NAND,
00093 QOF_QUERY_NOR,
00094 QOF_QUERY_XOR
00095 } QofQueryOp;
00096
00098 #define QOF_QUERY_FIRST_TERM QOF_QUERY_AND
00099
00101 #define QUERY_DEFAULT_SORT "QofQueryDefaultSort"
00102
00104 #define QOF_PARAM_BOOK "book"
00105 #define QOF_PARAM_GUID "guid"
00106
00108 #define QOF_PARAM_KVP "kvp"
00109 #define QOF_PARAM_ACTIVE "active"
00110 #define QOF_PARAM_VERSION "version"
00111
00121 void qof_query_init (void);
00122 void qof_query_shutdown (void);
00129 GSList *qof_query_build_param_list (gchar const *param, ...);
00130
00140 QofQuery *qof_query_create (void);
00141
00143 QofQuery *qof_query_create_for (QofIdTypeConst obj_type);
00144
00146 void qof_query_destroy (QofQuery * q);
00147
00151 void
00152 qof_query_search_for (QofQuery * query, QofIdTypeConst obj_type);
00153
00163 void qof_query_set_book (QofQuery * q, QofBook * book);
00164
00191 void qof_query_add_term (QofQuery * query, GSList * param_list,
00192 QofQueryPredData * pred_data, QofQueryOp op);
00193
00195 void qof_query_add_guid_match (QofQuery * q, GSList * param_list,
00196 const GUID * guid, QofQueryOp op);
00198 void qof_query_add_guid_list_match (QofQuery * q, GSList * param_list,
00199 GList * guid_list, QofGuidMatch options,
00200 QofQueryOp op);
00201
00206 void qof_query_add_boolean_match (QofQuery * q,
00207 GSList * param_list,
00208 gboolean value, QofQueryOp op);
00209
00220 GList *
00221 qof_query_run (QofQuery * query);
00222
00227 GList *
00228 qof_query_last_run (QofQuery * query);
00229
00233 void qof_query_clear (QofQuery * query);
00234
00240 void qof_query_purge_terms (QofQuery * q, GSList * param_list);
00241
00246 gint qof_query_has_terms (QofQuery * q);
00247
00250 gint qof_query_num_terms (QofQuery * q);
00251
00253 gboolean
00254 qof_query_has_term_type (QofQuery * q, GSList * term_param);
00255 GSList *
00256 qof_query_get_term_type (QofQuery * q, GSList * term_param);
00257
00259 QofQuery *qof_query_copy (QofQuery * q);
00260
00272 QofQuery *
00273 qof_query_invert (QofQuery * q);
00274
00290 QofQuery *
00291 qof_query_merge (QofQuery * q1, QofQuery * q2, QofQueryOp op);
00292
00296 void
00297 qof_query_merge_in_place (QofQuery * q1, QofQuery * q2, QofQueryOp op);
00298
00319 void qof_query_set_sort_order (QofQuery * q,
00320 GSList * primary_sort_params,
00321 GSList * secondary_sort_params,
00322 GSList * tertiary_sort_params);
00323
00324 void qof_query_set_sort_options (QofQuery * q, gint prim_op, gint sec_op,
00325 gint tert_op);
00326
00338 void
00339 qof_query_set_sort_increasing (QofQuery * q, gboolean prim_inc,
00340 gboolean sec_inc, gboolean tert_inc);
00341
00352 void qof_query_set_max_results (QofQuery * q, gint n);
00353
00360 gboolean qof_query_equal (QofQuery * q1, QofQuery * q2);
00361
00363 QofIdType qof_query_get_search_for (QofQuery * q);
00364
00366 GList *qof_query_get_books (QofQuery * q);
00367
00370 #endif