00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00048 #ifndef QOF_OBJECT_H_
00049 #define QOF_OBJECT_H_
00050
00051 #include "qofbook.h"
00052 #include "qofid.h"
00053 #include "qofchoice.h"
00054
00059 #define QOF_OBJECT_VERSION 3
00060
00061 #define QOF_MOD_OBJECT "qof-object"
00062
00063 typedef struct _QofObject QofObject;
00064 typedef void (*QofForeachCB) (gpointer obj, gpointer user_data);
00065 typedef void (*QofForeachTypeCB) (QofObject *type, gpointer user_data);
00066 typedef void (*QofForeachBackendTypeCB) (QofIdTypeConst type,
00067 gpointer backend_data,
00068 gpointer user_data);
00069
00072 struct _QofObject
00073 {
00074 gint interface_version;
00075 QofIdType e_type;
00076 const char * type_label;
00077
00082 gpointer (*create)(QofBook *);
00083
00087 void (*book_begin)(QofBook *);
00088
00092 void (*book_end)(QofBook *);
00093
00095 gboolean (*is_dirty)(QofCollection *);
00096
00098 void (*mark_clean)(QofCollection *);
00099
00107 void (*foreach)(QofCollection *, QofEntityForeachCB, gpointer);
00108
00111 const char * (*printable)(gpointer instance);
00112
00121 int (*version_cmp)(gpointer instance_left, gpointer instance_right);
00122 };
00123
00124
00125
00128 void qof_object_initialize (void);
00129 void qof_object_shutdown (void);
00133 gboolean qof_object_register (const QofObject *object);
00134
00136 const QofObject * qof_object_lookup (QofIdTypeConst type_name);
00137
00142 gpointer qof_object_new_instance (QofIdTypeConst type_name, QofBook *book);
00143
00147 const char * qof_object_get_type_label (QofIdTypeConst type_name);
00148
00150 const char * qof_object_printable (QofIdTypeConst type_name, gpointer instance);
00151
00155 void qof_object_foreach_type (QofForeachTypeCB cb, gpointer user_data);
00156
00162 void qof_object_foreach (QofIdTypeConst type_name, QofBook *book,
00163 QofEntityForeachCB cb, gpointer user_data);
00164
00166 gboolean qof_object_register_backend (QofIdTypeConst type_name,
00167 const char *backend_name,
00168 gpointer be_data);
00169
00170 gpointer qof_object_lookup_backend (QofIdTypeConst type_name,
00171 const char *backend_name);
00172
00173 void qof_object_foreach_backend (const char *backend_name,
00174 QofForeachBackendTypeCB cb,
00175 gpointer user_data);
00176
00177 #endif
00178