GnuCash  4.8a-176-g88ecf8dd1
qofinstance.h
Go to the documentation of this file.
1 /********************************************************************\
2  * qofinstance.h -- fields common to all object instances *
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 \********************************************************************/
37 #ifndef QOF_INSTANCE_H
38 #define QOF_INSTANCE_H
39 
40 typedef struct _QofInstanceClass QofInstanceClass;
41 typedef struct QofInstance_s QofInstance;
42 
44 typedef struct _QofBook QofBook;
45 
46 #include "qofid.h"
47 #include "guid.h"
48 #include "gnc-date.h"
49 #include "qof-gobject.h"
50 
51 /* --- type macros --- */
52 #define QOF_TYPE_INSTANCE (qof_instance_get_type ())
53 #define QOF_INSTANCE(o) \
54  (G_TYPE_CHECK_INSTANCE_CAST ((o), QOF_TYPE_INSTANCE, QofInstance))
55 #define QOF_INSTANCE_CLASS(k) \
56  (G_TYPE_CHECK_CLASS_CAST((k), QOF_TYPE_INSTANCE, QofInstanceClass))
57 #define QOF_IS_INSTANCE(o) \
58  (G_TYPE_CHECK_INSTANCE_TYPE ((o), QOF_TYPE_INSTANCE))
59 #define QOF_IS_INSTANCE_CLASS(k) \
60  (G_TYPE_CHECK_CLASS_TYPE ((k), QOF_TYPE_INSTANCE))
61 #define QOF_INSTANCE_GET_CLASS(o) \
62  (G_TYPE_INSTANCE_GET_CLASS ((o), QOF_TYPE_INSTANCE, QofInstanceClass))
63 #ifndef __KVP_FRAME
64 typedef struct KvpFrameImpl KvpFrame;
65 #define __KVP_FRAME
66 #endif
67 
69 {
70  GObject object;
72  KvpFrame *kvp_data;
73 };
74 
76 {
77  GObjectClass parent_class;
78 
79  /* Returns a displayable string to represent this object */
80  gchar* (*get_display_name)(const QofInstance*);
81 
82  /* Does this object refer to a specific object */
83  gboolean (*refers_to_object)(const QofInstance* inst, const QofInstance* ref);
84 
85  /* Returns a list of my type of object which refers to an object */
86  GList* (*get_typed_referring_object_list)(const QofInstance* inst, const QofInstance* ref);
87 };
88 
90 GType qof_instance_get_type(void);
91 
93 void qof_instance_init_data (QofInstance *, QofIdType, QofBook *);
94 
96 /*@ dependent @*/
97 QofBook *qof_instance_get_book (gconstpointer);
98 
100 void qof_instance_set_book (gconstpointer inst, QofBook *book);
101 
103 void qof_instance_copy_book (gpointer ptr1, gconstpointer ptr2);
104 
106 gboolean qof_instance_books_equal (gconstpointer ptr1, gconstpointer ptr2);
107 
109 /*@ dependent @*/
110 const GncGUID * qof_instance_get_guid (gconstpointer);
111 
114 /*@ dependent @*/
115 const GncGUID * qof_entity_get_guid (gconstpointer);
116 
118 /*@ dependent @*/
119 QofCollection* qof_instance_get_collection (gconstpointer inst);
120 
124 gint qof_instance_guid_compare(const gconstpointer ptr1, const gconstpointer ptr2);
125 
126 gint qof_instance_get_editlevel (gconstpointer ptr);
127 
134 int qof_instance_version_cmp (const QofInstance *left, const QofInstance *right);
135 
144 gboolean qof_instance_get_destroying (gconstpointer ptr);
145 
157 gboolean qof_instance_get_dirty_flag (gconstpointer ptr);
158 
159 void qof_instance_print_dirty (const QofInstance *entity, gpointer dummy);
160 
162 #define qof_instance_is_dirty qof_instance_get_dirty
163 gboolean qof_instance_get_dirty (QofInstance *);
164 
165 gboolean qof_instance_get_infant(const QofInstance *inst);
166 
170 void qof_instance_get (const QofInstance *inst, const gchar *first_param, ...);
171 
176 void qof_instance_set (QofInstance *inst, const gchar *first_param, ...);
177 
180 guint32 qof_instance_get_idata (gconstpointer inst);
181 
185 gchar* qof_instance_get_display_name(const QofInstance* inst);
186 
191 GList* qof_instance_get_referring_object_list(const QofInstance* inst);
192 
194 gboolean qof_instance_refers_to_object(const QofInstance* inst, const QofInstance* ref);
195 
202 GList* qof_instance_get_typed_referring_object_list(const QofInstance* inst, const QofInstance* ref);
203 
207 GList* qof_instance_get_referring_object_list_from_collection(const QofCollection* coll, const QofInstance* ref);
208 
209 /* @} */
210 /* @} */
211 #endif /* QOF_INSTANCE_H */
int qof_instance_version_cmp(const QofInstance *left, const QofInstance *right)
Compare two instances, based on their last update times.
Implements KvpFrame.
Definition: kvp-frame.hpp:109
const GncGUID * qof_instance_get_guid(gconstpointer)
Return the GncGUID of this instance.
void qof_instance_get(const QofInstance *inst, const gchar *first_param,...)
Wrapper for g_object_get.
Date and Time handling routines.
QofBook * qof_instance_get_book(gconstpointer)
Return the book pointer.
GList * qof_instance_get_referring_object_list_from_collection(const QofCollection *coll, const QofInstance *ref)
Returns a list of objects from the collection which refer to the specific object. ...
gboolean qof_instance_get_destroying(gconstpointer ptr)
Retrieve the flag that indicates whether or not this object is about to be destroyed.
void qof_instance_set(QofInstance *inst, const gchar *first_param,...)
Wrapper for g_object_set Group setting multiple parameters in a single begin/commit/rollback.
globally unique ID User API
QofCollection * qof_instance_get_collection(gconstpointer inst)
Return the collection this instance belongs to.
QOF entity type identification system.
const gchar * QofIdType
QofIdType declaration.
Definition: qofid.h:85
void qof_instance_init_data(QofInstance *, QofIdType, QofBook *)
Initialise the settings associated with an instance.
guint32 qof_instance_get_idata(gconstpointer inst)
get the instance tag number used for kvp management in sql backends.
gboolean qof_instance_get_dirty_flag(gconstpointer ptr)
Retrieve the flag that indicates whether or not this object has been modified.
void qof_instance_copy_book(gpointer ptr1, gconstpointer ptr2)
Copy the book from one QofInstances to another.
GList * qof_instance_get_typed_referring_object_list(const QofInstance *inst, const QofInstance *ref)
Returns a list of my type of object which refers to an object.
const GncGUID * qof_entity_get_guid(gconstpointer)
gboolean qof_instance_books_equal(gconstpointer ptr1, gconstpointer ptr2)
See if two QofInstances share the same book.
GList * qof_instance_get_referring_object_list(const QofInstance *inst)
Returns a list of objects which refer to a specific object.
QofIdType e_type
Entity type.
Definition: qofinstance.h:71
void qof_instance_set_book(gconstpointer inst, QofBook *book)
Set the book pointer.
gint qof_instance_guid_compare(const gconstpointer ptr1, const gconstpointer ptr2)
Compare the GncGUID values of two instances.
QofBook reference.
Definition: qofbook.h:83
GType qof_instance_get_type(void)
Return the GType of a QofInstance.
gboolean qof_instance_refers_to_object(const QofInstance *inst, const QofInstance *ref)
Does this object refer to a specific object.
The type used to store guids in C.
Definition: guid.h:75
gchar * qof_instance_get_display_name(const QofInstance *inst)
Returns a displayable name for this object.