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 gchar *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 gchar *(*printable) (gpointer instance);
00112
00121 gint (*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 gchar *qof_object_get_type_label (QofIdTypeConst type_name);
00148
00150 const gchar *qof_object_printable (QofIdTypeConst type_name,
00151 gpointer instance);
00152
00156 void qof_object_foreach_type (QofForeachTypeCB cb, gpointer user_data);
00157
00163 void qof_object_foreach (QofIdTypeConst type_name, QofBook * book,
00164 QofEntityForeachCB cb, gpointer user_data);
00165
00167 gboolean qof_object_register_backend (QofIdTypeConst type_name,
00168 const gchar * backend_name,
00169 gpointer be_data);
00170
00171 gpointer qof_object_lookup_backend (QofIdTypeConst type_name,
00172 const gchar * backend_name);
00173
00174 void qof_object_foreach_backend (const char *backend_name,
00175 QofForeachBackendTypeCB cb,
00176 gpointer user_data);
00177
00178 #endif
00179