GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
qofquery.h
Go to the documentation of this file.
1 /********************************************************************\
2  * qofquery.h -- find objects that match a certain expression. *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation; either version 2 of *
7  * the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License*
15  * along with this program; if not, contact: *
16  * *
17  * Free Software Foundation Voice: +1-617-542-5942 *
18  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19  * Boston, MA 02110-1301, USA [email protected] *
20  * *
21 \********************************************************************/
22 
74 #ifndef QOF_QUERYNEW_H
75 #define QOF_QUERYNEW_H
76 
77 #include "guid.h"
78 #include "qofbook.h"
79 #include "qofquerycore.h"
80 #include "qofchoice.h"
81 
82 #ifdef __cplusplus
83 extern "C"
84 {
85 #endif
86 
87 #define QOF_MOD_QUERY "qof.query"
88 
90 typedef struct _QofQuery QofQuery;
91 
93 typedef enum
94 {
95  QOF_QUERY_AND = 1,
96  QOF_QUERY_OR,
97  QOF_QUERY_NAND,
98  QOF_QUERY_NOR,
99  QOF_QUERY_XOR
100 } QofQueryOp;
101 
103 #define QOF_QUERY_FIRST_TERM QOF_QUERY_AND
104 
106 #define QUERY_DEFAULT_SORT "QofQueryDefaultSort"
107 
109 #define QOF_PARAM_BOOK "book"
110 #define QOF_PARAM_GUID "guid"
111 
113 #define QOF_PARAM_KVP "kvp"
114 #define QOF_PARAM_ACTIVE "active"
115 #define QOF_PARAM_VERSION "version"
116 
117 /* --------------------------------------------------------- */
119 // @{
126 void qof_query_init (void);
127 void qof_query_shutdown (void);
128 // @}
129 
130 /* --------------------------------------------------------- */
132 // @{
133 
134 QofQueryParamList * qof_query_build_param_list (char const *param, ...);
135 
145 QofQuery * qof_query_create (void);
146 QofQuery * qof_query_create_for (QofIdTypeConst obj_type);
147 
149 void qof_query_destroy (QofQuery *q);
150 
154 void qof_query_search_for (QofQuery *query, QofIdTypeConst obj_type);
155 
165 void qof_query_set_book (QofQuery *q, QofBook *book);
166 
167 
192 void qof_query_add_term (QofQuery *query, QofQueryParamList *param_list,
193  QofQueryPredData *pred_data, QofQueryOp op);
194 
197  const GncGUID *guid, QofQueryOp op);
200  GList *guid_list, QofGuidMatch options,
201  QofQueryOp op);
202 
208  QofQueryParamList *param_list,
209  gboolean value,
210  QofQueryOp op);
211 
222 GList * qof_query_run (QofQuery *query);
223 
228 GList * qof_query_last_run (QofQuery *query);
229 
237 GList * qof_query_run_subquery (QofQuery *subquery,
238  const QofQuery* primary_query);
239 
243 void qof_query_clear (QofQuery *query);
244 
251 void qof_query_purge_terms (QofQuery *q, QofQueryParamList *param_list);
252 
258 
262 
264 gboolean qof_query_has_term_type (QofQuery *q, QofQueryParamList *term_param);
265 GSList * qof_query_get_term_type (QofQuery *q, QofQueryParamList *term_param);
266 
269 
282 
302 
307 
329  QofQueryParamList *primary_sort_params,
330  QofQueryParamList *secondary_sort_params,
331  QofQueryParamList *tertiary_sort_params);
332 
333 void qof_query_set_sort_options (QofQuery *q, gint prim_op, gint sec_op,
334  gint tert_op);
335 
347 void qof_query_set_sort_increasing (QofQuery *q, gboolean prim_inc,
348  gboolean sec_inc, gboolean tert_inc);
349 
350 
361 void qof_query_set_max_results (QofQuery *q, int n);
362 
369 gboolean qof_query_equal (const QofQuery *q1, const QofQuery *q2);
370 
377 void qof_query_print (QofQuery *query);
378 
380 /*@ dependent @*/
382 
384 GList * qof_query_get_books (QofQuery *q);
385 
386 // @}
387 /* @} */
388 #ifdef __cplusplus
389 }
390 #endif
391 
392 #endif /* QOF_QUERYNEW_H */
void qof_query_add_term(QofQuery *query, QofQueryParamList *param_list, QofQueryPredData *pred_data, QofQueryOp op)
void qof_query_set_sort_order(QofQuery *q, QofQueryParamList *primary_sort_params, QofQueryParamList *secondary_sort_params, QofQueryParamList *tertiary_sort_params)
void qof_query_purge_terms(QofQuery *q, QofQueryParamList *param_list)
const gchar * QofIdTypeConst
Definition: qofid.h:87
void qof_query_print(QofQuery *query)
globally unique ID User API
QofQuery * qof_query_copy(QofQuery *q)
gboolean qof_query_equal(const QofQuery *q1, const QofQuery *q2)
void qof_query_set_sort_increasing(QofQuery *q, gboolean prim_inc, gboolean sec_inc, gboolean tert_inc)
struct _QofQuery QofQuery
Definition: qofquery.h:90
GSList QofQueryParamList
Definition: qofquerycore.h:152
Definition: guid.h:65
void qof_query_set_max_results(QofQuery *q, int n)
const gchar * QofIdType
Definition: qofid.h:85
int qof_query_num_terms(QofQuery *q)
API for providing core Query data types.
GList * qof_query_run_subquery(QofQuery *subquery, const QofQuery *primary_query)
void qof_query_destroy(QofQuery *q)
QofGuidMatch
Definition: qofquerycore.h:110
void qof_query_init(void)
void qof_query_set_book(QofQuery *q, QofBook *book)
QofQuery * qof_query_merge(QofQuery *q1, QofQuery *q2, QofQueryOp op)
QofQuery * qof_query_invert(QofQuery *q)
void qof_query_clear(QofQuery *query)
gboolean qof_query_has_term_type(QofQuery *q, QofQueryParamList *term_param)
void qof_query_add_guid_match(QofQuery *q, QofQueryParamList *param_list, const GncGUID *guid, QofQueryOp op)
Encapsulate all the information about a dataset.
GList * qof_query_last_run(QofQuery *query)
QofQueryOp
Definition: qofquery.h:93
GList * qof_query_run(QofQuery *query)
QofIdType qof_query_get_search_for(const QofQuery *q)
Linking one entity to other entities of many possible types.
int qof_query_has_terms(QofQuery *q)
void qof_query_add_boolean_match(QofQuery *q, QofQueryParamList *param_list, gboolean value, QofQueryOp op)
QofQuery * qof_query_create(void)
void qof_query_add_guid_list_match(QofQuery *q, QofQueryParamList *param_list, GList *guid_list, QofGuidMatch options, QofQueryOp op)
void qof_query_search_for(QofQuery *query, QofIdTypeConst obj_type)
GList * qof_query_get_books(QofQuery *q)
void qof_query_merge_in_place(QofQuery *q1, QofQuery *q2, QofQueryOp op)