GnuCash 2.4.99
qofquerycore.h
Go to the documentation of this file.
00001 /********************************************************************\
00002  * qofquerycore.h -- API for providing core Query data types        *
00003  * Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU>                *
00004  *                                                                  *
00005  * This program is free software; you can redistribute it and/or    *
00006  * modify it under the terms of the GNU General Public License as   *
00007  * published by the Free Software Foundation; either version 2 of   *
00008  * the License, or (at your option) any later version.              *
00009  *                                                                  *
00010  * This program is distributed in the hope that it will be useful,  *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00013  * GNU General Public License for more details.                     *
00014  *                                                                  *
00015  * You should have received a copy of the GNU General Public License*
00016  * along with this program; if not, contact:                        *
00017  *                                                                  *
00018  * Free Software Foundation           Voice:  +1-617-542-5942       *
00019  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
00020  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
00021  *                                                                  *
00022 \********************************************************************/
00023 
00032 #ifndef QOF_QUERYCORE_H
00033 #define QOF_QUERYCORE_H
00034 
00035 #include "gnc-numeric.h"
00036 #include "gnc-date.h"
00037 #include "kvp_frame.h"
00038 #include "qofclass.h"
00039 
00045 typedef struct _QofQueryPredData QofQueryPredData;
00046 
00050 typedef enum
00051 {
00052     QOF_COMPARE_LT = 1,
00053     QOF_COMPARE_LTE,
00054     QOF_COMPARE_EQUAL,
00055     QOF_COMPARE_GT,
00056     QOF_COMPARE_GTE,
00057     QOF_COMPARE_NEQ
00058 } QofQueryCompare;
00059 
00063 /* Comparisons for QOF_TYPE_STRING */
00064 typedef enum
00065 {
00066     QOF_STRING_MATCH_NORMAL = 1,
00067     QOF_STRING_MATCH_CASEINSENSITIVE
00068 } QofStringMatch;
00069 
00077 typedef enum
00078 {
00079     QOF_DATE_MATCH_NORMAL = 1,
00080     QOF_DATE_MATCH_DAY
00081 } QofDateMatch;
00082 
00095 typedef enum
00096 {
00097     QOF_NUMERIC_MATCH_DEBIT = 1,
00098     QOF_NUMERIC_MATCH_CREDIT,
00099     QOF_NUMERIC_MATCH_ANY
00100 } QofNumericMatch;
00101 
00102 /* Comparisons for QOF_TYPE_GUID */
00103 typedef enum
00104 {
00107     QOF_GUID_MATCH_ANY = 1,
00108     QOF_GUID_MATCH_NONE,
00109     QOF_GUID_MATCH_NULL,
00112     QOF_GUID_MATCH_ALL,
00115     QOF_GUID_MATCH_LIST_ANY,
00116 } QofGuidMatch;
00117 
00126 typedef enum
00127 {
00128     QOF_CHAR_MATCH_ANY = 1,
00129     QOF_CHAR_MATCH_NONE
00130 } QofCharMatch;
00131 
00137 struct _QofQueryPredData
00138 {
00139     QofType               type_name;  /* QOF_TYPE_* */
00140     QofQueryCompare       how;
00141 };
00142 
00145 typedef GSList QofQueryParamList;
00146 
00149 QofQueryPredData *qof_query_string_predicate (QofQueryCompare how,
00150         const gchar *str,
00151         QofStringMatch options,
00152         gboolean is_regex);
00153 
00154 QofQueryPredData *qof_query_date_predicate (QofQueryCompare how,
00155         QofDateMatch options,
00156         Timespec date);
00157 
00158 QofQueryPredData *qof_query_numeric_predicate (QofQueryCompare how,
00159         QofNumericMatch options,
00160         gnc_numeric value);
00161 
00162 QofQueryPredData *qof_query_guid_predicate (QofGuidMatch options, GList *guids);
00163 QofQueryPredData *qof_query_int32_predicate (QofQueryCompare how, gint32 val);
00164 QofQueryPredData *qof_query_int64_predicate (QofQueryCompare how, gint64 val);
00165 QofQueryPredData *qof_query_double_predicate (QofQueryCompare how, double val);
00166 QofQueryPredData *qof_query_boolean_predicate (QofQueryCompare how, gboolean val);
00167 QofQueryPredData *qof_query_char_predicate (QofCharMatch options,
00168         const gchar *chars);
00169 QofQueryPredData *qof_query_collect_predicate (QofGuidMatch options,
00170         QofCollection *coll);
00171 QofQueryPredData *qof_query_choice_predicate  (QofGuidMatch options, GList *guids);
00172 
00177 QofQueryPredData *qof_query_kvp_predicate (QofQueryCompare how,
00178         QofQueryParamList *path,
00179         const KvpValue *value);
00180 
00183 QofQueryPredData *qof_query_kvp_predicate_path (QofQueryCompare how,
00184         const gchar *path,
00185         const KvpValue *value);
00186 
00188 QofQueryPredData *qof_query_core_predicate_copy (const QofQueryPredData *pdata);
00189 
00191 void qof_query_core_predicate_free (QofQueryPredData *pdata);
00192 
00194 gboolean qof_query_date_predicate_get_date (const QofQueryPredData *pd, Timespec *date);
00198 char * qof_query_core_to_string (QofType, gpointer object, QofParam *getter);
00199 
00204 int qof_string_number_compare_func (gpointer a, gpointer b, gint options,
00205                                     QofParam *this_param);
00206 
00207 
00208 #endif /* QOF_QUERYCORE_H */
00209 /* @} */
00210 /* @} */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines