[gnc-budget.cpp] convert to c++

This commit is contained in:
Christopher Lam 2022-01-13 18:10:38 +08:00
parent 8bc080b96d
commit 9088acabd8
4 changed files with 18 additions and 8 deletions

View File

@ -139,7 +139,7 @@ set (engine_SOURCES
cap-gains.c cap-gains.c
cashobjects.c cashobjects.c
gnc-aqbanking-templates.cpp gnc-aqbanking-templates.cpp
gnc-budget.c gnc-budget.cpp
gnc-commodity.c gnc-commodity.c
gnc-date.cpp gnc-date.cpp
gnc-datetime.cpp gnc-datetime.cpp

View File

@ -33,6 +33,7 @@
#include "Account.h" #include "Account.h"
#include "guid.hpp"
#include "gnc-budget.h" #include "gnc-budget.h"
#include "gnc-commodity.h" #include "gnc-commodity.h"
@ -196,7 +197,7 @@ gnc_budget_set_property( GObject* object,
gnc_budget_set_num_periods(budget, g_value_get_uint(value)); gnc_budget_set_num_periods(budget, g_value_get_uint(value));
break; break;
case PROP_RECURRENCE: case PROP_RECURRENCE:
gnc_budget_set_recurrence(budget, g_value_get_pointer(value)); gnc_budget_set_recurrence (budget, static_cast<Recurrence*>(g_value_get_pointer(value)));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
@ -311,12 +312,11 @@ gnc_budget_commit_edit(GncBudget *bgt)
GncBudget* GncBudget*
gnc_budget_new(QofBook *book) gnc_budget_new(QofBook *book)
{ {
GncBudget* budget;
g_return_val_if_fail(book, NULL); g_return_val_if_fail(book, NULL);
ENTER(" "); ENTER(" ");
budget = g_object_new(GNC_TYPE_BUDGET, NULL);
auto budget { static_cast<GncBudget*>(g_object_new(GNC_TYPE_BUDGET, nullptr)) };
qof_instance_init_data (&budget->inst, GNC_ID_BUDGET, book); qof_instance_init_data (&budget->inst, GNC_ID_BUDGET, book);
qof_event_gen( &budget->inst, QOF_EVENT_CREATE , NULL); qof_event_gen( &budget->inst, QOF_EVENT_CREATE , NULL);
@ -773,7 +773,7 @@ get_acct_array (const GncBudget *budget, const Account *account)
GArray *array; GArray *array;
if (!g_hash_table_lookup_extended (priv->acct_hash, account, NULL, if (!g_hash_table_lookup_extended (priv->acct_hash, account, NULL,
(gpointer) &array)) (gpointer*)(&array)))
{ {
array = g_array_sized_new (FALSE, TRUE, sizeof (PeriodData), array = g_array_sized_new (FALSE, TRUE, sizeof (PeriodData),
priv->num_periods); priv->num_periods);
@ -879,7 +879,7 @@ static QofObject budget_object_def =
DI(.interface_version = ) QOF_OBJECT_VERSION, DI(.interface_version = ) QOF_OBJECT_VERSION,
DI(.e_type = ) GNC_ID_BUDGET, DI(.e_type = ) GNC_ID_BUDGET,
DI(.type_label = ) "Budget", DI(.type_label = ) "Budget",
DI(.create = ) (gpointer)gnc_budget_new, DI(.create = ) (void*(*)(QofBook*)) gnc_budget_new,
DI(.book_begin = ) NULL, DI(.book_begin = ) NULL,
DI(.book_end = ) gnc_budget_book_end, DI(.book_end = ) gnc_budget_book_end,
DI(.is_dirty = ) qof_collection_is_dirty, DI(.is_dirty = ) qof_collection_is_dirty,

View File

@ -64,6 +64,11 @@
#ifndef __GNC_BUDGET_H__ #ifndef __GNC_BUDGET_H__
#define __GNC_BUDGET_H__ #define __GNC_BUDGET_H__
#ifdef __cplusplus
extern "C"
{
#endif
#include <glib.h> #include <glib.h>
/** The budget data.*/ /** The budget data.*/
@ -171,6 +176,11 @@ GncBudget* gnc_budget_get_default(QofBook *book);
GncBudget* gnc_budget_lookup (const GncGUID *guid, const QofBook *book); GncBudget* gnc_budget_lookup (const GncGUID *guid, const QofBook *book);
#define gnc_budget_lookup_direct(g,b) gnc_budget_lookup(&(g),(b)) #define gnc_budget_lookup_direct(g,b) gnc_budget_lookup(&(g),(b))
#ifdef __cplusplus
}
#endif
#endif // __BUDGET_H__ #endif // __BUDGET_H__
/** @} */ /** @} */

View File

@ -630,7 +630,7 @@ libgnucash/engine/engine-helpers.c
libgnucash/engine/gncAddress.c libgnucash/engine/gncAddress.c
libgnucash/engine/gnc-aqbanking-templates.cpp libgnucash/engine/gnc-aqbanking-templates.cpp
libgnucash/engine/gncBillTerm.c libgnucash/engine/gncBillTerm.c
libgnucash/engine/gnc-budget.c libgnucash/engine/gnc-budget.cpp
libgnucash/engine/gncBusiness.c libgnucash/engine/gncBusiness.c
libgnucash/engine/gnc-commodity.c libgnucash/engine/gnc-commodity.c
libgnucash/engine/gnc-commodity.h libgnucash/engine/gnc-commodity.h