qofquery.h

Go to the documentation of this file.
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  * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       *
00019  * Boston, MA  02111-1307,  USA       gnu@gnu.org                   *
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 /* QOF_QUERYNEW_H */

Generated on Fri Oct 21 15:49:55 2005 for QOF by  doxygen 1.4.5