GnuCash fec5643+
Loading...
Searching...
No Matches
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 gnu@gnu.org *
20 * *
21\********************************************************************/
22
69#ifndef QOF_CLASS_H
70#define QOF_CLASS_H
71
72#include "qofid.h"
73
74#ifdef __cplusplus
75extern "C"
76{
77#endif
78
79#define QOF_MOD_CLASS "qof.class"
80
90#define QOF_TYPE_STRING "string"
91#define QOF_TYPE_NATURAL "natural"
92#define QOF_TYPE_DATE "date"
93#define QOF_TYPE_NUMERIC "numeric"
94#define QOF_TYPE_DEBCRED "debcred"
95#define QOF_TYPE_GUID "guid"
96#define QOF_TYPE_INT32 "gint32"
97#define QOF_TYPE_INT64 "gint64"
98#define QOF_TYPE_DOUBLE "double"
99#define QOF_TYPE_BOOLEAN "boolean"
100#define QOF_TYPE_KVP "kvp"
101#define QOF_TYPE_CHAR "character"
102#define QOF_TYPE_CHOICE "choice" /* was moved from (deleted) qofchoice.h */
105 typedef const char * QofType;
106
107typedef struct _QofParam QofParam;
108
124typedef gpointer (*QofAccessFunc)(gpointer object, /*@ null @*/ const QofParam *param);
125
131typedef void (*QofSetterFunc) (gpointer, /*@ null @*/ gpointer);
132
133/* A callback for how to compare two (same-type) objects based on a
134 * common getter (parameter member), using the provided comparison
135 * options (which are the type-specific options).
136 */
137typedef gint (*QofCompareFunc) (gpointer a, gpointer b,
138 gint compare_options,
139 QofParam *getter);
140
159{
160 const char * param_name;
161 QofType param_type;
162 QofAccessFunc param_getfcn;
163 QofSetterFunc param_setfcn;
164 QofCompareFunc param_compfcn;
165 gpointer param_userdata;
166};
167
169typedef int (*QofSortFunc)(gconstpointer, gconstpointer);
170
185 QofSortFunc default_sort_fcn,
186 const QofParam *params);
187
210gboolean qof_class_is_registered (QofIdTypeConst obj_name);
211
214 const char *param_name);
215
217const QofParam * qof_class_get_parameter (QofIdTypeConst obj_name,
218 const char *parameter);
219
222 const char *parameter);
223
226 const char *parameter);
227
229typedef void (*QofClassForeachCB) (QofIdTypeConst, gpointer);
230
234void qof_class_foreach (QofClassForeachCB, gpointer user_data);
235
237typedef void (*QofParamForeachCB) (QofParam *, gpointer user_data);
238
243 QofParamForeachCB, gpointer user_data);
244
252
253
254#ifdef __cplusplus
255}
256#endif
257
258#endif /* QOF_CLASS_H */
gpointer(* QofAccessFunc)(gpointer object, const QofParam *param)
The QofAccessFunc defines an arbitrary function pointer for access functions.
Definition qofclass.h:124
void qof_class_param_foreach(QofIdTypeConst obj_name, QofParamForeachCB, gpointer user_data)
Call the callback once for each parameter on the indicated object class.
Definition qofclass.cpp:250
GList * qof_class_get_referenceList(QofIdTypeConst type)
List of the parameters that could be references.
Definition qofclass.cpp:334
void qof_class_foreach(QofClassForeachCB, gpointer user_data)
Call the callback once for each object class that is registered with the system.
Definition qofclass.cpp:219
void(* QofSetterFunc)(gpointer, gpointer)
The QofSetterFunc defines an function pointer for parameter setters.
Definition qofclass.h:131
QofType qof_class_get_parameter_type(QofIdTypeConst obj_name, const char *param_name)
Return the core datatype of the specified object's parameter.
Definition qofclass.cpp:188
void qof_class_register(QofIdTypeConst obj_name, QofSortFunc default_sort_fcn, const QofParam *params)
This function registers a new object class with the Qof subsystem.
Definition qofclass.cpp:86
QofSetterFunc qof_class_get_parameter_setter(QofIdTypeConst obj_name, const char *parameter)
Return the object's parameter setter function.
Definition qofclass.cpp:172
void(* QofClassForeachCB)(QofIdTypeConst, gpointer)
Type definition for the class callback function.
Definition qofclass.h:229
QofAccessFunc qof_class_get_parameter_getter(QofIdTypeConst obj_name, const char *parameter)
Return the object's parameter getter function.
Definition qofclass.cpp:156
const QofParam * qof_class_get_parameter(QofIdTypeConst obj_name, const char *parameter)
Return the registered Parameter Definition for the requested parameter.
Definition qofclass.cpp:136
int(* QofSortFunc)(gconstpointer, gconstpointer)
This function is the default sort function for a particular object type.
Definition qofclass.h:169
const char * QofType
Type of Parameters (String, Date, Numeric, GncGUID, etc.)
Definition qofclass.h:105
void(* QofParamForeachCB)(QofParam *, gpointer user_data)
Type definition for the parameter callback function.
Definition qofclass.h:237
gboolean qof_class_is_registered(QofIdTypeConst obj_name)
An example:
Definition qofclass.cpp:125
const gchar * QofIdTypeConst
QofIdTypeConst declaration.
Definition qofid.h:82
QOF entity type identification system.
This structure is for each queryable parameter in an object.
Definition qofclass.h:159