QOF: qofobject.h Source File

QOF 0.7.5

qofobject.h
Go to the documentation of this file.
1 /********************************************************************\
2 * qofobject.h -- the Core Object Description Interface *
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 \********************************************************************/
46 #ifndef QOF_OBJECT_H_
47 #define QOF_OBJECT_H_
48
49 #include "qofbook.h"
50 #include "qofid.h"
51 #include "qofchoice.h"
52
57 #define QOF_OBJECT_VERSION 3
58
59 #define QOF_MOD_OBJECT "qof-object"
60
61 typedef struct _QofObject QofObject;
62 typedef void (*QofForeachCB) (gpointer obj, gpointer user_data);
63 typedef void (*QofForeachTypeCB) (QofObject * type, gpointer user_data);
64 typedef void (*QofForeachBackendTypeCB) (QofIdTypeConst type,
65 gpointer backend_data,
66 gpointer user_data);
67
70 struct _QofObject
71 {
72 gint interface_version; /* of this object interface */
73 QofIdType e_type; /* the Object's QOF_ID */
74 const gchar *type_label; /* "Printable" type-label string */
75
80 gpointer (*create) (QofBook *);
81
85 void (*book_begin) (QofBook *);
86
90 void (*book_end) (QofBook *);
91
93 gboolean (*is_dirty) (QofCollection *);
94
96 void (*mark_clean) (QofCollection *);
97
105 void (*foreach) (QofCollection *, QofEntityForeachCB, gpointer);
106
109 const gchar *(*printable) (gpointer instance);
110
119 gint (*version_cmp) (gpointer instance_left, gpointer instance_right);
120 };
121
122 /* -------------------------------------------------------------- */
123
126 void qof_object_initialize (void);
127 void qof_object_shutdown (void);
131 gboolean qof_object_register (const QofObject * object);
132
134 const QofObject *qof_object_lookup (QofIdTypeConst type_name);
135
140 gpointer qof_object_new_instance (QofIdTypeConst type_name, QofBook * book);
141
145 const gchar *qof_object_get_type_label (QofIdTypeConst type_name);
146
148 const gchar *qof_object_printable (QofIdTypeConst type_name,
149 gpointer instance);
150
154 void qof_object_foreach_type (QofForeachTypeCB cb, gpointer user_data);
155
161 void qof_object_foreach (QofIdTypeConst type_name, QofBook * book,
162 QofEntityForeachCB cb, gpointer user_data);
163
165 gboolean qof_object_register_backend (QofIdTypeConst type_name,
166 const gchar * backend_name,
167 gpointer be_data);
168
169 gpointer qof_object_lookup_backend (QofIdTypeConst type_name,
170 const gchar * backend_name);
171
172 void qof_object_foreach_backend (const char *backend_name,
173 QofForeachBackendTypeCB cb,
174 gpointer user_data);
177 #endif /* QOF_OBJECT_H_ */
qof_object_new_instance
gpointer qof_object_new_instance(QofIdTypeConst type_name, QofBook *book)
Definition: qofobject.c:42
QofIdType
const gchar * QofIdType
Definition: qofid.h:81
qof_object_foreach
void qof_object_foreach(QofIdTypeConst type_name, QofBook *book, QofEntityForeachCB cb, gpointer user_data)
Definition: qofobject.c:174
qof_object_lookup
const QofObject * qof_object_lookup(QofIdTypeConst type_name)
Definition: qofobject.c:305
QofEntityForeachCB
void(* QofEntityForeachCB)(QofEntity *, gpointer user_data)
Definition: qofid.h:187
_QofObject::create
gpointer(* create)(QofBook *)
Definition: qofobject.h:80
_QofObject::book_end
void(* book_end)(QofBook *)
Definition: qofobject.h:90
qofid.h
QOF entity type identification system.
qof_object_get_type_label
const gchar * qof_object_get_type_label(QofIdTypeConst type_name)
Definition: qofobject.c:223
QofCollection
struct QofCollection_s QofCollection
Definition: qofid.h:138
_QofObject::book_begin
void(* book_begin)(QofBook *)
Definition: qofobject.h:85
_QofObject::mark_clean
void(* mark_clean)(QofCollection *)
Definition: qofobject.h:96
qof_object_printable
const gchar * qof_object_printable(QofIdTypeConst type_name, gpointer instance)
Definition: qofobject.c:205
_QofObject
Definition: qofobject.h:70
_QofObject::is_dirty
gboolean(* is_dirty)(QofCollection *)
Definition: qofobject.h:93
qof_object_register_backend
gboolean qof_object_register_backend(QofIdTypeConst type_name, const gchar *backend_name, gpointer be_data)
Definition: qofobject.c:325
qofbook.h
Encapsulate all the information about a dataset.
qof_object_register
gboolean qof_object_register(const QofObject *object)
Definition: qofobject.c:278
QofIdTypeConst
const gchar * QofIdTypeConst
Definition: qofid.h:83
qofchoice.h
Linking one entity to other entities of many possible types.
_QofBook
Definition: qofbook-p.h:48
_QofObject::version_cmp
gint(* version_cmp)(gpointer instance_left, gpointer instance_right)
Definition: qofobject.h:119
qof_object_foreach_type
void qof_object_foreach_type(QofForeachTypeCB cb, gpointer user_data)
Definition: qofobject.c:140