qofobject.h

Go to the documentation of this file.
00001 /********************************************************************\
00002  * qofobject.h -- the Core Object Registration/Lookup 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 \********************************************************************/
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;     /* of this object interface */
00075     QofIdType e_type;           /* the Object's QOF_ID */
00076     const gchar *type_label;    /* "Printable" type-label string */
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 /* QOF_OBJECT_H_ */
00179 

Generated on Fri Sep 1 15:13:11 2006 for QOF by  doxygen 1.4.7