GnuCash c935c2f+
Loading...
Searching...
No Matches
Files | Data Structures | Macros | Functions | Variables

Qof Instances are a derived type of QofInstance. More...

Files

file  qofinstance.h
 Object instance holds common fields that most gnucash objects use.
 

Data Structures

struct  QofInstance
 
struct  QofInstanceClass
 

Macros

#define QOF_TYPE_INSTANCE   (qof_instance_get_type ())
 
#define QOF_INSTANCE(o)    (G_TYPE_CHECK_INSTANCE_CAST ((o), QOF_TYPE_INSTANCE, QofInstance))
 
#define QOF_INSTANCE_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), QOF_TYPE_INSTANCE, QofInstanceClass))
 
#define QOF_IS_INSTANCE(o)    (G_TYPE_CHECK_INSTANCE_TYPE ((o), QOF_TYPE_INSTANCE))
 
#define QOF_IS_INSTANCE_CLASS(k)    (G_TYPE_CHECK_CLASS_TYPE ((k), QOF_TYPE_INSTANCE))
 
#define QOF_INSTANCE_GET_CLASS(o)    (G_TYPE_INSTANCE_GET_CLASS ((o), QOF_TYPE_INSTANCE, QofInstanceClass))
 
#define qof_instance_is_dirty   qof_instance_get_dirty
 Return value of is_dirty flag.
 

Functions

GType qof_instance_get_type (void)
 Return the GType of a QofInstance.
 
void qof_instance_init_data (QofInstance *, QofIdType, QofBook *)
 Initialise the settings associated with an instance.
 
QofBookqof_instance_get_book (gconstpointer)
 Return the book pointer.
 
void qof_instance_set_book (gconstpointer inst, QofBook *book)
 Set the book pointer.
 
void qof_instance_copy_book (gpointer ptr1, gconstpointer ptr2)
 Copy the book from one QofInstances to another.
 
gboolean qof_instance_books_equal (gconstpointer ptr1, gconstpointer ptr2)
 See if two QofInstances share the same book.
 
const GncGUIDqof_instance_get_guid (gconstpointer)
 Return the GncGUID of this instance.
 
const GncGUIDqof_entity_get_guid (gconstpointer)
 
QofCollection * qof_instance_get_collection (gconstpointer inst)
 Return the collection this instance belongs to.
 
gint qof_instance_guid_compare (const gconstpointer ptr1, const gconstpointer ptr2)
 Compare the GncGUID values of two instances.
 
gint qof_instance_get_editlevel (gconstpointer ptr)
 
int qof_instance_version_cmp (const QofInstance *left, const QofInstance *right)
 Compare two instances, based on their last update times.
 
gboolean qof_instance_get_destroying (gconstpointer ptr)
 Retrieve the flag that indicates whether or not this object is about to be destroyed.
 
gboolean qof_instance_get_dirty_flag (gconstpointer ptr)
 Retrieve the flag that indicates whether or not this object has been modified.
 
void qof_instance_print_dirty (const QofInstance *entity, gpointer dummy)
 
gboolean qof_instance_get_dirty (QofInstance *)
 
gboolean qof_instance_get_infant (const QofInstance *inst)
 
void qof_instance_get (const QofInstance *inst, const gchar *first_param,...)
 Wrapper for g_object_get.
 
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.
 
guint32 qof_instance_get_idata (gconstpointer inst)
 get the instance tag number used for kvp management in sql backends.
 
gchar * qof_instance_get_display_name (const QofInstance *inst)
 Returns a displayable name for this object.
 
GList * qof_instance_get_referring_object_list (const QofInstance *inst)
 Returns a list of objects which refer to a specific object.
 
gboolean qof_instance_refers_to_object (const QofInstance *inst, const QofInstance *ref)
 Does this object refer to a specific object.
 
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.
 
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.
 

Variables

GObject QofInstance::object
 
QofIdType QofInstance::e_type
 Entity type.
 
KvpFrame * QofInstance::kvp_data
 
GObjectClass QofInstanceClass::parent_class
 
gchar *(* QofInstanceClass::get_display_name )(const QofInstance *)
 
gboolean(* QofInstanceClass::refers_to_object )(const QofInstance *inst, const QofInstance *ref)
 
GList *(* QofInstanceClass::get_typed_referring_object_list )(const QofInstance *inst, const QofInstance *ref)
 

Detailed Description

Qof Instances are a derived type of QofInstance.

The Instance adds some common features and functions that most objects will want to use.

Macro Definition Documentation

◆ QOF_INSTANCE

#define QOF_INSTANCE (   o)     (G_TYPE_CHECK_INSTANCE_CAST ((o), QOF_TYPE_INSTANCE, QofInstance))

Definition at line 57 of file qofinstance.h.

73{
74 GObject object;
75 QofIdType e_type;
76 KvpFrame *kvp_data;
77};
78
80{
81 GObjectClass parent_class;
82
83 /* Returns a displayable string to represent this object */
84 gchar* (*get_display_name)(const QofInstance*);
85
86 /* Does this object refer to a specific object */
87 gboolean (*refers_to_object)(const QofInstance* inst, const QofInstance* ref);
88
89 /* Returns a list of my type of object which refers to an object */
90 GList* (*get_typed_referring_object_list)(const QofInstance* inst, const QofInstance* ref);
91};
92
94GType qof_instance_get_type(void);
95
98
100/*@ dependent @*/
101QofBook *qof_instance_get_book (gconstpointer);
102
104void qof_instance_set_book (gconstpointer inst, QofBook *book);
105
107void qof_instance_copy_book (gpointer ptr1, gconstpointer ptr2);
108
110gboolean qof_instance_books_equal (gconstpointer ptr1, gconstpointer ptr2);
111
113/*@ dependent @*/
114const GncGUID * qof_instance_get_guid (gconstpointer);
115
118/*@ dependent @*/
119const GncGUID * qof_entity_get_guid (gconstpointer);
120
122/*@ dependent @*/
123QofCollection* qof_instance_get_collection (gconstpointer inst);
124
128gint qof_instance_guid_compare(const gconstpointer ptr1, const gconstpointer ptr2);
129
130gint qof_instance_get_editlevel (gconstpointer ptr);
131
138int qof_instance_version_cmp (const QofInstance *left, const QofInstance *right);
139
148gboolean qof_instance_get_destroying (gconstpointer ptr);
149
161gboolean qof_instance_get_dirty_flag (gconstpointer ptr);
162
163void qof_instance_print_dirty (const QofInstance *entity, gpointer dummy);
164
166#define qof_instance_is_dirty qof_instance_get_dirty
167gboolean qof_instance_get_dirty (QofInstance *);
168
169gboolean qof_instance_get_infant(const QofInstance *inst);
170
174void qof_instance_get (const QofInstance *inst, const gchar *first_param, ...);
175
180void qof_instance_set (QofInstance *inst, const gchar *first_param, ...);
181
184guint32 qof_instance_get_idata (gconstpointer inst);
185
190
196
198gboolean qof_instance_refers_to_object(const QofInstance* inst, const QofInstance* ref);
199
207
211GList* qof_instance_get_referring_object_list_from_collection(const QofCollection* coll, const QofInstance* ref);
212
213#ifdef __cplusplus
214}
215#endif
216
217/* @} */
218/* @} */
219#endif /* QOF_INSTANCE_H */
const gchar * QofIdType
QofIdType declaration.
Definition qofid.h:80
QofBook * qof_instance_get_book(gconstpointer)
Return the book pointer.
void qof_instance_copy_book(gpointer ptr1, gconstpointer ptr2)
Copy the book from one QofInstances to another.
const GncGUID * qof_instance_get_guid(gconstpointer)
Return the GncGUID of this instance.
GType qof_instance_get_type(void)
Return the GType of a QofInstance.
int qof_instance_version_cmp(const QofInstance *left, const QofInstance *right)
Compare two instances, based on their last update times.
QofCollection * qof_instance_get_collection(gconstpointer inst)
Return the collection this instance belongs to.
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.
void qof_instance_init_data(QofInstance *, QofIdType, QofBook *)
Initialise the settings associated with an instance.
gboolean qof_instance_get_dirty_flag(gconstpointer ptr)
Retrieve the flag that indicates whether or not this object has been modified.
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_get(const QofInstance *inst, const gchar *first_param,...)
Wrapper for g_object_get.
gboolean qof_instance_books_equal(gconstpointer ptr1, gconstpointer ptr2)
See if two QofInstances share the same book.
gint qof_instance_guid_compare(const gconstpointer ptr1, const gconstpointer ptr2)
Compare the GncGUID values of two instances.
gchar * qof_instance_get_display_name(const QofInstance *inst)
Returns a displayable name for this object.
guint32 qof_instance_get_idata(gconstpointer inst)
get the instance tag number used for kvp management in sql backends.
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.
void qof_instance_set_book(gconstpointer inst, QofBook *book)
Set the book pointer.
gboolean qof_instance_refers_to_object(const QofInstance *inst, const QofInstance *ref)
Does this object refer to a specific object.
GList * qof_instance_get_referring_object_list(const QofInstance *inst)
Returns a list of objects which refer to a specific object.
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.
const GncGUID * qof_entity_get_guid(gconstpointer)
The type used to store guids in C.
Definition guid.h:75
QofBook reference.
Definition qofbook-p.hpp:47

◆ QOF_INSTANCE_CLASS

#define QOF_INSTANCE_CLASS (   k)     (G_TYPE_CHECK_CLASS_CAST((k), QOF_TYPE_INSTANCE, QofInstanceClass))

Definition at line 59 of file qofinstance.h.

◆ QOF_INSTANCE_GET_CLASS

#define QOF_INSTANCE_GET_CLASS (   o)     (G_TYPE_INSTANCE_GET_CLASS ((o), QOF_TYPE_INSTANCE, QofInstanceClass))

Definition at line 65 of file qofinstance.h.

◆ qof_instance_is_dirty

#define qof_instance_is_dirty   qof_instance_get_dirty

Return value of is_dirty flag.

Definition at line 166 of file qofinstance.h.

◆ QOF_IS_INSTANCE

#define QOF_IS_INSTANCE (   o)     (G_TYPE_CHECK_INSTANCE_TYPE ((o), QOF_TYPE_INSTANCE))

Definition at line 61 of file qofinstance.h.

◆ QOF_IS_INSTANCE_CLASS

#define QOF_IS_INSTANCE_CLASS (   k)     (G_TYPE_CHECK_CLASS_TYPE ((k), QOF_TYPE_INSTANCE))

Definition at line 63 of file qofinstance.h.

◆ QOF_TYPE_INSTANCE

#define QOF_TYPE_INSTANCE   (qof_instance_get_type ())

Definition at line 56 of file qofinstance.h.

Function Documentation

◆ qof_entity_get_guid()

const GncGUID * qof_entity_get_guid ( gconstpointer  ent)
Deprecated:
Use qof_instance_get_guid instead. Works like qof_instance_get_guid, but returns NULL on NULL

Definition at line 457 of file qofinstance.cpp.

458{
459 return ent ? qof_instance_get_guid(ent) : guid_null();
460}
const GncGUID * guid_null(void)
Returns a GncGUID which is guaranteed to never reference any entity.
Definition guid.cpp:165

◆ qof_instance_books_equal()

gboolean qof_instance_books_equal ( gconstpointer  ptr1,
gconstpointer  ptr2 
)

See if two QofInstances share the same book.


Definition at line 545 of file qofinstance.cpp.

546{
547 const QofInstancePrivate *priv1, *priv2;
548
549 g_return_val_if_fail(QOF_IS_INSTANCE(ptr1), FALSE);
550 g_return_val_if_fail(QOF_IS_INSTANCE(ptr2), FALSE);
551
552 priv1 = GET_PRIVATE(ptr1);
553 priv2 = GET_PRIVATE(ptr2);
554
555 return (priv1->book == priv2->book);
556}

◆ qof_instance_copy_book()

void qof_instance_copy_book ( gpointer  ptr1,
gconstpointer  ptr2 
)

Copy the book from one QofInstances to another.


Definition at line 536 of file qofinstance.cpp.

537{
538 g_return_if_fail(QOF_IS_INSTANCE(ptr1));
539 g_return_if_fail(QOF_IS_INSTANCE(ptr2));
540
541 GET_PRIVATE(ptr1)->book = GET_PRIVATE(ptr2)->book;
542}

◆ qof_instance_get()

void qof_instance_get ( const QofInstance inst,
const gchar *  first_param,
  ... 
)

Wrapper for g_object_get.

Definition at line 29 of file gmock-qofinstance.cpp.

30{
31 va_list ap;
32 ASSERT_TRUE (QOF_IS_INSTANCE (inst));
33
34 va_start (ap, first_prop);
35 g_object_get_valist (G_OBJECT (inst), first_prop, ap);
36 va_end (ap);
37}

◆ qof_instance_get_book()

QofBook * qof_instance_get_book ( gconstpointer  inst)

Return the book pointer.

Definition at line 521 of file qofinstance.cpp.

522{
523 if (!inst) return nullptr;
524 g_return_val_if_fail(QOF_IS_INSTANCE(inst), nullptr);
525 return GET_PRIVATE(inst)->book;
526}

◆ qof_instance_get_collection()

QofCollection * qof_instance_get_collection ( gconstpointer  inst)

Return the collection this instance belongs to.

Definition at line 506 of file qofinstance.cpp.

507{
508
509 g_return_val_if_fail(QOF_IS_INSTANCE(ptr), nullptr);
510 return GET_PRIVATE(ptr)->collection;
511}

◆ qof_instance_get_destroying()

gboolean qof_instance_get_destroying ( gconstpointer  ptr)

Retrieve the flag that indicates whether or not this object is about to be destroyed.

Parameters
ptrThe object whose flag should be retrieved.
Returns
TRUE if the object has been marked for destruction. FALSE if the object is not marked for destruction, or if a bad parameter is passed to the function.

Definition at line 631 of file qofinstance.cpp.

632{
633 g_return_val_if_fail(QOF_IS_INSTANCE(ptr), FALSE);
634 return GET_PRIVATE(ptr)->do_free;
635}

◆ qof_instance_get_dirty()

gboolean qof_instance_get_dirty ( QofInstance inst)

Definition at line 680 of file qofinstance.cpp.

681{
682 QofInstancePrivate *priv;
683
684 if (!inst)
685 {
686 return FALSE;
687 }
688
689 priv = GET_PRIVATE(inst);
690 return priv->dirty;
691}

◆ qof_instance_get_dirty_flag()

gboolean qof_instance_get_dirty_flag ( gconstpointer  ptr)

Retrieve the flag that indicates whether or not this object has been modified.

This is specifically the flag on the object. It does not perform any other checking which might normally be performed when testing to see if an object is dirty. If there is any question, use the qof_instance_is_dirty() function instead.

Parameters
ptrThe object whose flag should be retrieved.
Returns
TRUE if the object has been modified and not saved. FALSE if the object has not been modified, or if a bad parameter is passed to the function.

Definition at line 645 of file qofinstance.cpp.

646{
647 g_return_val_if_fail(QOF_IS_INSTANCE(ptr), FALSE);
648 return GET_PRIVATE(ptr)->dirty;
649}

◆ qof_instance_get_display_name()

gchar * qof_instance_get_display_name ( const QofInstance inst)

Returns a displayable name for this object.

The returned string must be freed by the caller.

Definition at line 776 of file qofinstance.cpp.

777{
778 g_return_val_if_fail( inst != nullptr, nullptr );
779
780 if ( QOF_INSTANCE_GET_CLASS(inst)->get_display_name != nullptr )
781 {
782 return QOF_INSTANCE_GET_CLASS(inst)->get_display_name(inst);
783 }
784 else
785 {
786 /* Not implemented - return default string */
787 return g_strdup_printf("Object %s %p",
789 inst);
790 }
791}
QofIdType qof_collection_get_type(const QofCollection *col)
return the type that the collection stores
Definition qofid.cpp:73

◆ qof_instance_get_editlevel()

gint qof_instance_get_editlevel ( gconstpointer  ptr)

Definition at line 591 of file qofinstance.cpp.

592{
593 g_return_val_if_fail(QOF_IS_INSTANCE(ptr), 0);
594 return GET_PRIVATE(ptr)->editlevel;
595}

◆ qof_instance_get_guid()

const GncGUID * qof_instance_get_guid ( gconstpointer  inst)

Return the GncGUID of this instance.

Definition at line 446 of file qofinstance.cpp.

447{
448 QofInstancePrivate *priv;
449
450 if (!inst) return nullptr;
451 g_return_val_if_fail(QOF_IS_INSTANCE(inst), guid_null());
452 priv = GET_PRIVATE(inst);
453 return &(priv->guid);
454}
GncGUID guid
GncGUID for the entity.

◆ qof_instance_get_idata()

guint32 qof_instance_get_idata ( gconstpointer  inst)

get the instance tag number used for kvp management in sql backends.

Definition at line 753 of file qofinstance.cpp.

754{
755 if (!inst)
756 {
757 return 0;
758 }
759 g_return_val_if_fail(QOF_IS_INSTANCE(inst), 0);
760 return GET_PRIVATE(inst)->idata;
761}

◆ qof_instance_get_infant()

gboolean qof_instance_get_infant ( const QofInstance inst)

Definition at line 703 of file qofinstance.cpp.

704{
705 g_return_val_if_fail(QOF_IS_INSTANCE(inst), FALSE);
706 return GET_PRIVATE(inst)->infant;
707}

◆ qof_instance_get_referring_object_list()

GList * qof_instance_get_referring_object_list ( const QofInstance inst)

Returns a list of objects which refer to a specific object.

The list must be freed by the caller, but the objects on the list must not.

Definition at line 826 of file qofinstance.cpp.

827{
829
830 g_return_val_if_fail( inst != nullptr, nullptr );
831
832 /* scan all collections */
833 data.inst = inst;
834 data.list = nullptr;
835
836 qof_book_foreach_collection(qof_instance_get_book(inst),
837 get_referring_object_helper,
838 &data);
839 return data.list;
840}

◆ qof_instance_get_referring_object_list_from_collection()

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.

The list must be freed by the caller but the objects on the list must not.

Definition at line 854 of file qofinstance.cpp.

855{
857
858 g_return_val_if_fail( coll != nullptr, nullptr );
859 g_return_val_if_fail( ref != nullptr, nullptr );
860
861 data.inst = ref;
862 data.list = nullptr;
863
864 qof_collection_foreach(coll, get_typed_referring_object_instance_helper, &data);
865 return data.list;
866}

◆ qof_instance_get_typed_referring_object_list()

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.

For example, when called as qof_instance_get_typed_referring_object_list(taxtable, account); it will return the list of taxtables which refer to a specific account. The result should be the same regardless of which taxtable object is used. The list must be freed by the caller but the objects on the list must not.

Definition at line 869 of file qofinstance.cpp.

870{
871 g_return_val_if_fail( inst != nullptr, nullptr );
872 g_return_val_if_fail( ref != nullptr, nullptr );
873
874 if ( QOF_INSTANCE_GET_CLASS(inst)->get_typed_referring_object_list != nullptr )
875 {
876 return QOF_INSTANCE_GET_CLASS(inst)->get_typed_referring_object_list(inst, ref);
877 }
878 else
879 {
880 /* Not implemented - by default, loop through all objects of this object's type and check
881 them individually. */
882 QofCollection* coll;
883
884 coll = qof_instance_get_collection(inst);
886 }
887}

◆ qof_instance_guid_compare()

gint qof_instance_guid_compare ( const gconstpointer  ptr1,
const gconstpointer  ptr2 
)

Compare the GncGUID values of two instances.

This routine returns 0 if the two values are equal, <0 if the first is smaller than the second, or >0 if the second is smaller tan the first.

Definition at line 492 of file qofinstance.cpp.

493{
494 const QofInstancePrivate *priv1, *priv2;
495
496 g_return_val_if_fail(QOF_IS_INSTANCE(ptr1), -1);
497 g_return_val_if_fail(QOF_IS_INSTANCE(ptr2), 1);
498
499 priv1 = GET_PRIVATE(ptr1);
500 priv2 = GET_PRIVATE(ptr2);
501
502 return guid_compare(&priv1->guid, &priv2->guid);
503}

◆ qof_instance_init_data()

void qof_instance_init_data ( QofInstance inst,
QofIdType  type,
QofBook book 
)

Initialise the settings associated with an instance.

Definition at line 260 of file qofinstance.cpp.

261{
262 QofInstancePrivate *priv;
263 QofCollection *col;
264 QofIdType col_type;
265
266 g_return_if_fail(QOF_IS_INSTANCE(inst));
267 priv = GET_PRIVATE(inst);
268 g_return_if_fail(!priv->book);
269
270 priv->book = book;
271 col = qof_book_get_collection (book, type);
272 g_return_if_fail(col != nullptr);
273
274 /* XXX We passed redundant info to this routine ... but I think that's
275 * OK, it might eliminate programming errors. */
276
277 col_type = qof_collection_get_type(col);
278 if (g_strcmp0(col_type, type))
279 {
280 PERR ("attempt to insert \"%s\" into \"%s\"", type, col_type);
281 return;
282 }
283 priv = GET_PRIVATE(inst);
284 inst->e_type = static_cast<QofIdType>(CACHE_INSERT (type));
285
286 do
287 {
288 guid_replace(&priv->guid);
289
290 if (nullptr == qof_collection_lookup_entity (col, &priv->guid))
291 break;
292
293 PWARN("duplicate id created, trying again");
294 }
295 while (1);
296
297 priv->collection = col;
298
300}
QofCollection * qof_book_get_collection(const QofBook *book, QofIdType entity_type)
Return The table of entities of the given type.
Definition qofbook.cpp:521
QofInstance * qof_collection_lookup_entity(const QofCollection *col, const GncGUID *guid)
Find the entity going only from its guid.
Definition qofid.cpp:209
void guid_replace(GncGUID *guid)
Generate a new guid.
Definition guid.cpp:178
QofIdType e_type
Entity type.
Definition qofinstance.h:75
#define PERR(format, args...)
Log a serious error.
Definition qoflog.h:244
#define PWARN(format, args...)
Log a warning.
Definition qoflog.h:250
void qof_collection_insert_entity(QofCollection *, QofInstance *)
Take entity, remove it from whatever collection its currently in, and place it in a new collection.
Definition qofid.cpp:95
QofCollection * collection
Entity collection.

◆ qof_instance_print_dirty()

void qof_instance_print_dirty ( const QofInstance entity,
gpointer  dummy 
)

Definition at line 666 of file qofinstance.cpp.

667{
668 QofInstancePrivate *priv;
669
670 priv = GET_PRIVATE(inst);
671 if (priv->dirty)
672 {
673 gchar guidstr[GUID_ENCODING_LENGTH+1];
674 guid_to_string_buff(&priv->guid, guidstr);
675 printf("%s instance %s is dirty.\n", inst->e_type, guidstr);
676 }
677}
#define GUID_ENCODING_LENGTH
Number of characters needed to encode a guid as a string not including the null terminator.
Definition guid.h:84
gchar * guid_to_string_buff(const GncGUID *guid, gchar *str)
The guid_to_string_buff() routine puts a null-terminated string encoding of the id into the memory po...
Definition guid.cpp:208

◆ qof_instance_refers_to_object()

gboolean qof_instance_refers_to_object ( const QofInstance inst,
const QofInstance ref 
)

Does this object refer to a specific object.

Definition at line 890 of file qofinstance.cpp.

891{
892 g_return_val_if_fail( inst != nullptr, FALSE );
893 g_return_val_if_fail( ref != nullptr, FALSE );
894
895 if ( QOF_INSTANCE_GET_CLASS(inst)->refers_to_object != nullptr )
896 {
897 return QOF_INSTANCE_GET_CLASS(inst)->refers_to_object(inst, ref);
898 }
899 else
900 {
901 /* Not implemented - default = NO */
902 return FALSE;
903 }
904}

◆ qof_instance_set()

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.

Definition at line 42 of file gmock-qofinstance.cpp.

43{
44 va_list ap;
45 ASSERT_TRUE (QOF_IS_INSTANCE (inst));
46
47 va_start (ap, first_prop);
48 g_object_set_valist (G_OBJECT (inst), first_prop, ap);
49 va_end (ap);
50}

◆ qof_instance_set_book()

void qof_instance_set_book ( gconstpointer  inst,
QofBook book 
)

Set the book pointer.

Definition at line 529 of file qofinstance.cpp.

530{
531 g_return_if_fail(QOF_IS_INSTANCE(inst));
532 GET_PRIVATE(inst)->book = book;
533}

◆ qof_instance_version_cmp()

int qof_instance_version_cmp ( const QofInstance left,
const QofInstance right 
)

Compare two instances, based on their last update times.

Returns a negative, zero or positive value, respectively, if 'left' is earlier, same as or later than 'right'. Accepts NULL pointers, NULL's are by definition earlier than any value.

Definition at line 616 of file qofinstance.cpp.

617{
618 QofInstancePrivate *lpriv, *rpriv;
619
620 if (!left && !right) return 0;
621 if (!left) return -1;
622 if (!right) return +1;
623
624 lpriv = GET_PRIVATE(left);
625 rpriv = GET_PRIVATE(right);
626 return lpriv->last_update < rpriv->last_update ? -1 :
627 lpriv->last_update > rpriv->last_update ? 1 : 0;
628}

Variable Documentation

◆ e_type

QofIdType QofInstance::e_type

Entity type.

Definition at line 75 of file qofinstance.h.

◆ get_display_name

gchar *(* QofInstanceClass::get_display_name) (const QofInstance *)

Definition at line 84 of file qofinstance.h.

◆ get_typed_referring_object_list

GList *(* QofInstanceClass::get_typed_referring_object_list) (const QofInstance *inst, const QofInstance *ref)

Definition at line 90 of file qofinstance.h.

◆ kvp_data

KvpFrame* QofInstance::kvp_data

Definition at line 76 of file qofinstance.h.

◆ object

GObject QofInstance::object

Definition at line 74 of file qofinstance.h.

◆ parent_class

GObjectClass QofInstanceClass::parent_class

Definition at line 81 of file qofinstance.h.

◆ refers_to_object

gboolean(* QofInstanceClass::refers_to_object) (const QofInstance *inst, const QofInstance *ref)

Definition at line 87 of file qofinstance.h.