00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00046 #ifndef QOF_OBJECT_H_
00047 #define QOF_OBJECT_H_
00048
00049 #include "qofbook.h"
00050 #include "qofid.h"
00051 #include "qofchoice.h"
00052
00057 #define QOF_OBJECT_VERSION 3
00058
00059 #define QOF_MOD_OBJECT "qof-object"
00060
00061 typedef struct _QofObject QofObject;
00062 typedef void (*QofForeachCB) (gpointer obj, gpointer user_data);
00063 typedef void (*QofForeachTypeCB) (QofObject * type, gpointer user_data);
00064 typedef void (*QofForeachBackendTypeCB) (QofIdTypeConst type,
00065 gpointer backend_data,
00066 gpointer user_data);
00067
00070 struct _QofObject
00071 {
00072 gint interface_version;
00073 QofIdType e_type;
00074 const gchar *type_label;
00075
00080 gpointer (*create) (QofBook *);
00081
00085 void (*book_begin) (QofBook *);
00086
00090 void (*book_end) (QofBook *);
00091
00093 gboolean (*is_dirty) (QofCollection *);
00094
00096 void (*mark_clean) (QofCollection *);
00097
00105 void (*foreach) (QofCollection *, QofEntityForeachCB, gpointer);
00106
00109 const gchar *(*printable) (gpointer instance);
00110
00119 gint (*version_cmp) (gpointer instance_left, gpointer instance_right);
00120 };
00121
00122
00123
00126 void qof_object_initialize (void);
00127 void qof_object_shutdown (void);
00131 gboolean qof_object_register (const QofObject * object);
00132
00134 const QofObject *qof_object_lookup (QofIdTypeConst type_name);
00135
00140 gpointer qof_object_new_instance (QofIdTypeConst type_name, QofBook * book);
00141
00145 const gchar *qof_object_get_type_label (QofIdTypeConst type_name);
00146
00148 const gchar *qof_object_printable (QofIdTypeConst type_name,
00149 gpointer instance);
00150
00154 void qof_object_foreach_type (QofForeachTypeCB cb, gpointer user_data);
00155
00161 void qof_object_foreach (QofIdTypeConst type_name, QofBook * book,
00162 QofEntityForeachCB cb, gpointer user_data);
00163
00165 gboolean qof_object_register_backend (QofIdTypeConst type_name,
00166 const gchar * backend_name,
00167 gpointer be_data);
00168
00169 gpointer qof_object_lookup_backend (QofIdTypeConst type_name,
00170 const gchar * backend_name);
00171
00172 void qof_object_foreach_backend (const char *backend_name,
00173 QofForeachBackendTypeCB cb,
00174 gpointer user_data);
00177 #endif