GnuCash c935c2f+
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_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_CHOICE "choice" /* was moved from (deleted) qofchoice.h */
104 typedef const char * QofType;
105
106typedef struct _QofParam QofParam;
107
123typedef gpointer (*QofAccessFunc)(gpointer object, /*@ null @*/ const QofParam *param);
124
130typedef void (*QofSetterFunc) (gpointer, /*@ null @*/ gpointer);
131
132/* A callback for how to compare two (same-type) objects based on a
133 * common getter (parameter member), using the provided comparison
134 * options (which are the type-specific options).
135 */
136typedef gint (*QofCompareFunc) (gpointer a, gpointer b,
137 gint compare_options,
138 QofParam *getter);
139
158{
159 const char * param_name;
160 QofType param_type;
161 QofAccessFunc param_getfcn;
162 QofSetterFunc param_setfcn;
163 QofCompareFunc param_compfcn;
164 gpointer param_userdata;
165};
166
168typedef int (*QofSortFunc)(gconstpointer, gconstpointer);
169
184 QofSortFunc default_sort_fcn,
185 const QofParam *params);
186
209gboolean qof_class_is_registered (QofIdTypeConst obj_name);
210
213 const char *param_name);
214
216const QofParam * qof_class_get_parameter (QofIdTypeConst obj_name,
217 const char *parameter);
218
221 const char *parameter);
222
225 const char *parameter);
226
228typedef void (*QofClassForeachCB) (QofIdTypeConst, gpointer);
229
233void qof_class_foreach (QofClassForeachCB, gpointer user_data);
234
236typedef void (*QofParamForeachCB) (QofParam *, gpointer user_data);
237
242 QofParamForeachCB, gpointer user_data);
243
251
252
253#ifdef __cplusplus
254}
255#endif
256
257#endif /* QOF_CLASS_H */
gpointer(* QofAccessFunc)(gpointer object, const QofParam *param)
The QofAccessFunc defines an arbitrary function pointer for access functions.
Definition qofclass.h:123
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:130
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:228
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:168
const char * QofType
Type of Parameters (String, Date, Numeric, GncGUID, etc.)
Definition qofclass.h:104
void(* QofParamForeachCB)(QofParam *, gpointer user_data)
Type definition for the parameter callback function.
Definition qofclass.h:236
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:158