00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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
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;
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
00193
00194