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 
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_ */