GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 [email protected] *
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 "kvp_frame.h"
50 #include "qof-gobject.h"
51 
52 /* --- type macros --- */
53 #define QOF_TYPE_INSTANCE (qof_instance_get_type ())
54 #define QOF_INSTANCE(o) \
55  (G_TYPE_CHECK_INSTANCE_CAST ((o), QOF_TYPE_INSTANCE, QofInstance))
56 #define QOF_INSTANCE_CLASS(k) \
57  (G_TYPE_CHECK_CLASS_CAST((k), QOF_TYPE_INSTANCE, QofInstanceClass))
58 #define QOF_IS_INSTANCE(o) \
59  (G_TYPE_CHECK_INSTANCE_TYPE ((o), QOF_TYPE_INSTANCE))
60 #define QOF_IS_INSTANCE_CLASS(k) \
61  (G_TYPE_CHECK_CLASS_TYPE ((k), QOF_TYPE_INSTANCE))
62 #define QOF_INSTANCE_GET_CLASS(o) \
63  (G_TYPE_INSTANCE_GET_CLASS ((o), QOF_TYPE_INSTANCE, QofInstanceClass))
64 
66 {
67  GObject object;
68 
71  /* kvp_data is a key-value pair database for storing arbirtary
72  * information associated with this instance.
73  * See src/engine/kvp_doc.txt for a list and description of the
74  * important keys. */
75  KvpFrame *kvp_data;
76 };
77 
79 {
80  GObjectClass parent_class;
81 
82  /* Returns a displayable string to represent this object */
83  gchar* (*get_display_name)(const QofInstance*);
84 
85  /* Does this object refer to a specific object */
86  gboolean (*refers_to_object)(const QofInstance* inst, const QofInstance* ref);
87 
88  /* Returns a list of my type of object which refers to an object */
89  GList* (*get_typed_referring_object_list)(const QofInstance* inst, const QofInstance* ref);
90 };
91 
93 GType qof_instance_get_type(void);
94 
97 
99 /*@ dependent @*/
100 QofBook *qof_instance_get_book (gconstpointer);
101 
103 void qof_instance_set_book (gconstpointer inst, QofBook *book);
104 
106 void qof_instance_copy_book (gpointer ptr1, gconstpointer ptr2);
107 
109 gboolean qof_instance_books_equal (gconstpointer ptr1, gconstpointer ptr2);
110 
112 /*@ dependent @*/
113 const GncGUID * qof_instance_get_guid (gconstpointer);
114 
117 /*@ dependent @*/
118 const GncGUID * qof_entity_get_guid (gconstpointer);
119 
121 /*@ dependent @*/
122 QofCollection* qof_instance_get_collection (gconstpointer inst);
123 
127 gint qof_instance_guid_compare(const gconstpointer ptr1, const gconstpointer ptr2);
128 
129 gint qof_instance_get_editlevel (gconstpointer ptr);
130 
137 int qof_instance_version_cmp (const QofInstance *left, const QofInstance *right);
138 
147 gboolean qof_instance_get_destroying (gconstpointer ptr);
148 
160 gboolean qof_instance_get_dirty_flag (gconstpointer ptr);
161 
162 void qof_instance_print_dirty (const QofInstance *entity, gpointer dummy);
163 
165 #define qof_instance_is_dirty qof_instance_get_dirty
166 gboolean qof_instance_get_dirty (QofInstance *);
167 
168 gboolean qof_instance_get_infant(const QofInstance *inst);
169 
173 void qof_instance_get (const QofInstance *inst, const gchar *first_param, ...);
174 
179 void qof_instance_set (QofInstance *inst, const gchar *first_param, ...);
180 
183 guint32 qof_instance_get_idata (gconstpointer inst);
184 
188 gchar* qof_instance_get_display_name(const QofInstance* inst);
189 
195 
197 gboolean qof_instance_refers_to_object(const QofInstance* inst, const QofInstance* ref);
198 
206 
210 GList* qof_instance_get_referring_object_list_from_collection(const QofCollection* coll, const QofInstance* ref);
211 
212 /* @} */
213 /* @} */
214 #endif /* QOF_INSTANCE_H */
int qof_instance_version_cmp(const QofInstance *left, const QofInstance *right)
QofIdType e_type
Definition: qofinstance.h:69
const GncGUID * qof_instance_get_guid(gconstpointer)
void qof_instance_get(const QofInstance *inst, const gchar *first_param,...)
Wrapper for g_object_get.
Date and Time handling routines.
A key-value frame system.
QofBook * qof_instance_get_book(gconstpointer)
GList * qof_instance_get_referring_object_list_from_collection(const QofCollection *coll, const QofInstance *ref)
gboolean qof_instance_get_destroying(gconstpointer ptr)
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)
QOF entity type identification system.
Definition: guid.h:65
const gchar * QofIdType
Definition: qofid.h:85
void qof_instance_init_data(QofInstance *, QofIdType, QofBook *)
guint32 qof_instance_get_idata(gconstpointer inst)
gboolean qof_instance_get_dirty_flag(gconstpointer ptr)
void qof_instance_copy_book(gpointer ptr1, gconstpointer ptr2)
GList * qof_instance_get_typed_referring_object_list(const QofInstance *inst, const QofInstance *ref)
const GncGUID * qof_entity_get_guid(gconstpointer)
gboolean qof_instance_books_equal(gconstpointer ptr1, gconstpointer ptr2)
GList * qof_instance_get_referring_object_list(const QofInstance *inst)
void qof_instance_set_book(gconstpointer inst, QofBook *book)
gint qof_instance_guid_compare(const gconstpointer ptr1, const gconstpointer ptr2)
struct KvpFrameImpl KvpFrame
Definition: kvp_frame.h:76
GType qof_instance_get_type(void)
gboolean qof_instance_refers_to_object(const QofInstance *inst, const QofInstance *ref)
gchar * qof_instance_get_display_name(const QofInstance *inst)