QOF
0.7.5
|
Files | |
file | qofinstance.h |
Object instance holds common fields that most QofObjects use. | |
Macros | |
#define | QOF_INSTANCE(object) ((QofInstance *)(object)) |
Typedefs | |
typedef struct QofInstance_s | QofInstance |
Functions | |
void | qof_instance_init (QofInstance *, QofIdType, QofBook *) |
void | qof_instance_release (QofInstance *inst) |
QofBook * | qof_instance_get_book (QofInstance *) |
const GUID * | qof_instance_get_guid (QofInstance *) |
KvpFrame * | qof_instance_get_slots (QofInstance *) |
QofTime * | qof_instance_get_update_time (QofInstance *inst) |
gint | qof_instance_version_cmp (QofInstance *left, QofInstance *right) |
gboolean | qof_instance_is_dirty (QofInstance *) |
void | qof_instance_set_dirty (QofInstance *inst) |
Set the dirty flag. More... | |
gboolean | qof_instance_check_edit (QofInstance *inst) |
gboolean | qof_instance_do_free (QofInstance *inst) |
void | qof_instance_mark_free (QofInstance *inst) |
QofInstance * | qof_instance_create (QofIdType type, QofBook *book) |
void | qof_instance_gemini (QofInstance *to, QofInstance *from) |
QofInstance * | qof_instance_lookup_twin (QofInstance *src, QofBook *book) |
Qof Instances are a derived type of QofEntity. The Instance adds some common features and functions that most objects will want to use.
void qof_instance_gemini | ( | QofInstance * | to, |
QofInstance * | from | ||
) |
Pair things up. This routine inserts a kvp value into each instance containing the guid of the other. In this way, if one has one of the pair, one can always find the other by looking up it's guid. Typically, you will want to use qof_instance_lookup_twin() to find the twin. (The current implementation assumes the two instances belong to different books, and will not add gemini kvp's unless the books differ. Note that the gemini kvp includes the book guid as well, so that the right book can be found.
Definition at line 212 of file qofinstance.c.
QofBook* qof_instance_get_book | ( | QofInstance * | ) |
Return the book pointer
Definition at line 87 of file qofinstance.c.
const GUID* qof_instance_get_guid | ( | QofInstance * | ) |
Return the GUID of this instance
Definition at line 79 of file qofinstance.c.
KvpFrame* qof_instance_get_slots | ( | QofInstance * | ) |
Return the pointer to the kvp_data
Definition at line 95 of file qofinstance.c.
QofTime* qof_instance_get_update_time | ( | QofInstance * | inst | ) |
Return the last time this instance was modified. If QofInstances are used with the QofObject storage backends, then the instance update times are reserved for use by the backend, for managing multi-user updates. Non-backend code should not set the update times.
Definition at line 103 of file qofinstance.c.
void qof_instance_init | ( | QofInstance * | , |
QofIdType | , | ||
QofBook * | |||
) |
gboolean qof_instance_is_dirty | ( | QofInstance * | ) |
QofInstance* qof_instance_lookup_twin | ( | QofInstance * | src, |
QofBook * | book | ||
) |
The qof_instance_lookup_twin() routine will find the "twin" of this instance 'src' in the given other 'book' (if the twin exists).
When instances are gemini'ed or cloned, both of the pair are marked with the guid of thier copy, thus allowing the sibling-copy of an instance to be found. Since the sibling may end up in a different book, we need a way of finding it, given only that we know the book, and that we know its twin.
That's what this routine does. Given some book 'book', and an instance 'src', it will find the sibling instance of 'src' that is in 'book', and return it. If not found, it returns NULL. This routine uses the 'gemini' kvp values to do its work.
Definition at line 234 of file qofinstance.c.
void qof_instance_release | ( | QofInstance * | inst | ) |
release the data associated with this instance. Dont actually free the memory associated with the instance.
Definition at line 69 of file qofinstance.c.
void qof_instance_set_dirty | ( | QofInstance * | inst | ) |
Set the dirty flag.
Sets this instance AND the collection as dirty.
Definition at line 146 of file qofinstance.c.
gint qof_instance_version_cmp | ( | QofInstance * | left, |
QofInstance * | right | ||
) |
Compare two instances, based on thier 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 116 of file qofinstance.c.