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  * 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   QOF_QUERY_AND=1,
00090   QOF_QUERY_OR,
00091   QOF_QUERY_NAND,
00092   QOF_QUERY_NOR,
00093   QOF_QUERY_XOR
00094 } QofQueryOp;
00095 
00097 #define QOF_QUERY_FIRST_TERM QOF_QUERY_AND
00098 
00100 #define QUERY_DEFAULT_SORT      "QofQueryDefaultSort"
00101 
00103 #define QOF_PARAM_BOOK    "book"
00104 #define QOF_PARAM_GUID    "guid"
00105 
00107 #define QOF_PARAM_KVP     "kvp" 
00108 #define QOF_PARAM_ACTIVE  "active" 
00109 #define QOF_PARAM_VERSION "version" 
00110 
00111 /* --------------------------------------------------------- */
00113 // @{
00120 void qof_query_init (void);
00121 void qof_query_shutdown (void);
00122 // @}
00123 
00124 /* --------------------------------------------------------- */
00126 // @{
00127 
00128 GSList * qof_query_build_param_list (char const *param, ...);
00129 
00139 QofQuery * qof_query_create (void);
00140 QofQuery * qof_query_create_for (QofIdTypeConst obj_type);
00141 
00143 void qof_query_destroy (QofQuery *q);
00144 
00148 void qof_query_search_for (QofQuery *query, QofIdTypeConst obj_type);
00149 
00159 void qof_query_set_book (QofQuery *q, QofBook *book);
00160 
00161 
00186 void qof_query_add_term (QofQuery *query, GSList *param_list,
00187                       QofQueryPredData *pred_data, QofQueryOp op);
00188 
00190 void qof_query_add_guid_match (QofQuery *q, GSList *param_list,
00191                            const GUID *guid, QofQueryOp op);
00193 void qof_query_add_guid_list_match (QofQuery *q, GSList *param_list,
00194                                GList *guid_list, QofGuidMatch options,
00195                                QofQueryOp op);
00196 
00201 void qof_query_add_boolean_match (QofQuery *q, 
00202                                   GSList *param_list, 
00203                                   gboolean value,
00204                                   QofQueryOp op);
00205 
00216 GList * qof_query_run (QofQuery *query);
00217 
00222 GList * qof_query_last_run (QofQuery *query);
00223 
00227 void qof_query_clear (QofQuery *query);
00228 
00235 void qof_query_purge_terms (QofQuery *q, GSList *param_list);
00236 
00241 int qof_query_has_terms (QofQuery *q);
00242 
00245 int qof_query_num_terms (QofQuery *q);
00246 
00248 gboolean qof_query_has_term_type (QofQuery *q, GSList *term_param);
00249 GSList * qof_query_get_term_type (QofQuery *q, GSList *term_param);
00250 
00252 QofQuery * qof_query_copy (QofQuery *q);
00253 
00265 QofQuery * qof_query_invert(QofQuery *q);
00266 
00282 QofQuery * qof_query_merge(QofQuery *q1, QofQuery *q2, QofQueryOp op);
00283 
00287 void qof_query_merge_in_place(QofQuery *q1, QofQuery *q2, QofQueryOp op);
00288 
00309 void qof_query_set_sort_order (QofQuery *q,
00310                            GSList *primary_sort_params,
00311                            GSList *secondary_sort_params,
00312                            GSList *tertiary_sort_params);
00313 
00314 void qof_query_set_sort_options (QofQuery *q, gint prim_op, gint sec_op,
00315                              gint tert_op);
00316 
00328 void qof_query_set_sort_increasing (QofQuery *q, gboolean prim_inc,
00329                                 gboolean sec_inc, gboolean tert_inc);
00330 
00331 
00342 void qof_query_set_max_results (QofQuery *q, int n);
00343 
00350 gboolean qof_query_equal (QofQuery *q1, QofQuery *q2);
00351 
00358 void qof_query_print (QofQuery *query);
00359 
00361 QofIdType qof_query_get_search_for (QofQuery *q);
00362 
00364 GList * qof_query_get_books (QofQuery *q);
00365 
00366 // @}
00367 /* @} */
00368 #endif /* QOF_QUERYNEW_H */

Generated on Fri May 12 17:57:20 2006 for QOF by  doxygen 1.4.4