GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
qofclass.h
Go to the documentation of this file.
1 /********************************************************************\
2  * qofclass.h -- API for registering parameters on objects *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation; either version 2 of *
7  * the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License*
15  * along with this program; if not, contact: *
16  * *
17  * Free Software Foundation Voice: +1-617-542-5942 *
18  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19  * Boston, MA 02110-1301, USA [email protected] *
20  * *
21 \********************************************************************/
22 
69 #ifndef QOF_CLASS_H
70 #define QOF_CLASS_H
71 
72 #include "qofid.h"
73 
74 #ifdef __cplusplus
75 extern "C"
76 {
77 #endif
78 
79 #define QOF_MOD_CLASS "qof.class"
80 
90 #define QOF_TYPE_STRING "string"
91 #define QOF_TYPE_DATE "date"
92 #define QOF_TYPE_NUMERIC "numeric"
93 #define QOF_TYPE_DEBCRED "debcred"
94 #define QOF_TYPE_GUID "guid"
95 #define QOF_TYPE_INT32 "gint32"
96 #define QOF_TYPE_INT64 "gint64"
97 #define QOF_TYPE_DOUBLE "double"
98 #define QOF_TYPE_BOOLEAN "boolean"
99 #define QOF_TYPE_KVP "kvp"
100 #define QOF_TYPE_CHAR "character"
101 #define QOF_TYPE_COLLECT "collection"
131  typedef const char * QofType;
132 
133 typedef struct _QofParam QofParam;
134 
150 typedef gpointer (*QofAccessFunc)(gpointer object, /*@ null @*/ const QofParam *param);
151 
157 typedef void (*QofSetterFunc) (gpointer, /*@ null @*/ gpointer);
159 /* A callback for how to compare two (same-type) objects based on a
160  * common getter (parameter member), using the provided comparison
161  * options (which are the type-specific options).
162  */
163 typedef gint (*QofCompareFunc) (gpointer a, gpointer b,
164  gint compare_options,
165  QofParam *getter);
166 
184 struct _QofParam
185 {
186  const char * param_name;
187  QofType param_type;
188  QofAccessFunc param_getfcn;
189  QofSetterFunc param_setfcn;
190  QofCompareFunc param_compfcn;
191  gpointer param_userdata;
192 };
193 
195 typedef int (*QofSortFunc)(gconstpointer, gconstpointer);
196 
210 void qof_class_register (QofIdTypeConst obj_name,
211  QofSortFunc default_sort_fcn,
212  const QofParam *params);
213 
236 gboolean qof_class_is_registered (QofIdTypeConst obj_name);
237 
240  const char *param_name);
241 
244  const char *parameter);
245 
248  const char *parameter);
249 
252  const char *parameter);
253 
255 typedef void (*QofClassForeachCB) (QofIdTypeConst, gpointer);
256 
260 void qof_class_foreach (QofClassForeachCB, gpointer user_data);
261 
263 typedef void (*QofParamForeachCB) (QofParam *, gpointer user_data);
264 
268 void qof_class_param_foreach (QofIdTypeConst obj_name,
269  QofParamForeachCB, gpointer user_data);
270 
277 GList* qof_class_get_referenceList(QofIdTypeConst type);
278 
279 
280 #ifdef __cplusplus
281 }
282 #endif
283 
284 #endif /* QOF_CLASS_H */
285 
void(* QofClassForeachCB)(QofIdTypeConst, gpointer)
Definition: qofclass.h:282
gboolean qof_class_is_registered(QofIdTypeConst obj_name)
void(* QofParamForeachCB)(QofParam *, gpointer user_data)
Definition: qofclass.h:290
void qof_class_param_foreach(QofIdTypeConst obj_name, QofParamForeachCB, gpointer user_data)
const char * QofType
Definition: qofclass.h:158
const gchar * QofIdTypeConst
Definition: qofid.h:87
void qof_class_register(QofIdTypeConst obj_name, QofSortFunc default_sort_fcn, const QofParam *params)
gpointer(* QofAccessFunc)(gpointer object, const QofParam *param)
Definition: qofclass.h:177
QOF entity type identification system.
QofAccessFunc qof_class_get_parameter_getter(QofIdTypeConst obj_name, const char *parameter)
const QofParam * qof_class_get_parameter(QofIdTypeConst obj_name, const char *parameter)
void qof_class_foreach(QofClassForeachCB, gpointer user_data)
int(* QofSortFunc)(gconstpointer, gconstpointer)
Definition: qofclass.h:222
GList * qof_class_get_referenceList(QofIdTypeConst type)
List of the parameters that could be references.
void(* QofSetterFunc)(gpointer, gpointer)
Definition: qofclass.h:184
QofSetterFunc qof_class_get_parameter_setter(QofIdTypeConst obj_name, const char *parameter)
QofType qof_class_get_parameter_type(QofIdTypeConst obj_name, const char *param_name)