diff --git a/src/engine/GNCId.h b/src/engine/GNCId.h index 6c137addfe..58d742fd75 100644 --- a/src/engine/GNCId.h +++ b/src/engine/GNCId.h @@ -53,6 +53,8 @@ typedef enum GNC_ID_TRANS, GNC_ID_SPLIT, GNC_ID_PRICE, + GNC_ID_BOOK, + GNC_ID_SESSION, GNC_ID_SCHEDXACTION, GNC_ID_FREQSPEC, LAST_GNC_ID = GNC_ID_FREQSPEC diff --git a/src/engine/SchedXaction.c b/src/engine/SchedXaction.c index 7ff5b7eb2b..ca440d7c49 100644 --- a/src/engine/SchedXaction.c +++ b/src/engine/SchedXaction.c @@ -28,8 +28,10 @@ #include "FreqSpec.h" #include "GNCId.h" +#include "Group.h" #include "SX-ttinfo.h" #include "SchedXactionP.h" +#include "Transaction.h" #include "date.h" #include "gnc-book-p.h" #include "gnc-engine.h" diff --git a/src/engine/gnc-book-p.h b/src/engine/gnc-book-p.h index e28b3b5876..c00511a8a7 100644 --- a/src/engine/gnc-book-p.h +++ b/src/engine/gnc-book-p.h @@ -30,17 +30,16 @@ #ifndef GNC_BOOK_P_H #define GNC_BOOK_P_H -#include "BackendP.h" +#include "Backend.h" #include "GNCIdP.h" -#include "DateUtils.h" -#include "TransLog.h" #include "gnc-book.h" -#include "gnc-engine-util.h" #include "gnc-engine.h" -#include "gnc-pricedb-p.h" +#include "kvp_frame.h" struct gnc_book_struct { + kvp_frame *kvp_data; + /* The entity table associates the GUIDs of all the objects * created in the session with their respective objects * (pointer addresses) */ @@ -63,9 +62,10 @@ struct gnc_book_struct Backend *backend; }; - void gnc_book_set_group(GNCBook *book, AccountGroup *grp); void gnc_book_set_pricedb(GNCBook *book, GNCPriceDB *db); +void gnc_book_set_schedxactions( GNCBook *book, GList *newList ); +void gnc_book_set_template_group( GNCBook *book, AccountGroup *templateGroup ); void gnc_book_set_backend (GNCBook *book, Backend *be); diff --git a/src/engine/gnc-book.c b/src/engine/gnc-book.c index d651d9775d..ac7a71af89 100644 --- a/src/engine/gnc-book.c +++ b/src/engine/gnc-book.c @@ -70,6 +70,7 @@ gnc_book_init (GNCBook *book) if (!book) return; book->entity_table = xaccEntityTableNew (); + book->kvp_data = kvp_frame_new (); book->topgroup = xaccMallocAccountGroup(book); book->pricedb = gnc_pricedb_create(); @@ -100,6 +101,13 @@ gnc_book_new (void) /* ---------------------------------------------------------------------- */ +kvp_frame * +gnc_book_get_slots (GNCBook *book) +{ + if (!book) return NULL; + return book->kvp_data; +} + GNCEntityTable * gnc_book_get_entity_table (GNCBook *book) { diff --git a/src/engine/gnc-book.h b/src/engine/gnc-book.h index 189b57867b..0e6f5f383f 100644 --- a/src/engine/gnc-book.h +++ b/src/engine/gnc-book.h @@ -38,28 +38,28 @@ #include "gnc-engine.h" #include "gnc-pricedb.h" +#include "kvp_frame.h" /** PROTOTYPES ******************************************************/ GNCBook * gnc_book_new (void); void gnc_book_destroy (GNCBook *book); +/* The gnc_book_get_slots() method will return the kvp data + * for the book */ +kvp_frame * gnc_book_get_slots (GNCBook *book); + +/* Return the various top-level data structure pointers stored + * in the book. */ AccountGroup *gnc_book_get_group (GNCBook *book); -void gnc_book_set_group(GNCBook *book, AccountGroup *group); GNCPriceDB *gnc_book_get_pricedb (GNCBook *book); - -guint gnc_book_count_transactions(GNCBook *book); - gnc_commodity_table* gnc_book_get_commodity_table(GNCBook *book); /** * Returns the list of scheduled transactions. **/ GList * gnc_book_get_schedxactions( GNCBook *book ); -void gnc_book_set_schedxactions( GNCBook *book, GList *newList ); - AccountGroup *gnc_book_get_template_group( GNCBook *book ); -void gnc_book_set_template_group( GNCBook *book, AccountGroup *templateGroup ); /* * The gnc_book_not_saved() subroutine will return TRUE @@ -71,4 +71,8 @@ gboolean gnc_book_not_saved(GNCBook *book); * in the two given books is equal. */ gboolean gnc_book_equal (GNCBook *book_1, GNCBook *book_2); +/* XXX FIXME count_transactions is a utility function, needs + * to be moved to some utility/support file. */ +guint gnc_book_count_transactions(GNCBook *book); + #endif /* GNC_BOOK_H */ diff --git a/src/engine/gw-engine-spec.scm b/src/engine/gw-engine-spec.scm index 8cd15cccd2..a40de27091 100644 --- a/src/engine/gw-engine-spec.scm +++ b/src/engine/gw-engine-spec.scm @@ -315,6 +315,7 @@ "#include \n" "#include \n" "#include \n" + "#include \n" "#include \n" "#include \n" "#include \n" @@ -1565,6 +1566,7 @@ when no longer needed.") '(( book)) "Get the book's account group.") + ;; XXX FIXME this is a private function, should not be exported publically. (gw:wrap-function mod 'gnc:book-set-group diff --git a/src/engine/test-core/test-engine-stuff.c b/src/engine/test-core/test-engine-stuff.c index 9b18b218d8..89b6d12360 100644 --- a/src/engine/test-core/test-engine-stuff.c +++ b/src/engine/test-core/test-engine-stuff.c @@ -12,6 +12,7 @@ #include "date.h" #include "Group.h" +#include "gnc-book-p.h" #include "gnc-engine.h" #include "gnc-engine-util.h" #include "test-engine-stuff.h" @@ -1442,6 +1443,9 @@ get_random_book (void) book = gnc_book_new (); + /* XXX fixme -- gnc_book_set_group is a private engine function, + * it should not be invoked in ordinary test cases. Its should + * be more like make_random_pricedb below... */ gnc_book_set_group (book, get_random_group (book)); make_random_pricedb (book, gnc_book_get_pricedb (book)); @@ -1459,6 +1463,9 @@ get_random_session (void) book = gnc_session_get_book (session); + /* XXX fixme -- gnc_book_set_group is a private engine function, + * it should not be invoked in ordinary test cases. Its should + * be more like make_random_pricedb below... */ gnc_book_set_group (book, get_random_group (book)); make_random_pricedb (book, gnc_book_get_pricedb (book)); diff --git a/src/engine/test/test-group-vs-book.c b/src/engine/test/test-group-vs-book.c index 98b165bab6..b47de8b4c3 100644 --- a/src/engine/test/test-group-vs-book.c +++ b/src/engine/test/test-group-vs-book.c @@ -6,6 +6,7 @@ #include "GNCIdP.h" #include "TransLog.h" #include "gnc-book.h" +#include "gnc-book-p.h" #include "gnc-engine.h" #include "gnc-module.h" #include "test-engine-stuff.h" @@ -67,6 +68,9 @@ run_test (void) exit(get_rv()); } + /* ???????? this test seems to be testing routines that + * are private to the engine, not sure why. book_set_group + * should not be called publically. */ gnc_book_set_group (book, group1); if (!group_has_book (group1, book)) {