GnuCash c935c2f+
Loading...
Searching...
No Matches
qofobject.h
Go to the documentation of this file.
1/********************************************************************\
2 * qofobject.h -- the Core Object Registration/Lookup Interface *
3 * *
4 * This program is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU General Public License as *
6 * published by the Free Software Foundation; either version 2 of *
7 * the License, or (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License*
15 * along with this program; if not, contact: *
16 * *
17 * Free Software Foundation Voice: +1-617-542-5942 *
18 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19 * Boston, MA 02110-1301, USA gnu@gnu.org *
20 * *
21\********************************************************************/
48#ifndef QOF_OBJECT_H_
49#define QOF_OBJECT_H_
50
51#include "qofbook.h"
52#include "qofid.h"
53
54#ifdef __cplusplus
55extern "C"
56{
57#endif
58
63#define QOF_OBJECT_VERSION 3
64
65#define QOF_MOD_OBJECT "qof.object"
66
67typedef struct _QofObject QofObject;
68typedef void (*QofForeachCB) (gpointer obj, gpointer user_data);
69typedef void (*QofForeachTypeCB) (QofObject *type, gpointer user_data);
70typedef void (*QofForeachBackendTypeCB) (QofIdTypeConst type,
71 gpointer backend_data,
72 gpointer user_data);
73
77{
78 gint interface_version; /* of this object interface */
79 QofIdType e_type; /* the Object's QOF_ID */
80 const char * type_label; /* "Printable" type-label string */
81
86 gpointer (*create)(QofBook *);
87
91 void (*book_begin)(QofBook *);
92
96 void (*book_end)(QofBook *);
97
99 gboolean (*is_dirty)(const QofCollection *);
100
102 void (*mark_clean)(QofCollection *);
103
111 void (*foreach)(const QofCollection *, QofInstanceForeachCB, gpointer);
112
115 const char * (*printable)(gpointer instance);
116
125 int (*version_cmp)(gpointer instance_left, gpointer instance_right);
126};
127
128/* -------------------------------------------------------------- */
129
132void qof_object_initialize (void);
133void qof_object_shutdown (void);
137gboolean qof_object_register (const QofObject *object);
138
140const QofObject * qof_object_lookup (QofIdTypeConst type_name);
141
146gpointer qof_object_new_instance (QofIdTypeConst type_name, QofBook *book);
147
151const char * qof_object_get_type_label (QofIdTypeConst type_name);
152
154const char * qof_object_printable (QofIdTypeConst type_name, gpointer instance);
155
159void qof_object_foreach_type (QofForeachTypeCB cb, gpointer user_data);
160
166void qof_object_foreach (QofIdTypeConst type_name, QofBook *book,
167 QofInstanceForeachCB cb, gpointer user_data);
168
171 QofInstanceForeachCB cb, gpointer user_data);
172
173#ifdef __cplusplus
174}
175#endif
176
177#endif /* QOF_OBJECT_H_ */
void(* QofInstanceForeachCB)(QofInstance *, gpointer user_data)
Callback type for qof_collection_foreach.
Definition qofid.h:146
const gchar * QofIdType
QofIdType declaration.
Definition qofid.h:80
const gchar * QofIdTypeConst
QofIdTypeConst declaration.
Definition qofid.h:82
void qof_object_foreach(QofIdTypeConst type_name, QofBook *book, QofInstanceForeachCB cb, gpointer user_data)
Invoke the callback 'cb' on every instance ov a particular object type.
gboolean qof_object_register(const QofObject *object)
Register new types of object objects.
void qof_object_foreach_sorted(QofIdTypeConst type_name, QofBook *book, QofInstanceForeachCB cb, gpointer user_data)
Invoke callback 'cb' on each instance in guid orted order.
const char * qof_object_printable(QofIdTypeConst type_name, gpointer instance)
void qof_object_foreach_type(QofForeachTypeCB cb, gpointer user_data)
Invoke the callback 'cb' on every object class definition.
const QofObject * qof_object_lookup(QofIdTypeConst type_name)
Lookup an object definition.
gpointer qof_object_new_instance(QofIdTypeConst type_name, QofBook *book)
Create an instance of the indicated type, returning a pointer to that instance.
Definition qofobject.cpp:65
const char * qof_object_get_type_label(QofIdTypeConst type_name)
Get the printable label for a type.
Encapsulate all the information about a dataset.
QOF entity type identification system.
QofBook reference.
Definition qofbook-p.hpp:47
This is the QofObject Class descriptor.
Definition qofobject.h:77
int(* version_cmp)(gpointer instance_left, gpointer instance_right)
Given a pair of items of this type, this routine returns value indicating which item is 'newer'.
Definition qofobject.h:125
void(* mark_clean)(QofCollection *)
Mark this object's book clean (for after a load)
Definition qofobject.h:102
void(* book_end)(QofBook *)
book_end is called when the book is being closed, to clean up (and free memory).
Definition qofobject.h:96
gpointer(* create)(QofBook *)
Create a new instance of this object type.
Definition qofobject.h:86
void(* book_begin)(QofBook *)
book_begin is called from within the Book routines to create module-specific hooks in a book whenever...
Definition qofobject.h:91
gboolean(* is_dirty)(const QofCollection *)
Determine if there are any dirty items in this book.
Definition qofobject.h:99