68 #define QOF_TYPE_BOOK (qof_book_get_type ()) 70 (G_TYPE_CHECK_INSTANCE_CAST ((o), QOF_TYPE_BOOK, QofBook)) 71 #define QOF_BOOK_CLASS(k) \ 72 (G_TYPE_CHECK_CLASS_CAST((k), QOF_TYPE_BOOK, QofBookClass)) 73 #define QOF_IS_BOOK(o) \ 74 (G_TYPE_CHECK_INSTANCE_TYPE ((o), QOF_TYPE_BOOK)) 75 #define QOF_IS_BOOK_CLASS(k) \ 76 (G_TYPE_CHECK_CLASS_TYPE ((k), QOF_TYPE_BOOK)) 77 #define QOF_BOOK_GET_CLASS(o) \ 78 (G_TYPE_INSTANCE_GET_CLASS ((o), QOF_TYPE_BOOK, QofBookClass)) 80 typedef void (*QofBookDirtyCB) (QofBook *, gboolean dirty, gpointer user_data);
82 typedef void (*GncOptionSave) (
GncOptionDB*, QofBook*, gboolean);
83 typedef void (*GncOptionLoad) (
GncOptionDB*, QofBook*);
98 gboolean session_dirty;
107 QofBookDirtyCB dirty_cb;
117 GHashTable * hash_of_collections;
122 GHashTable *data_tables;
125 GHashTable *data_table_finalizers;
144 gboolean shutting_down;
158 gboolean cached_num_field_source;
160 gboolean cached_num_field_source_isvalid;
165 gint cached_num_days_autoreadonly;
167 gboolean cached_num_days_autoreadonly_isvalid;
172 QofInstanceClass parent_class;
175 GType qof_book_get_type(
void);
186 #define QOF_BOOK_RETURN_ENTITY(book,guid,e_type,c_type) { \ 187 QofInstance *val = NULL; \ 188 if ((guid != NULL) && (book != NULL)) { \ 189 const QofCollection *col; \ 190 col = qof_book_get_collection (book, e_type); \ 191 val = qof_collection_lookup_entity (col, guid); \ 193 return (c_type *) val; \ 201 typedef void (*QofBookFinalCB) (QofBook *, gpointer key, gpointer user_data);
378 const char *counter_name);
380 const char* qof_book_get_string_option(
const QofBook* book,
const char* opt_name);
381 void qof_book_set_string_option(QofBook* book,
const char* opt_name,
const char* opt_val);
382 const GncGUID* qof_book_get_guid_option(QofBook* book, GSList* path);
383 void qof_book_option_frame_delete (QofBook *book,
const char* opt_name);
388 void qof_book_unset_feature (QofBook *book,
const gchar *key);
389 void qof_book_set_feature (QofBook *book,
const gchar *key,
const gchar *descr);
391 void qof_book_begin_edit(QofBook *book);
392 void qof_book_commit_edit(QofBook *book);
441 #define qof_book_get_guid(X) qof_entity_get_guid (QOF_INSTANCE(X)) Holds all of the options for a book, report, or stylesheet, organized by GncOptionSections.
API for data storage Backend.
gboolean qof_book_register(void)
Register the book object with the QOF object system.
void qof_book_load_options(QofBook *book, GncOptionLoad load_cb, GncOptionDB *odb)
Load a GncOptionsDB from KVP data.
void qof_book_set_option(QofBook *book, KvpValue *value, GSList *path)
Save a single option value.
void qof_book_set_dirty_cb(QofBook *book, QofBookDirtyCB cb, gpointer user_data)
Set the function to call when a book transitions from clean to dirty, or vice versa.
void(* QofCollectionForeachCB)(QofCollection *, gpointer user_data)
Invoke the indicated callback on each collection in the book.
time64 qof_book_get_session_dirty_time(const QofBook *book)
Retrieve the earliest modification time on the book.
gdouble qof_book_get_default_invoice_report_timeout(const QofBook *book)
Get the length of time available to change the used Invoice Report when printing Invoices.
gchar * qof_book_increment_and_format_counter(QofBook *book, const char *counter_name)
This will increment the named counter for this book and format it.
gint qof_book_get_num_days_autoreadonly(const QofBook *book)
Returns the number of days for auto-read-only transactions.
gboolean qof_book_use_split_action_for_num_field(const QofBook *book)
Returns TRUE if this book uses split action field as the 'Num' field, FALSE if it uses transaction nu...
QofBook * qof_book_new(void)
Allocate, initialise and return a new QofBook.
void qof_book_mark_closed(QofBook *book)
Close a book to editing.
char * qof_book_get_counter_format(const QofBook *book, const char *counter_name)
Get the format string to use for the named counter.
Object instance holds common fields that most gnucash objects use.
void qof_book_mark_readonly(QofBook *book)
Mark the book as read only.
QOF entity type identification system.
GHashTable * qof_book_get_features(QofBook *book)
Access functions for reading and setting the used-features on this book.
gint64 qof_book_get_counter(QofBook *book, const char *counter_name)
This will get the named counter for this book.
gboolean qof_book_empty(const QofBook *book)
Check if the book has had anything loaded into it.
const gchar * QofIdType
QofIdType declaration.
KvpValue * qof_book_get_option(QofBook *book, GSList *path)
Read a single option value.
GDate * qof_book_get_autoreadonly_gdate(const QofBook *book)
Returns the GDate that is the threshold for auto-read-only.
void qof_book_mark_session_saved(QofBook *book)
The qof_book_mark_saved() routine marks the book as having been saved (to a file, to a database)...
void qof_book_set_data_fin(QofBook *book, const gchar *key, gpointer data, QofBookFinalCB)
Same as qof_book_set_data(), except that the callback will be called when the book is destroyed...
void qof_book_options_delete(QofBook *book, GSList *path)
Delete the options.
void qof_book_set_data(QofBook *book, const gchar *key, gpointer data)
The qof_book_set_data() allows arbitrary pointers to structs to be stored in QofBook.
Implements KvpValue using boost::variant.
gchar * qof_book_normalize_counter_format(const gchar *format, gchar **err_msg)
Validate a counter format string.
gboolean qof_book_session_not_saved(const QofBook *book)
qof_book_not_saved() returns the value of the session_dirty flag, set when changes to any object in t...
void qof_book_mark_session_dirty(QofBook *book)
The qof_book_mark_dirty() routine marks the book as having been modified.
void qof_book_set_default_invoice_report(QofBook *book, const gchar *guid, const gchar *name)
Save the Invoice Report name / guid to be used as the default for printing Invoices.
gboolean qof_book_is_readonly(const QofBook *book)
Return whether the book is read only.
gchar * qof_book_get_default_invoice_report_name(const QofBook *book)
Get the name of the Invoice Report to be used as the default for printing Invoices.
GList QofBookList
GList of QofBook.
QofCollection * qof_book_get_collection(const QofBook *, QofIdType)
Return The table of entities of the given type.
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
gboolean qof_book_uses_autoreadonly(const QofBook *book)
Returns TRUE if the auto-read-only feature should be used, otherwise FALSE.
gboolean qof_book_shutting_down(const QofBook *book)
Is the book shutting down?
gchar * qof_book_get_default_invoice_report_guid(const QofBook *book)
Get the guid of the Invoice Report to be used as the default for printing Invoices.
The type used to store guids in C.
gpointer qof_book_get_data(const QofBook *book, const gchar *key)
Retrieves arbitrary pointers to structs stored by qof_book_set_data.
gboolean qof_book_use_trading_accounts(const QofBook *book)
Returns flag indicating whether this book uses trading accounts.
void qof_book_destroy(QofBook *book)
End any editing sessions associated with book, and free all memory associated with it...
void qof_book_save_options(QofBook *book, GncOptionSave save_cb, GncOptionDB *odb, gboolean clear)
Save a GncOptionsDB back to the book's KVP.