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  * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       *
00020  * Boston, MA  02111-1307,  USA       gnu@gnu.org                   *
00021  *                                                                  *
00022 \********************************************************************/
00023 
00032 #ifndef QOF_QUERYCORE_H
00033 #define QOF_QUERYCORE_H
00034 
00035 #include <glib.h>
00036 
00037 #include "gnc-numeric.h"
00038 #include "gnc-date.h"
00039 #include "kvp_frame.h"
00040 #include "qofclass.h"
00041 
00047 typedef struct _QofQueryPredData QofQueryPredData;
00048 
00052 typedef enum {
00053   QOF_COMPARE_LT = 1,
00054   QOF_COMPARE_LTE,
00055   QOF_COMPARE_EQUAL,
00056   QOF_COMPARE_GT,
00057   QOF_COMPARE_GTE,
00058   QOF_COMPARE_NEQ
00059 } QofQueryCompare;
00060 
00064 /* Comparisons for QOF_TYPE_STRING */
00065 typedef enum {
00066   QOF_STRING_MATCH_NORMAL = 1,
00067   QOF_STRING_MATCH_CASEINSENSITIVE
00068 } QofStringMatch;
00069 
00077 typedef enum {
00078   QOF_DATE_MATCH_NORMAL = 1,
00079   QOF_DATE_MATCH_DAY
00080 } QofDateMatch;
00081 
00094 typedef enum {
00095   QOF_NUMERIC_MATCH_DEBIT = 1,
00096   QOF_NUMERIC_MATCH_CREDIT,
00097   QOF_NUMERIC_MATCH_ANY
00098 } QofNumericMatch;
00099 
00100 /* Comparisons for QOF_TYPE_GUID */
00101 typedef enum {
00104   QOF_GUID_MATCH_ANY = 1,
00105   QOF_GUID_MATCH_NONE,
00106   QOF_GUID_MATCH_NULL,
00109   QOF_GUID_MATCH_ALL,
00112   QOF_GUID_MATCH_LIST_ANY,
00113 } QofGuidMatch;
00114 
00123 typedef enum {
00124   QOF_CHAR_MATCH_ANY = 1,
00125   QOF_CHAR_MATCH_NONE
00126 } QofCharMatch;
00127 
00133 struct _QofQueryPredData {
00134   QofType               type_name;  /* QOF_TYPE_* */
00135   QofQueryCompare       how;
00136 };
00137 
00138 
00141 QofQueryPredData *qof_query_string_predicate (QofQueryCompare how, 
00142                                               const char *str,
00143                                               QofStringMatch options,
00144                                               gboolean is_regex);
00145 
00146 QofQueryPredData *qof_query_date_predicate (QofQueryCompare how,
00147                                             QofDateMatch options, 
00148                                             Timespec date);
00149 
00150 QofQueryPredData *qof_query_numeric_predicate (QofQueryCompare how,
00151                                                QofNumericMatch options,
00152                                                gnc_numeric value);
00153 
00154 QofQueryPredData *qof_query_guid_predicate (QofGuidMatch options, GList *guids);
00155 QofQueryPredData *qof_query_int32_predicate (QofQueryCompare how, gint32 val);
00156 QofQueryPredData *qof_query_int64_predicate (QofQueryCompare how, gint64 val);
00157 QofQueryPredData *qof_query_double_predicate (QofQueryCompare how, double val);
00158 QofQueryPredData *qof_query_boolean_predicate (QofQueryCompare how, gboolean val);
00159 QofQueryPredData *qof_query_char_predicate (QofCharMatch options,
00160                                             const char *chars);
00161 QofQueryPredData *qof_query_collect_predicate (QofGuidMatch options, 
00162                                             QofCollection *coll);
00163 QofQueryPredData *qof_query_choice_predicate  (QofGuidMatch options, GList *guids);
00164 
00169 QofQueryPredData *qof_query_kvp_predicate (QofQueryCompare how,
00170                                            GSList *path, 
00171                                            const KvpValue *value);
00172 
00175 QofQueryPredData *qof_query_kvp_predicate_path (QofQueryCompare how,
00176                                                 const char *path, 
00177                                                 const KvpValue *value);
00178 
00180 QofQueryPredData *qof_query_core_predicate_copy (QofQueryPredData *pdata);
00181 
00183 void qof_query_core_predicate_free (QofQueryPredData *pdata);
00184 
00186 gboolean qof_query_date_predicate_get_date (QofQueryPredData *pd, Timespec *date);
00190 char * qof_query_core_to_string (QofType, gpointer object, QofParam *getter);
00191 
00192 #endif /* QOF_QUERYCORE_H */
00193 /* @} */
00194 /* @} */

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