Skip to content

Commit

Permalink
[Split.cpp] convert to cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherlam committed Feb 9, 2024
1 parent 698cc23 commit fc5d7f8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion libgnucash/engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ set (engine_SOURCES
Scrub3.c
ScrubBusiness.c
ScrubBudget.c
Split.c
Split.cpp
TransLog.c
Transaction.c
cap-gains.c
Expand Down
24 changes: 12 additions & 12 deletions libgnucash/engine/Split.c → libgnucash/engine/Split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,25 +242,25 @@ gnc_split_set_property(GObject *object,
xaccSplitSetMemo(split, g_value_get_string(value));
break;
case PROP_VALUE:
number = g_value_get_boxed(value);
number = static_cast<gnc_numeric*>(g_value_get_boxed(value));
xaccSplitSetValue(split, *number);
break;
case PROP_AMOUNT:
number = g_value_get_boxed(value);
number = static_cast<gnc_numeric*>(g_value_get_boxed(value));
xaccSplitSetAmount(split, *number);
break;
case PROP_RECONCILE_DATE:
t = g_value_get_boxed(value);
t = static_cast<Time64*>(g_value_get_boxed(value));
xaccSplitSetDateReconciledSecs(split, t->t);
break;
case PROP_TX:
xaccSplitSetParent(split, g_value_get_object(value));
xaccSplitSetParent(split, GNC_TRANSACTION(g_value_get_object(value)));
break;
case PROP_ACCOUNT:
xaccSplitSetAccount(split, g_value_get_object(value));
xaccSplitSetAccount(split, GNC_ACCOUNT(g_value_get_object(value)));
break;
case PROP_LOT:
xaccSplitSetLot(split, g_value_get_object(value));
xaccSplitSetLot(split, GNC_LOT(g_value_get_object(value)));
break;
case PROP_SX_CREDIT_FORMULA:
qof_instance_set_kvp (QOF_INSTANCE (split), value, 2, GNC_SX_ID, GNC_SX_CREDIT_FORMULA);
Expand Down Expand Up @@ -532,7 +532,7 @@ xaccMallocSplit(QofBook *book)
Split *split;
g_return_val_if_fail (book, NULL);

split = g_object_new (GNC_TYPE_SPLIT, NULL);
split = GNC_SPLIT(g_object_new (GNC_TYPE_SPLIT, NULL));
xaccInitSplit (split, book);

return split;
Expand All @@ -550,7 +550,7 @@ xaccMallocSplit(QofBook *book)
Split *
xaccDupeSplit (const Split *s)
{
Split *split = g_object_new (GNC_TYPE_SPLIT, NULL);
Split *split = GNC_SPLIT(g_object_new (GNC_TYPE_SPLIT, NULL));

/* Trash the entity table. We don't want to mistake the cloned
* splits as something official. If we ever use this split, we'll
Expand Down Expand Up @@ -588,7 +588,7 @@ xaccDupeSplit (const Split *s)
Split *
xaccSplitCloneNoKvp (const Split *s)
{
Split *split = g_object_new (GNC_TYPE_SPLIT, NULL);
Split *split = GNC_SPLIT(g_object_new (GNC_TYPE_SPLIT, NULL));

split->parent = NULL;
split->memo = CACHE_INSERT(s->memo);
Expand Down Expand Up @@ -2104,7 +2104,7 @@ xaccSplitGetOtherSplit (const Split *split)

for (GList *n = xaccTransGetSplitList (trans); n; n = n->next)
{
Split *s = n->data;
Split *s = GNC_SPLIT(n->data);
if ((s == split) ||
(!xaccTransStillHasSplit(trans, s)) ||
(xaccAccountGetType (xaccSplitGetAccount (s)) == ACCT_TYPE_TRADING) ||
Expand Down Expand Up @@ -2203,7 +2203,7 @@ static QofObject split_object_def =
DI(.interface_version = ) QOF_OBJECT_VERSION,
DI(.e_type = ) GNC_ID_SPLIT,
DI(.type_label = ) "Split",
DI(.create = ) (gpointer)xaccMallocSplit,
DI(.create = ) (void* (*)(QofBook*))xaccMallocSplit,
DI(.book_begin = ) NULL,
DI(.book_end = ) NULL,
DI(.is_dirty = ) qof_collection_is_dirty,
Expand All @@ -2216,7 +2216,7 @@ static QofObject split_object_def =
static gpointer
split_account_guid_getter (gpointer obj, const QofParam *p)
{
Split *s = obj;
Split *s = GNC_SPLIT(obj);
Account *acc;

if (!s) return NULL;
Expand Down
4 changes: 2 additions & 2 deletions libgnucash/engine/test/utest-Split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <gnc-lot.h>
#include <gnc-event.h>

#if defined(__clang__) && (__clang_major__ == 5 || (__clang_major__ == 3 && __clang_minor__ < 5))
#if defined(__clang__)
#define USE_CLANG_FUNC_SIG 1
#endif

Expand Down Expand Up @@ -1282,7 +1282,7 @@ test_get_corr_account_split (Fixture *fixture, gconstpointer pData)
#ifdef USE_CLANG_FUNC_SIG
#define _func "gboolean get_corr_account_split(const Split *, const Split **)"
#else
#define _func "get_corr_account_split"
#define _func "gboolean get_corr_account_split(const Split*, const Split**)"
#endif
gchar *msg = _func ": assertion 'sa' failed";
#undef _func
Expand Down
2 changes: 1 addition & 1 deletion po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ libgnucash/engine/Scrub3.c
libgnucash/engine/ScrubBudget.c
libgnucash/engine/ScrubBusiness.c
libgnucash/engine/Scrub.c
libgnucash/engine/Split.c
libgnucash/engine/Split.cpp
libgnucash/engine/SX-book.c
libgnucash/engine/SX-ttinfo.c
libgnucash/engine/Transaction.c
Expand Down

0 comments on commit fc5d7f8

Please sign in to comment.