QOF 0.8.2
|
00001 /********************************************************************\ 00002 * qofquery.h -- find objects that match a certain expression. * 00003 * * 00004 * This program is free software; you can redistribute it and/or * 00005 * modify it under the terms of the GNU General Public License as * 00006 * published by the Free Software Foundation; either version 2 of * 00007 * the License, or (at your option) any later version. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU General Public License* 00015 * along with this program; if not, contact: * 00016 * * 00017 * Free Software Foundation Voice: +1-617-542-5942 * 00018 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 00019 * Boston, MA 02110-1301, USA gnu@gnu.org * 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 /* QOF_QUERYNEW_H */