QOF
0.8.0
|
00001 /********************************************************************\ 00002 * qofobject.h -- the Core Object Description Interface * 00003 * * 00004 * This program is free software; you can redistribute it and/or * 00005 * modify it under the terms of the GNU General Public License as * 00006 * published by the Free Software Foundation; either version 2 of * 00007 * the License, or (at your option) any later version. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU General Public License* 00015 * along with this program; if not, contact: * 00016 * * 00017 * Free Software Foundation Voice: +1-617-542-5942 * 00018 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 00019 * Boston, MA 02110-1301, USA gnu@gnu.org * 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 4 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; /* of this object interface */ 00073 QofIdType e_type; /* the Object's QOF_ID */ 00074 const gchar *type_label; /* "Printable" type-label string */ 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 /* QOF_OBJECT_H_ */