From 5b1bb1186f03cc2a7d4efe621409c143d3f49e65 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Fri, 31 May 2024 22:06:55 +0800 Subject: [PATCH] [SX-book.cpp] convert to c++ --- libgnucash/engine/CMakeLists.txt | 2 +- libgnucash/engine/{SX-book.c => SX-book.cpp} | 12 +++++------- po/POTFILES.in | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) rename libgnucash/engine/{SX-book.c => SX-book.cpp} (96%) diff --git a/libgnucash/engine/CMakeLists.txt b/libgnucash/engine/CMakeLists.txt index 07fc821bd0..14ff75425c 100644 --- a/libgnucash/engine/CMakeLists.txt +++ b/libgnucash/engine/CMakeLists.txt @@ -141,7 +141,7 @@ set (engine_SOURCES Recurrence.cpp Query.cpp SchedXaction.c - SX-book.c + SX-book.cpp SX-ttinfo.c Scrub.cpp Scrub2.cpp diff --git a/libgnucash/engine/SX-book.c b/libgnucash/engine/SX-book.cpp similarity index 96% rename from libgnucash/engine/SX-book.c rename to libgnucash/engine/SX-book.cpp index 1aff588358..c3ee94b6d2 100644 --- a/libgnucash/engine/SX-book.c +++ b/libgnucash/engine/SX-book.cpp @@ -58,7 +58,7 @@ static Account * gnc_collection_get_template_root( const QofCollection *col ) { - return qof_collection_get_data (col); + return GNC_ACCOUNT(qof_collection_get_data (col)); } Account * @@ -141,7 +141,7 @@ sxtg_is_dirty(const QofCollection *col) descendants = gnc_account_get_descendants(root); for (node = descendants; node; node = g_list_next(node)) { - if (qof_instance_is_dirty(node->data)) + if (qof_instance_is_dirty(QOF_INSTANCE(node->data))) { dirty = TRUE; break; @@ -195,7 +195,7 @@ static QofObject sxtg_object_def = SchedXactions* gnc_collection_get_schedxactions(const QofCollection *col) { - SchedXactions *rtn = qof_collection_get_data(col); + auto rtn = GNC_SCHEDXACTIONS (qof_collection_get_data(col)); // @@assert(rtn != null); return rtn; } @@ -260,10 +260,9 @@ static void book_sxes_setup(QofBook *book) { QofCollection *col; - SchedXactions *sxes; col = qof_book_get_collection(book, GNC_ID_SCHEDXACTION); - sxes = g_object_new (GNC_TYPE_SCHEDXACTIONS, NULL); + auto sxes = GNC_SCHEDXACTIONS (g_object_new (GNC_TYPE_SCHEDXACTIONS, NULL)); g_assert(sxes); qof_instance_init_data(&sxes->inst, GNC_ID_SXES, book); sxes->sx_list = NULL; @@ -275,10 +274,9 @@ static void book_sxes_end(QofBook* book) { QofCollection *col; - SchedXactions *sxes; col = qof_book_get_collection(book, GNC_ID_SCHEDXACTION); - sxes = qof_collection_get_data(col); + auto sxes = GNC_SCHEDXACTIONS (qof_collection_get_data(col)); if (sxes != NULL) { g_list_free(sxes->sx_list); diff --git a/po/POTFILES.in b/po/POTFILES.in index 7b65ce41ce..c7c246f348 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -691,7 +691,7 @@ libgnucash/engine/ScrubBudget.c libgnucash/engine/ScrubBusiness.c libgnucash/engine/Scrub.cpp libgnucash/engine/Split.cpp -libgnucash/engine/SX-book.c +libgnucash/engine/SX-book.cpp libgnucash/engine/SX-ttinfo.c libgnucash/engine/Transaction.cpp libgnucash/engine/TransLog.cpp