GnuCash 2.4.99
qofquerycore-p.h
00001 /********************************************************************\
00002  * qofquerycore-p.h -- Private 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 
00024 #ifndef QOF_QUERYCOREP_H
00025 #define QOF_QUERYCOREP_H
00026 
00027 #include <sys/types.h>
00028 #include <time.h>
00029 #include <regex.h>
00030 #include <string.h>
00031 
00032 #include "qofquerycore.h"
00033 
00034 /* Initalize the Query Core registry and install the default type handlers */
00035 void qof_query_core_init(void);
00036 void qof_query_core_shutdown (void);
00037 
00038 /*
00039  * An arbitrary Query Predicate.  Given the object and the
00040  * particular parameter get-function (obtained from the registry by
00041  * the Query internals), compare the object's parameter to the
00042  * predicate data.
00043  */
00044 typedef gint (*QofQueryPredicateFunc) (gpointer object,
00045                                        QofParam *getter,
00046                                        QofQueryPredData *pdata);
00047 
00048 /* Lookup functions */
00049 QofQueryPredicateFunc qof_query_core_get_predicate (gchar const *type);
00050 QofCompareFunc qof_query_core_get_compare (gchar const *type);
00051 
00052 /* Compare two predicates */
00053 gboolean qof_query_core_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2);
00054 
00055 /* Predicate Data Structures:
00056  *
00057  * These are defined such that you can cast between these types and
00058  * a QofQueryPredData.
00059  *
00060  * Note that these are provided for READ ONLY PURPOSES.  You should NEVER
00061  * write into these structures, change them, or use them to create a
00062  * Query.
00063  */
00064 
00065 typedef struct
00066 {
00067     QofQueryPredData    pd;
00068     QofStringMatch      options;
00069     gboolean            is_regex;
00070     gchar *             matchstring;
00071     regex_t             compiled;
00072 } query_string_def, *query_string_t;
00073 
00074 typedef struct
00075 {
00076     QofQueryPredData    pd;
00077     QofDateMatch        options;
00078     Timespec    date;
00079 } query_date_def, *query_date_t;
00080 
00081 typedef struct
00082 {
00083     QofQueryPredData    pd;
00084     QofNumericMatch     options;
00085     gnc_numeric         amount;
00086 } query_numeric_def, *query_numeric_t;
00087 
00088 typedef struct
00089 {
00090     QofQueryPredData    pd;
00091     QofGuidMatch        options;
00092     GList *     guids;
00093 } query_guid_def, *query_guid_t;
00094 
00095 typedef struct
00096 {
00097     QofQueryPredData    pd;
00098     gint32      val;
00099 } query_int32_def, *query_int32_t;
00100 
00101 typedef struct
00102 {
00103     QofQueryPredData    pd;
00104     gint64      val;
00105 } query_int64_def, *query_int64_t;
00106 
00107 typedef struct
00108 {
00109     QofQueryPredData    pd;
00110     double      val;
00111 } query_double_def, *query_double_t;
00112 
00113 typedef struct
00114 {
00115     QofQueryPredData    pd;
00116     gboolean    val;
00117 } query_boolean_def, *query_boolean_t;
00118 
00119 typedef struct
00120 {
00121     QofQueryPredData    pd;
00122     QofCharMatch        options;
00123     gchar *     char_list;
00124 } query_char_def, *query_char_t;
00125 
00126 typedef struct
00127 {
00128     QofQueryPredData    pd;
00129     GSList *    path;
00130     KvpValue *  value;
00131 } query_kvp_def, *query_kvp_t;
00132 
00133 typedef struct
00134 {
00135     QofQueryPredData pd;
00136     QofGuidMatch  options;
00137     QofCollection *coll;
00138     GList *guids;
00139 } query_coll_def, *query_coll_t;
00140 
00141 typedef struct
00142 {
00143     QofQueryPredData pd;
00144     QofGuidMatch options;
00145     const GncGUID *guid;
00146     GList * guids;
00147 } query_choice_def, *query_choice_t;
00148 
00149 #endif /* QOF_QUERYCOREP_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines