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   QOF_COMPARE_LT = 1,
00052   QOF_COMPARE_LTE,
00053   QOF_COMPARE_EQUAL,
00054   QOF_COMPARE_GT,
00055   QOF_COMPARE_GTE,
00056   QOF_COMPARE_NEQ
00057 } QofQueryCompare;
00058 
00062 /* Comparisons for QOF_TYPE_STRING */
00063 typedef enum {
00064   QOF_STRING_MATCH_NORMAL = 1,
00065   QOF_STRING_MATCH_CASEINSENSITIVE
00066 } QofStringMatch;
00067 
00075 typedef enum {
00076   QOF_DATE_MATCH_NORMAL = 1,
00077   QOF_DATE_MATCH_DAY
00078 } QofDateMatch;
00079 
00092 typedef enum {
00093   QOF_NUMERIC_MATCH_DEBIT = 1,
00094   QOF_NUMERIC_MATCH_CREDIT,
00095   QOF_NUMERIC_MATCH_ANY
00096 } QofNumericMatch;
00097 
00098 /* Comparisons for QOF_TYPE_GUID */
00099 typedef enum {
00102   QOF_GUID_MATCH_ANY = 1,
00103   QOF_GUID_MATCH_NONE,
00104   QOF_GUID_MATCH_NULL,
00107   QOF_GUID_MATCH_ALL,
00110   QOF_GUID_MATCH_LIST_ANY,
00111 } QofGuidMatch;
00112 
00121 typedef enum {
00122   QOF_CHAR_MATCH_ANY = 1,
00123   QOF_CHAR_MATCH_NONE
00124 } QofCharMatch;
00125 
00131 struct _QofQueryPredData {
00132   QofType               type_name;  /* QOF_TYPE_* */
00133   QofQueryCompare       how;
00134 };
00135 
00136 
00139 QofQueryPredData *qof_query_string_predicate (QofQueryCompare how,
00140                                               const gchar *str,
00141                                               QofStringMatch options,
00142                                               gboolean is_regex);
00143 
00144 QofQueryPredData *qof_query_date_predicate (QofQueryCompare how,
00145                                             QofDateMatch options,
00146                                             Timespec date);
00147 
00148 QofQueryPredData *qof_query_numeric_predicate (QofQueryCompare how,
00149                                                QofNumericMatch options,
00150                                                gnc_numeric value);
00151 
00152 QofQueryPredData *qof_query_guid_predicate (QofGuidMatch options, GList *guids);
00153 QofQueryPredData *qof_query_int32_predicate (QofQueryCompare how, gint32 val);
00154 QofQueryPredData *qof_query_int64_predicate (QofQueryCompare how, gint64 val);
00155 QofQueryPredData *qof_query_double_predicate (QofQueryCompare how, double val);
00156 QofQueryPredData *qof_query_boolean_predicate (QofQueryCompare how, gboolean val);
00157 QofQueryPredData *qof_query_char_predicate (QofCharMatch options,
00158                                             const gchar *chars);
00159 QofQueryPredData *qof_query_collect_predicate (QofGuidMatch options,
00160                                             QofCollection *coll);
00161 QofQueryPredData *qof_query_choice_predicate  (QofGuidMatch options, GList *guids);
00162 
00167 QofQueryPredData *qof_query_kvp_predicate (QofQueryCompare how,
00168                                            GSList *path,
00169                                            const KvpValue *value);
00170 
00173 QofQueryPredData *qof_query_kvp_predicate_path (QofQueryCompare how,
00174                                                 const gchar *path,
00175                                                 const KvpValue *value);
00176 
00178 QofQueryPredData *qof_query_core_predicate_copy (QofQueryPredData *pdata);
00179 
00181 void qof_query_core_predicate_free (QofQueryPredData *pdata);
00182 
00184 gboolean qof_query_date_predicate_get_date (QofQueryPredData *pd, Timespec *date);
00188 char * qof_query_core_to_string (QofType, gpointer object, QofParam *getter);
00189 
00190 #endif /* QOF_QUERYCORE_H */
00191 /* @} */
00192 /* @} */

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