mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add 'const' qualifier to Account pointers in the Account api.
Including necessary related changes to functions passed accounts from the account functions. Interestingly, the only g-wrap function that complained about the new const function arguments was xaccAccountOrder(), the only one using const Account ** types. It seems very uncommon to express const-ness in g-wrap for any types other than gw:mchar. Actually I couldn't find any other examples, anywhere, so I had to guess at the syntax, but it works. Oh, and one or two minor tweaks like my last commit snuck in, too. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12201 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -47,7 +47,7 @@ static QofLogModule log_module = GNC_MOD_ACCOUNT;
|
||||
* of the internals of the Account in one file. *
|
||||
\********************************************************************/
|
||||
|
||||
static void xaccAccountBringUpToDate (Account *ac);
|
||||
static void xaccAccountBringUpToDate (Account *acc);
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
@@ -391,7 +391,7 @@ xaccAccountSetVersion (Account *acc, gint32 vers)
|
||||
}
|
||||
|
||||
gint32
|
||||
xaccAccountGetVersion (Account *acc)
|
||||
xaccAccountGetVersion (const Account *acc)
|
||||
{
|
||||
if (!acc) return 0;
|
||||
return (acc->version);
|
||||
@@ -401,7 +401,7 @@ xaccAccountGetVersion (Account *acc)
|
||||
\********************************************************************/
|
||||
|
||||
gboolean
|
||||
xaccAccountEqual(Account *aa, Account *ab, gboolean check_guids)
|
||||
xaccAccountEqual(const Account *aa, const Account *ab, gboolean check_guids)
|
||||
{
|
||||
if(!aa && !ab) return TRUE;
|
||||
|
||||
@@ -625,12 +625,9 @@ split_sort_func(gconstpointer a, gconstpointer b) {
|
||||
void
|
||||
xaccAccountSortSplits (Account *acc, gboolean force)
|
||||
{
|
||||
if(!acc) return;
|
||||
if(!acc->sort_dirty) return;
|
||||
if(!force && acc->inst.editlevel > 0) return;
|
||||
if (!acc || !acc->sort_dirty || (!force && acc->inst.editlevel > 0)) return;
|
||||
|
||||
acc->splits = g_list_sort(acc->splits, split_sort_func);
|
||||
|
||||
acc->sort_dirty = FALSE;
|
||||
acc->balance_dirty = TRUE;
|
||||
}
|
||||
@@ -638,7 +635,7 @@ xaccAccountSortSplits (Account *acc, gboolean force)
|
||||
static void
|
||||
xaccAccountBringUpToDate(Account *acc)
|
||||
{
|
||||
if(!acc) return;
|
||||
if (!acc) return;
|
||||
|
||||
/* if a re-sort happens here, then everything will update, so the
|
||||
cost basis and balance calls are no-ops */
|
||||
@@ -678,17 +675,16 @@ xaccAccountLookup (const GUID *guid, QofBook *book)
|
||||
\********************************************************************/
|
||||
|
||||
short
|
||||
xaccAccountGetMark (Account *acc)
|
||||
xaccAccountGetMark (const Account *acc)
|
||||
{
|
||||
if (!acc) return 0;
|
||||
return acc->mark;
|
||||
return acc ? acc->mark : 0;
|
||||
}
|
||||
|
||||
void
|
||||
xaccAccountSetMark (Account *acc, short m)
|
||||
{
|
||||
if (!acc) return;
|
||||
acc->mark = m;
|
||||
if (acc)
|
||||
acc->mark = m;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1168,7 +1164,7 @@ static int revorder[NUM_ACCOUNT_TYPES] = {
|
||||
|
||||
|
||||
int
|
||||
xaccAccountOrder (Account **aa, Account **ab)
|
||||
xaccAccountOrder (const Account **aa, const Account **ab)
|
||||
{
|
||||
char *da, *db;
|
||||
char *endptr = NULL;
|
||||
@@ -1433,37 +1429,37 @@ DxaccAccountSetCurrency (Account * acc, gnc_commodity * currency)
|
||||
\********************************************************************/
|
||||
|
||||
AccountGroup *
|
||||
xaccAccountGetChildren (Account *acc)
|
||||
xaccAccountGetChildren (const Account *acc)
|
||||
{
|
||||
return acc ? acc->children : NULL;
|
||||
}
|
||||
|
||||
AccountGroup *
|
||||
xaccAccountGetParent (Account *acc)
|
||||
xaccAccountGetParent (const Account *acc)
|
||||
{
|
||||
return acc ? acc->parent : NULL;
|
||||
}
|
||||
|
||||
Account *
|
||||
xaccAccountGetParentAccount (Account * acc)
|
||||
xaccAccountGetParentAccount (const Account * acc)
|
||||
{
|
||||
return acc ? xaccGroupGetParentAccount(acc->parent) : NULL;
|
||||
}
|
||||
|
||||
GList *
|
||||
xaccAccountGetDescendants (Account *acc)
|
||||
xaccAccountGetDescendants (const Account *acc)
|
||||
{
|
||||
return acc ? xaccGroupGetSubAccounts(acc->children) : NULL;
|
||||
}
|
||||
|
||||
GNCAccountType
|
||||
xaccAccountGetType (Account *acc)
|
||||
xaccAccountGetType (const Account *acc)
|
||||
{
|
||||
return acc ? acc->type : NO_TYPE;
|
||||
}
|
||||
|
||||
static const char*
|
||||
qofAccountGetTypeString (Account *acc)
|
||||
qofAccountGetTypeString (const Account *acc)
|
||||
{
|
||||
return acc ? xaccAccountTypeEnumAsString(acc->type) : NULL;
|
||||
}
|
||||
@@ -1475,15 +1471,15 @@ qofAccountSetType (Account *acc, const char *type_string)
|
||||
}
|
||||
|
||||
const char *
|
||||
xaccAccountGetName (Account *acc)
|
||||
xaccAccountGetName (const Account *acc)
|
||||
{
|
||||
return acc ? acc->accountName : NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
xaccAccountGetFullName(Account *account, const char separator)
|
||||
xaccAccountGetFullName(const Account *account, const char separator)
|
||||
{
|
||||
Account *a;
|
||||
const Account *a;
|
||||
char *fullname;
|
||||
const char *name;
|
||||
char *p;
|
||||
@@ -1536,19 +1532,19 @@ xaccAccountGetFullName(Account *account, const char separator)
|
||||
}
|
||||
|
||||
const char *
|
||||
xaccAccountGetCode (Account *acc)
|
||||
xaccAccountGetCode (const Account *acc)
|
||||
{
|
||||
return acc ? acc->accountCode : NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
xaccAccountGetDescription (Account *acc)
|
||||
xaccAccountGetDescription (const Account *acc)
|
||||
{
|
||||
return acc ? acc->description : NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
xaccAccountGetNotes (Account *acc)
|
||||
xaccAccountGetNotes (const Account *acc)
|
||||
{
|
||||
return acc ? kvp_frame_get_string(acc->inst.kvp_data, "notes") : NULL;
|
||||
}
|
||||
@@ -1580,25 +1576,25 @@ xaccAccountGetCommodity (const Account *acc)
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetBalance (Account *acc)
|
||||
xaccAccountGetBalance (const Account *acc)
|
||||
{
|
||||
return acc ? acc->balance : gnc_numeric_zero();
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetClearedBalance (Account *acc)
|
||||
xaccAccountGetClearedBalance (const Account *acc)
|
||||
{
|
||||
return acc ? acc->cleared_balance : gnc_numeric_zero();
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetReconciledBalance (Account *acc)
|
||||
xaccAccountGetReconciledBalance (const Account *acc)
|
||||
{
|
||||
return acc ? acc->reconciled_balance : gnc_numeric_zero();
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetProjectedMinimumBalance (Account *acc)
|
||||
xaccAccountGetProjectedMinimumBalance (const Account *acc)
|
||||
{
|
||||
GList *node;
|
||||
time_t today;
|
||||
@@ -1707,7 +1703,7 @@ xaccAccountGetBalanceAsOfDate (Account *acc, time_t date)
|
||||
* one that walks from the tail of the split list.
|
||||
*/
|
||||
gnc_numeric
|
||||
xaccAccountGetPresentBalance (Account *acc)
|
||||
xaccAccountGetPresentBalance (const Account *acc)
|
||||
{
|
||||
GList *node;
|
||||
time_t today;
|
||||
@@ -1737,7 +1733,7 @@ xaccAccountGetPresentBalance (Account *acc)
|
||||
* Convert a balance from one currency to another.
|
||||
*/
|
||||
gnc_numeric
|
||||
xaccAccountConvertBalanceToCurrency(Account *account, /* for book */
|
||||
xaccAccountConvertBalanceToCurrency(const Account *acc, /* for book */
|
||||
gnc_numeric balance,
|
||||
gnc_commodity *balance_currency,
|
||||
gnc_commodity *new_currency)
|
||||
@@ -1749,7 +1745,7 @@ xaccAccountConvertBalanceToCurrency(Account *account, /* for book */
|
||||
gnc_commodity_equiv (balance_currency, new_currency))
|
||||
return balance;
|
||||
|
||||
book = xaccGroupGetBook (xaccAccountGetRoot (account));
|
||||
book = xaccGroupGetBook (xaccAccountGetRoot (acc));
|
||||
pdb = gnc_pricedb_get_db (book);
|
||||
|
||||
balance = gnc_pricedb_convert_balance_latest_price(
|
||||
@@ -1763,7 +1759,7 @@ xaccAccountConvertBalanceToCurrency(Account *account, /* for book */
|
||||
* a given date.
|
||||
*/
|
||||
gnc_numeric
|
||||
xaccAccountConvertBalanceToCurrencyAsOfDate(Account *account, /* for book */
|
||||
xaccAccountConvertBalanceToCurrencyAsOfDate(const Account *acc, /* for book */
|
||||
gnc_numeric balance,
|
||||
gnc_commodity *balance_currency,
|
||||
gnc_commodity *new_currency,
|
||||
@@ -1777,7 +1773,7 @@ xaccAccountConvertBalanceToCurrencyAsOfDate(Account *account, /* for book */
|
||||
gnc_commodity_equiv (balance_currency, new_currency))
|
||||
return balance;
|
||||
|
||||
book = xaccGroupGetBook (xaccAccountGetRoot (account));
|
||||
book = xaccGroupGetBook (xaccAccountGetRoot (acc));
|
||||
pdb = gnc_book_get_pricedb (book);
|
||||
|
||||
ts.tv_sec = date;
|
||||
@@ -1795,7 +1791,7 @@ xaccAccountConvertBalanceToCurrencyAsOfDate(Account *account, /* for book */
|
||||
* currency.
|
||||
*/
|
||||
static gnc_numeric
|
||||
xaccAccountGetXxxBalanceInCurrency (Account *acc,
|
||||
xaccAccountGetXxxBalanceInCurrency (const Account *acc,
|
||||
xaccGetBalanceFn fn,
|
||||
gnc_commodity *report_currency)
|
||||
{
|
||||
@@ -1880,7 +1876,7 @@ xaccAccountBalanceAsOfDateHelper (Account *acc, gpointer data)
|
||||
* If 'include_children' is FALSE, this function doesn't recurse at all.
|
||||
*/
|
||||
static gnc_numeric
|
||||
xaccAccountGetXxxBalanceInCurrencyRecursive (Account *acc,
|
||||
xaccAccountGetXxxBalanceInCurrencyRecursive (const Account *acc,
|
||||
xaccGetBalanceFn fn,
|
||||
gnc_commodity *report_commodity,
|
||||
gboolean include_children)
|
||||
@@ -1895,8 +1891,7 @@ xaccAccountGetXxxBalanceInCurrencyRecursive (Account *acc,
|
||||
|
||||
/* If needed, sum up the children converting to the *requested*
|
||||
commodity. */
|
||||
if (include_children)
|
||||
{
|
||||
if (include_children) {
|
||||
CurrencyBalance cb = { report_commodity, balance, fn, NULL, 0 };
|
||||
|
||||
xaccGroupForEachAccount (acc->children, xaccAccountBalanceHelper,
|
||||
@@ -1935,7 +1930,8 @@ xaccAccountGetXxxBalanceAsOfDateInCurrencyRecursive (
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetBalanceInCurrency (Account *acc, gnc_commodity *report_commodity,
|
||||
xaccAccountGetBalanceInCurrency (const Account *acc,
|
||||
gnc_commodity *report_commodity,
|
||||
gboolean include_children)
|
||||
{
|
||||
gnc_numeric rc;
|
||||
@@ -1947,7 +1943,7 @@ xaccAccountGetBalanceInCurrency (Account *acc, gnc_commodity *report_commodity,
|
||||
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetClearedBalanceInCurrency (Account *acc,
|
||||
xaccAccountGetClearedBalanceInCurrency (const Account *acc,
|
||||
gnc_commodity *report_commodity,
|
||||
gboolean include_children)
|
||||
{
|
||||
@@ -1958,9 +1954,9 @@ xaccAccountGetClearedBalanceInCurrency (Account *acc,
|
||||
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetReconciledBalanceInCurrency (Account *acc,
|
||||
gnc_commodity *report_commodity,
|
||||
gboolean include_children)
|
||||
xaccAccountGetReconciledBalanceInCurrency (const Account *acc,
|
||||
gnc_commodity *report_commodity,
|
||||
gboolean include_children)
|
||||
{
|
||||
return xaccAccountGetXxxBalanceInCurrencyRecursive (
|
||||
acc, xaccAccountGetReconciledBalance, report_commodity,
|
||||
@@ -1968,7 +1964,7 @@ xaccAccountGetReconciledBalanceInCurrency (Account *acc,
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetPresentBalanceInCurrency (Account *acc,
|
||||
xaccAccountGetPresentBalanceInCurrency (const Account *acc,
|
||||
gnc_commodity *report_commodity,
|
||||
gboolean include_children)
|
||||
{
|
||||
@@ -1979,7 +1975,7 @@ xaccAccountGetPresentBalanceInCurrency (Account *acc,
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetProjectedMinimumBalanceInCurrency (
|
||||
Account *acc, gnc_commodity *report_commodity,
|
||||
const Account *acc, gnc_commodity *report_commodity,
|
||||
gboolean include_children)
|
||||
{
|
||||
return xaccAccountGetXxxBalanceInCurrencyRecursive (
|
||||
@@ -2001,22 +1997,22 @@ xaccAccountGetBalanceAsOfDateInCurrency(
|
||||
\********************************************************************/
|
||||
|
||||
SplitList *
|
||||
xaccAccountGetSplitList (Account *acc)
|
||||
xaccAccountGetSplitList (const Account *acc)
|
||||
{
|
||||
return acc ? acc->splits : NULL;
|
||||
}
|
||||
|
||||
LotList *
|
||||
xaccAccountGetLotList (Account *acc)
|
||||
xaccAccountGetLotList (const Account *acc)
|
||||
{
|
||||
return acc ? acc->lots : NULL;
|
||||
}
|
||||
|
||||
LotList *
|
||||
xaccAccountFindOpenLots (Account *acc,
|
||||
gboolean (*match_func)(GNCLot *lot,
|
||||
gpointer user_data),
|
||||
gpointer user_data, GCompareFunc sort_func)
|
||||
xaccAccountFindOpenLots (const Account *acc,
|
||||
gboolean (*match_func)(GNCLot *lot,
|
||||
gpointer user_data),
|
||||
gpointer user_data, GCompareFunc sort_func)
|
||||
{
|
||||
GList *lot_list;
|
||||
GList *retval = NULL;
|
||||
@@ -2046,7 +2042,7 @@ xaccAccountFindOpenLots (Account *acc,
|
||||
}
|
||||
|
||||
gpointer
|
||||
xaccAccountForEachLot(Account *acc,
|
||||
xaccAccountForEachLot(const Account *acc,
|
||||
gpointer (*proc)(GNCLot *lot, void *data), void *data)
|
||||
{
|
||||
LotList *node;
|
||||
@@ -2066,7 +2062,7 @@ xaccAccountForEachLot(Account *acc,
|
||||
|
||||
/* These functions use interchange gint64 and gboolean. Is that right? */
|
||||
gboolean
|
||||
xaccAccountGetTaxRelated (Account *acc)
|
||||
xaccAccountGetTaxRelated (const Account *acc)
|
||||
{
|
||||
return acc ? kvp_frame_get_gint64(acc->inst.kvp_data, "tax-related") : FALSE;
|
||||
}
|
||||
@@ -2091,7 +2087,7 @@ xaccAccountSetTaxRelated (Account *acc, gboolean tax_related)
|
||||
}
|
||||
|
||||
const char *
|
||||
xaccAccountGetTaxUSCode (Account *acc)
|
||||
xaccAccountGetTaxUSCode (const Account *acc)
|
||||
{
|
||||
return acc ? kvp_frame_get_string(acc->inst.kvp_data, "tax-US/code") : NULL;
|
||||
}
|
||||
@@ -2108,7 +2104,7 @@ xaccAccountSetTaxUSCode (Account *acc, const char *code)
|
||||
}
|
||||
|
||||
const char *
|
||||
xaccAccountGetTaxUSPayerNameSource (Account *acc)
|
||||
xaccAccountGetTaxUSPayerNameSource (const Account *acc)
|
||||
{
|
||||
return acc ? kvp_frame_get_string(acc->inst.kvp_data,
|
||||
"tax-US/payer-name-source") : NULL;
|
||||
@@ -2130,7 +2126,7 @@ xaccAccountSetTaxUSPayerNameSource (Account *acc, const char *source)
|
||||
\********************************************************************/
|
||||
|
||||
gboolean
|
||||
xaccAccountGetPlaceholder (Account *acc)
|
||||
xaccAccountGetPlaceholder (const Account *acc)
|
||||
{
|
||||
char *str;
|
||||
if (!acc) return FALSE;
|
||||
@@ -2152,7 +2148,7 @@ xaccAccountSetPlaceholder (Account *acc, gboolean val)
|
||||
}
|
||||
|
||||
GNCPlaceholderType
|
||||
xaccAccountGetDescendantPlaceholder (Account *acc)
|
||||
xaccAccountGetDescendantPlaceholder (const Account *acc)
|
||||
{
|
||||
GList *descendants, *node;
|
||||
GNCPlaceholderType ret = PLACEHOLDER_NONE;
|
||||
@@ -2175,9 +2171,9 @@ xaccAccountGetDescendantPlaceholder (Account *acc)
|
||||
\********************************************************************/
|
||||
|
||||
gboolean
|
||||
xaccAccountHasAncestor (Account *acc, Account * ancestor)
|
||||
xaccAccountHasAncestor (const Account *acc, const Account * ancestor)
|
||||
{
|
||||
Account *parent = acc;
|
||||
const Account *parent = acc;
|
||||
|
||||
if (!acc || !ancestor) return FALSE;
|
||||
|
||||
@@ -2374,7 +2370,7 @@ xaccAccountTypesCompatible (GNCAccountType parent_type,
|
||||
\********************************************************************/
|
||||
|
||||
gboolean
|
||||
xaccAccountGetReconcileLastDate (Account *acc, time_t *last_date)
|
||||
xaccAccountGetReconcileLastDate (const Account *acc, time_t *last_date)
|
||||
{
|
||||
KvpValue *v;
|
||||
|
||||
@@ -2410,7 +2406,8 @@ xaccAccountSetReconcileLastDate (Account *acc, time_t last_date)
|
||||
\********************************************************************/
|
||||
|
||||
gboolean
|
||||
xaccAccountGetReconcileLastInterval (Account *acc, int *months, int *days)
|
||||
xaccAccountGetReconcileLastInterval (const Account *acc,
|
||||
int *months, int *days)
|
||||
{
|
||||
KvpValue *v1, *v2;
|
||||
|
||||
@@ -2457,7 +2454,7 @@ xaccAccountSetReconcileLastInterval (Account *acc, int months, int days)
|
||||
\********************************************************************/
|
||||
|
||||
gboolean
|
||||
xaccAccountGetReconcilePostponeDate (Account *acc, time_t *postpone_date)
|
||||
xaccAccountGetReconcilePostponeDate (const Account *acc, time_t *postpone_date)
|
||||
{
|
||||
KvpValue *v;
|
||||
|
||||
@@ -2494,7 +2491,8 @@ xaccAccountSetReconcilePostponeDate (Account *acc, time_t postpone_date)
|
||||
\********************************************************************/
|
||||
|
||||
gboolean
|
||||
xaccAccountGetReconcilePostponeBalance (Account *acc, gnc_numeric *balance)
|
||||
xaccAccountGetReconcilePostponeBalance (const Account *acc,
|
||||
gnc_numeric *balance)
|
||||
{
|
||||
KvpValue *v;
|
||||
|
||||
@@ -2549,7 +2547,7 @@ xaccAccountClearReconcilePostpone (Account *acc)
|
||||
* If it is not defined for the account, return the default value.
|
||||
*/
|
||||
gboolean
|
||||
xaccAccountGetAutoInterestXfer (Account *acc, gboolean default_value)
|
||||
xaccAccountGetAutoInterestXfer (const Account *acc, gboolean default_value)
|
||||
{
|
||||
char *str = NULL;
|
||||
if (!acc) return default_value;
|
||||
@@ -2580,7 +2578,7 @@ xaccAccountSetAutoInterestXfer (Account *acc, gboolean option)
|
||||
\********************************************************************/
|
||||
|
||||
const char *
|
||||
xaccAccountGetLastNum (Account *acc)
|
||||
xaccAccountGetLastNum (const Account *acc)
|
||||
{
|
||||
return acc ? kvp_frame_get_string(acc->inst.kvp_data, "last-num") : NULL;
|
||||
}
|
||||
@@ -2626,7 +2624,7 @@ dxaccAccountSetPriceSrc(Account *acc, const char *src)
|
||||
\********************************************************************/
|
||||
|
||||
const char*
|
||||
dxaccAccountGetPriceSrc(Account *acc)
|
||||
dxaccAccountGetPriceSrc(const Account *acc)
|
||||
{
|
||||
GNCAccountType t;
|
||||
if(!acc) return NULL;
|
||||
@@ -2667,7 +2665,7 @@ dxaccAccountSetQuoteTZ(Account *acc, const char *tz)
|
||||
\********************************************************************/
|
||||
|
||||
const char*
|
||||
dxaccAccountGetQuoteTZ(Account *acc)
|
||||
dxaccAccountGetQuoteTZ(const Account *acc)
|
||||
{
|
||||
GNCAccountType t;
|
||||
if(!acc) return NULL;
|
||||
@@ -2702,7 +2700,7 @@ xaccAccountSetReconcileChildrenStatus(Account *acc, gboolean status)
|
||||
\********************************************************************/
|
||||
|
||||
gboolean
|
||||
xaccAccountGetReconcileChildrenStatus(Account *acc)
|
||||
xaccAccountGetReconcileChildrenStatus(const Account *acc)
|
||||
{
|
||||
/* access the account's kvp-data for status and return that, if no value
|
||||
* is found then we can assume not to include the children, that being
|
||||
@@ -2716,7 +2714,7 @@ xaccAccountGetReconcileChildrenStatus(Account *acc)
|
||||
\********************************************************************/
|
||||
|
||||
gint
|
||||
xaccAccountForEachTransaction(Account *acc, TransactionCallback proc,
|
||||
xaccAccountForEachTransaction(const Account *acc, TransactionCallback proc,
|
||||
void *data)
|
||||
{
|
||||
if (!acc || !proc) return 0;
|
||||
@@ -2733,7 +2731,7 @@ xaccAccountForEachTransaction(Account *acc, TransactionCallback proc,
|
||||
* passed.
|
||||
*/
|
||||
static void
|
||||
finder_help_function(Account *acc, const char *description,
|
||||
finder_help_function(const Account *acc, const char *description,
|
||||
Split **split, Transaction **trans )
|
||||
{
|
||||
GList *slp;
|
||||
@@ -2762,7 +2760,7 @@ finder_help_function(Account *acc, const char *description,
|
||||
}
|
||||
|
||||
Split *
|
||||
xaccAccountFindSplitByDesc(Account *acc, const char *description)
|
||||
xaccAccountFindSplitByDesc(const Account *acc, const char *description)
|
||||
{
|
||||
Split *split;
|
||||
|
||||
@@ -2777,7 +2775,7 @@ xaccAccountFindSplitByDesc(Account *acc, const char *description)
|
||||
* auto-filling in registers with a default leading account. The
|
||||
* dest_trans is a transaction used for currency checking. */
|
||||
Transaction *
|
||||
xaccAccountFindTransByDesc(Account *acc, const char *description)
|
||||
xaccAccountFindTransByDesc(const Account *acc, const char *description)
|
||||
{
|
||||
Transaction *trans;
|
||||
|
||||
|
||||
@@ -48,10 +48,10 @@
|
||||
#include "qof.h"
|
||||
#include "gnc-engine.h"
|
||||
|
||||
typedef gnc_numeric (*xaccGetBalanceFn)( Account *account );
|
||||
typedef gnc_numeric (*xaccGetBalanceFn)( const Account *account );
|
||||
|
||||
typedef gnc_numeric (*xaccGetBalanceInCurrencyFn) (
|
||||
Account *account, gnc_commodity *report_commodity,
|
||||
const Account *account, gnc_commodity *report_commodity,
|
||||
gboolean include_children);
|
||||
|
||||
typedef gnc_numeric (*xaccGetBalanceAsOfDateFn) (
|
||||
@@ -124,7 +124,7 @@ typedef enum
|
||||
@{ */
|
||||
|
||||
/** Constructor */
|
||||
Account * xaccMallocAccount (QofBook *book);
|
||||
Account * xaccMallocAccount (QofBook *book);
|
||||
|
||||
/** The xaccCloneAccount() does the same as xaccCloneAccountSimple(),
|
||||
* except that it also also places a pair of GUID-pointers
|
||||
@@ -132,7 +132,7 @@ Account * xaccMallocAccount (QofBook *book);
|
||||
* The guid pointers are stored under the under the kvp
|
||||
* path "gemini".
|
||||
*/
|
||||
Account * xaccCloneAccount (const Account *from, QofBook *book);
|
||||
Account * xaccCloneAccount (const Account *from, QofBook *book);
|
||||
|
||||
/** The xaccCloneAccountSimple() routine makes a simple copy of the
|
||||
* indicated account, placing it in the indicated book. It copies
|
||||
@@ -144,23 +144,24 @@ Account * xaccCloneAccount (const Account *from, QofBook *book);
|
||||
* Note that this routines does *NOT* use the 'gemini' kvp value
|
||||
* to indicate where it was copied from.
|
||||
*/
|
||||
Account * xaccCloneAccountSimple (const Account *from, QofBook *book);
|
||||
Account * xaccCloneAccountSimple (const Account *from, QofBook *book);
|
||||
|
||||
/** The xaccAccountBeginEdit() subroutine is the first phase of
|
||||
* a two-phase-commit wrapper for account updates. */
|
||||
void xaccAccountBeginEdit (Account *account);
|
||||
void xaccAccountBeginEdit (Account *account);
|
||||
|
||||
/** ThexaccAccountCommitEdit() subroutine is the second phase of
|
||||
* a two-phase-commit wrapper for account updates. */
|
||||
void xaccAccountCommitEdit (Account *account);
|
||||
void xaccAccountCommitEdit (Account *account);
|
||||
|
||||
/** The xaccAccountDestroy() routine can be used to get rid of an
|
||||
* account. The account should have been opened for editing
|
||||
* (by calling xaccAccountBeginEdit()) before calling this routine.*/
|
||||
void xaccAccountDestroy (Account *account);
|
||||
void xaccAccountDestroy (Account *account);
|
||||
|
||||
/** Compare two accounts for equality - this is a deep compare. */
|
||||
gboolean xaccAccountEqual(Account *a, Account* b, gboolean check_guids);
|
||||
gboolean xaccAccountEqual(const Account *a, const Account* b,
|
||||
gboolean check_guids);
|
||||
|
||||
/** The xaccAccountOrder() subroutine defines a sorting order
|
||||
* on accounts. It takes pointers to two accounts, and
|
||||
@@ -170,7 +171,7 @@ gboolean xaccAccountEqual(Account *a, Account* b, gboolean check_guids);
|
||||
* the account codes are compared, and if these are equal, then
|
||||
* account types, and, if these are equal, the account names.
|
||||
*/
|
||||
int xaccAccountOrder (Account **account_1, Account **account_2);
|
||||
int xaccAccountOrder (const Account **account_1, const Account **account_2);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -187,8 +188,8 @@ int xaccAccountOrder (Account **account_1, Account **account_2);
|
||||
/** The xaccAccountLookup() subroutine will return the
|
||||
* account associated with the given id, or NULL
|
||||
* if there is no such account. */
|
||||
Account * xaccAccountLookup (const GUID *guid, QofBook *book);
|
||||
#define xaccAccountLookupDirect(g,b) xaccAccountLookup(&(g),b)
|
||||
Account * xaccAccountLookup (const GUID *guid, QofBook *book);
|
||||
#define xaccAccountLookupDirect(g,b) xaccAccountLookup(&(g),b)
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -210,18 +211,18 @@ void xaccAccountSetNotes (Account *account, const char *notes);
|
||||
/** Set the last num field of an Account */
|
||||
void xaccAccountSetLastNum (Account *account, const char *num);
|
||||
/** Set the account's type */
|
||||
GNCAccountType xaccAccountGetType (Account *account);
|
||||
GNCAccountType xaccAccountGetType (const Account *account);
|
||||
|
||||
/** Get the account's name */
|
||||
const char * xaccAccountGetName (Account *account);
|
||||
const char * xaccAccountGetName (const Account *account);
|
||||
/** Get the account's accounting code */
|
||||
const char * xaccAccountGetCode (Account *account);
|
||||
const char * xaccAccountGetCode (const Account *account);
|
||||
/** Get the account's description */
|
||||
const char * xaccAccountGetDescription (Account *account);
|
||||
const char * xaccAccountGetDescription (const Account *account);
|
||||
/** Get the account's notes */
|
||||
const char * xaccAccountGetNotes (Account *account);
|
||||
const char * xaccAccountGetNotes (const Account *account);
|
||||
/** Get the last num field of an Account */
|
||||
const char * xaccAccountGetLastNum (Account *account);
|
||||
const char * xaccAccountGetLastNum (const Account *account);
|
||||
|
||||
/** The xaccAccountGetFullName routine returns the fully qualified name
|
||||
* of the account using the given separator char. The name must be
|
||||
@@ -236,7 +237,7 @@ const char * xaccAccountGetLastNum (Account *account);
|
||||
* hack alert -- since it breaks the rule of string allocation, maybe this
|
||||
* routine should not be in this library, but some utility library?
|
||||
*/
|
||||
char * xaccAccountGetFullName (Account *account, const char separator);
|
||||
char * xaccAccountGetFullName (const Account *account, const char separator);
|
||||
|
||||
/** Set a string that identifies the Finance::Quote backend that
|
||||
* should be used to retrieve online prices. See price-quotes.scm
|
||||
@@ -244,25 +245,26 @@ char * xaccAccountGetFullName (Account *account, const char separator);
|
||||
*
|
||||
* @deprecated Price quote information is now stored on the
|
||||
* commodity, not the account. */
|
||||
void dxaccAccountSetPriceSrc (Account *account, const char *src);
|
||||
void dxaccAccountSetPriceSrc (Account *account, const char *src);
|
||||
/** Get a string that identifies the Finance::Quote backend that
|
||||
* should be used to retrieve online prices. See price-quotes.scm
|
||||
* for more information.
|
||||
*
|
||||
* @deprecated Price quote information is now stored on the
|
||||
* commodity, not the account. */
|
||||
const char * dxaccAccountGetPriceSrc (Account *account);
|
||||
const char * dxaccAccountGetPriceSrc (const Account *account);
|
||||
|
||||
/** Returns a per-account flag: Prior to reconciling an account which
|
||||
charges or pays interest, this flag tells whether to prompt the
|
||||
user to enter a transaction for the interest charge or
|
||||
payment. This per-account flag overrides the global preference. */
|
||||
gboolean xaccAccountGetAutoInterestXfer (Account *account, gboolean default_value);
|
||||
gboolean xaccAccountGetAutoInterestXfer (const Account *account,
|
||||
gboolean default_value);
|
||||
/** Sets a per-account flag: Prior to reconciling an account which
|
||||
charges or pays interest, this flag tells whether to prompt the
|
||||
user to enter a transaction for the interest charge or
|
||||
payment. This per-account flag overrides the global preference. */
|
||||
void xaccAccountSetAutoInterestXfer (Account *account, gboolean value);
|
||||
void xaccAccountSetAutoInterestXfer (Account *account, gboolean value);
|
||||
/** @} */
|
||||
|
||||
/** @name Account Commodity setters/getters
|
||||
@@ -312,11 +314,11 @@ gnc_commodity * xaccAccountGetCommodity (const Account *account);
|
||||
* set for the account, that is returned; else the default SCU for
|
||||
* the account commodity is returned.
|
||||
*/
|
||||
int xaccAccountGetCommoditySCU (const Account *account);
|
||||
int xaccAccountGetCommoditySCU (const Account *account);
|
||||
|
||||
/** Return the 'internal' SCU setting. This returns the over-ride
|
||||
* SCU for the account (which might not be set, and might be zero). */
|
||||
int xaccAccountGetCommoditySCUi (const Account *account);
|
||||
int xaccAccountGetCommoditySCUi (const Account *account);
|
||||
|
||||
/** Set the SCU for the account. Normally, this routine is not
|
||||
* required, as the default SCU for an account is given by its
|
||||
@@ -328,7 +330,7 @@ void xaccAccountSetCommoditySCU (Account *account, int frac);
|
||||
#define xaccAccountSetCommoditySCUandFlag xaccAccountSetCommoditySCU
|
||||
|
||||
/** Set the flag indicating that this account uses a non-standard SCU. */
|
||||
void xaccAccountSetNonStdSCU (Account *account, gboolean flag);
|
||||
void xaccAccountSetNonStdSCU (Account *account, gboolean flag);
|
||||
|
||||
/** Return boolean, indicating whether this account uses a
|
||||
* non-standard SCU. */
|
||||
@@ -339,16 +341,20 @@ gboolean xaccAccountGetNonStdSCU (const Account *account);
|
||||
/** @name Account Balance
|
||||
@{
|
||||
*/
|
||||
/** Get the current balance of the account, which may include future splits */
|
||||
gnc_numeric xaccAccountGetBalance (Account *account);
|
||||
/** Get the current balance of the account, only including cleared transactions */
|
||||
gnc_numeric xaccAccountGetClearedBalance (Account *account);
|
||||
/** Get the current balance of the account, only including reconciled transactions */
|
||||
gnc_numeric xaccAccountGetReconciledBalance (Account *account);
|
||||
gnc_numeric xaccAccountGetPresentBalance (Account *account);
|
||||
gnc_numeric xaccAccountGetProjectedMinimumBalance (Account *account);
|
||||
/** Get the current balance of the account, which may include future
|
||||
splits */
|
||||
gnc_numeric xaccAccountGetBalance (const Account *account);
|
||||
/** Get the current balance of the account, only including cleared
|
||||
transactions */
|
||||
gnc_numeric xaccAccountGetClearedBalance (const Account *account);
|
||||
/** Get the current balance of the account, only including reconciled
|
||||
transactions */
|
||||
gnc_numeric xaccAccountGetReconciledBalance (const Account *account);
|
||||
gnc_numeric xaccAccountGetPresentBalance (const Account *account);
|
||||
gnc_numeric xaccAccountGetProjectedMinimumBalance (const Account *account);
|
||||
/** Get the balance of the account as of the date specified */
|
||||
gnc_numeric xaccAccountGetBalanceAsOfDate (Account *account, time_t date);
|
||||
gnc_numeric xaccAccountGetBalanceAsOfDate (Account *account,
|
||||
time_t date);
|
||||
|
||||
/* These two functions convert a given balance from one commodity to
|
||||
another. The account argument is only used to get the Book, and
|
||||
@@ -359,33 +365,32 @@ gnc_numeric xaccAccountGetBalanceAsOfDate (Account *account, time_t date);
|
||||
Since they really have nothing to do with Accounts, there's
|
||||
probably some better place for them, but where? gnc-commodity.h?
|
||||
*/
|
||||
gnc_numeric xaccAccountConvertBalanceToCurrency(Account *account, /* for book */
|
||||
gnc_numeric balance,
|
||||
gnc_commodity *balance_currency,
|
||||
gnc_commodity *new_currency);
|
||||
gnc_numeric xaccAccountConvertBalanceToCurrencyAsOfDate(Account *account, /* for book */
|
||||
gnc_numeric balance,
|
||||
gnc_commodity *balance_currency,
|
||||
gnc_commodity *new_currency,
|
||||
time_t date);
|
||||
gnc_numeric xaccAccountConvertBalanceToCurrency(
|
||||
const Account *account, /* for book */
|
||||
gnc_numeric balance, gnc_commodity *balance_currency,
|
||||
gnc_commodity *new_currency);
|
||||
gnc_numeric xaccAccountConvertBalanceToCurrencyAsOfDate(
|
||||
const Account *account, /* for book */
|
||||
gnc_numeric balance, gnc_commodity *balance_currency,
|
||||
gnc_commodity *new_currency, time_t date);
|
||||
|
||||
/* These functions get some type of balance in the desired commodity.
|
||||
'report_commodity' may be NULL to use the account's commodity. */
|
||||
gnc_numeric xaccAccountGetBalanceInCurrency (Account *account,
|
||||
gnc_commodity *report_commodity,
|
||||
gboolean include_children);
|
||||
gnc_numeric xaccAccountGetClearedBalanceInCurrency (Account *account,
|
||||
gnc_commodity *report_commodity,
|
||||
gboolean include_children);
|
||||
gnc_numeric xaccAccountGetReconciledBalanceInCurrency (Account *account,
|
||||
gnc_commodity *report_commodity,
|
||||
gboolean include_children);
|
||||
gnc_numeric xaccAccountGetPresentBalanceInCurrency (Account *account,
|
||||
gnc_commodity *report_commodity,
|
||||
gboolean include_children);
|
||||
gnc_numeric xaccAccountGetProjectedMinimumBalanceInCurrency (Account *account,
|
||||
gnc_commodity *report_commodity,
|
||||
gboolean include_children);
|
||||
gnc_numeric xaccAccountGetBalanceInCurrency (
|
||||
const Account *account, gnc_commodity *report_commodity,
|
||||
gboolean include_children);
|
||||
gnc_numeric xaccAccountGetClearedBalanceInCurrency (
|
||||
const Account *account, gnc_commodity *report_commodity,
|
||||
gboolean include_children);
|
||||
gnc_numeric xaccAccountGetReconciledBalanceInCurrency (
|
||||
const Account *account, gnc_commodity *report_commodity,
|
||||
gboolean include_children);
|
||||
gnc_numeric xaccAccountGetPresentBalanceInCurrency (
|
||||
const Account *account, gnc_commodity *report_commodity,
|
||||
gboolean include_children);
|
||||
gnc_numeric xaccAccountGetProjectedMinimumBalanceInCurrency (
|
||||
const Account *account, gnc_commodity *report_commodity,
|
||||
gboolean include_children);
|
||||
|
||||
/* This function gets the balance as of the given date in the desired
|
||||
commodity. */
|
||||
@@ -410,11 +415,11 @@ gnc_numeric xaccAccountGetBalanceAsOfDateInCurrency(
|
||||
|
||||
/** This routine returns the group holding the set of subaccounts
|
||||
* for this account. */
|
||||
AccountGroup * xaccAccountGetChildren (Account *account);
|
||||
AccountGroup * xaccAccountGetChildren (const Account *account);
|
||||
|
||||
/** This routine returns the group which contains this account.
|
||||
*/
|
||||
AccountGroup * xaccAccountGetParent (Account *account);
|
||||
AccountGroup * xaccAccountGetParent (const Account *account);
|
||||
|
||||
/** This routine returns the parent of the group that is the parent
|
||||
* of this account. It is equivalent to the nested call
|
||||
@@ -422,7 +427,7 @@ AccountGroup * xaccAccountGetParent (Account *account);
|
||||
* Note that if the account is in the root group node, then its
|
||||
* parent will be NULL.
|
||||
*/
|
||||
Account * xaccAccountGetParentAccount (Account *account);
|
||||
Account * xaccAccountGetParentAccount (const Account *account);
|
||||
|
||||
/** This routine returns a flat list of all of the accounts
|
||||
* that are descendents of this account. This includes not
|
||||
@@ -433,20 +438,20 @@ Account * xaccAccountGetParentAccount (Account *account);
|
||||
* The returned list should be freed with g_list_free() when
|
||||
* no longer needed.
|
||||
*/
|
||||
GList * xaccAccountGetDescendants (Account *account);
|
||||
GList * xaccAccountGetDescendants (const Account *account);
|
||||
|
||||
/** DOCUMENT ME! */
|
||||
void xaccAccountSetReconcileChildrenStatus(Account *account, gboolean status);
|
||||
void xaccAccountSetReconcileChildrenStatus(Account *account, gboolean status);
|
||||
|
||||
/** DOCUMENT ME! */
|
||||
gboolean xaccAccountGetReconcileChildrenStatus(Account *account);
|
||||
gboolean xaccAccountGetReconcileChildrenStatus(const Account *account);
|
||||
|
||||
/** Returns true if the account is 'ancestor' or has 'ancestor' as an
|
||||
* ancestor. An ancestor account may be the accounts parent, its
|
||||
* parent's parent, its parent's parent's parent, etc. Returns false
|
||||
* if either one is NULL.
|
||||
*/
|
||||
gboolean xaccAccountHasAncestor (Account *account, Account *ancestor);
|
||||
gboolean xaccAccountHasAncestor(const Account *acc, const Account *ancestor);
|
||||
|
||||
#define xaccAccountGetSlots(X) qof_instance_get_slots(QOF_INSTANCE(X))
|
||||
|
||||
@@ -501,7 +506,7 @@ gboolean xaccAccountTypesCompatible (GNCAccountType parent_type,
|
||||
* split into the indicated account. If the split already
|
||||
* belongs to another account, it will be removed from that
|
||||
* account first.*/
|
||||
void xaccAccountInsertSplit (Account *account, Split *split);
|
||||
void xaccAccountInsertSplit (Account *account, Split *split);
|
||||
|
||||
/** The xaccAccountGetSplitList() routine returns a pointer to a GList of
|
||||
* the splits in the account.
|
||||
@@ -510,15 +515,14 @@ void xaccAccountInsertSplit (Account *account, Split *split);
|
||||
* structure. Note that some routines (such as xaccAccountRemoveSplit())
|
||||
* modify this list directly, and could leave you with a corrupted
|
||||
* pointer. */
|
||||
SplitList* xaccAccountGetSplitList (Account *account);
|
||||
SplitList* xaccAccountGetSplitList (const Account *account);
|
||||
|
||||
/** The xaccAccountMoveAllSplits() routine reassigns each of the splits
|
||||
* in accfrom to accto. */
|
||||
void xaccAccountMoveAllSplits (Account *accfrom, Account *accto);
|
||||
|
||||
/** \warning Unimplemented */
|
||||
gpointer xaccAccountForEachSplit(Account *account,
|
||||
SplitCallback,
|
||||
gpointer xaccAccountForEachSplit(Account *account, SplitCallback,
|
||||
gpointer data);
|
||||
|
||||
/** The xaccAccountForEachTransaction() routine will traverse all of
|
||||
@@ -545,26 +549,27 @@ gpointer xaccAccountForEachSplit(Account *account,
|
||||
it will not traverse transactions present only in the remote
|
||||
database.
|
||||
*/
|
||||
gint xaccAccountForEachTransaction(Account *account,
|
||||
gint xaccAccountForEachTransaction(const Account *account,
|
||||
TransactionCallback proc,
|
||||
void *data);
|
||||
|
||||
/** Returns a pointer to the transaction, not a copy. */
|
||||
Transaction * xaccAccountFindTransByDesc(Account *account,
|
||||
const char *description);
|
||||
Transaction * xaccAccountFindTransByDesc(const Account *account,
|
||||
const char *description);
|
||||
|
||||
/** Returns a pointer to the split, not a copy. */
|
||||
Split * xaccAccountFindSplitByDesc(Account *account, const char *description);
|
||||
Split * xaccAccountFindSplitByDesc(const Account *account,
|
||||
const char *description);
|
||||
|
||||
/** The xaccAccountFixSplitDateOrder() subroutine checks to see if
|
||||
* a split is in proper sorted date order with respect
|
||||
* to the other splits in this account. */
|
||||
void xaccAccountFixSplitDateOrder (Account *account, Split *split);
|
||||
void xaccAccountFixSplitDateOrder (Account *account, Split *split);
|
||||
|
||||
/** The xaccTransFixSplitDateOrder() checks to see if
|
||||
* all of the splits in this transaction are in
|
||||
* proper date order. */
|
||||
void xaccTransFixSplitDateOrder (Transaction *trans);
|
||||
void xaccTransFixSplitDateOrder (Transaction *trans);
|
||||
/*@}*/
|
||||
|
||||
/* ------------------ */
|
||||
@@ -580,14 +585,14 @@ void xaccTransFixSplitDateOrder (Transaction *trans);
|
||||
void xaccAccountInsertLot (Account *, GNCLot *);
|
||||
void xaccAccountRemoveLot (Account *, GNCLot *);
|
||||
|
||||
/** The xaccAccountGetLotList() routine returns a pointer to the GList of
|
||||
/** The xaccAccountGetLotList() routine returns a pointer to the GList of
|
||||
* the lots in this account.
|
||||
* @note This GList is the account's internal
|
||||
* data structure: do not delete it when done; treat it as a read-only
|
||||
* structure. Note that some routines (such as xaccAccountRemoveLot())
|
||||
* modify this list directly, and could leave you with a corrupted
|
||||
* pointer. */
|
||||
LotList* xaccAccountGetLotList (Account *account);
|
||||
LotList* xaccAccountGetLotList (const Account *account);
|
||||
|
||||
/** The xaccAccountForEachLot() method will apply the function 'proc'
|
||||
* to each lot in the account. If 'proc' returns a non-NULL value,
|
||||
@@ -595,9 +600,9 @@ LotList* xaccAccountGetLotList (Account *account);
|
||||
* will be returned. There is no guarenteed order over which
|
||||
* the Lots will be traversed.
|
||||
*/
|
||||
gpointer xaccAccountForEachLot(Account *acc,
|
||||
gpointer (*proc)(GNCLot *lot, gpointer user_data),
|
||||
gpointer user_data);
|
||||
gpointer xaccAccountForEachLot(
|
||||
const Account *acc,
|
||||
gpointer (*proc)(GNCLot *lot, gpointer user_data), gpointer user_data);
|
||||
|
||||
|
||||
/** Find a list of open lots that match the match_func. Sort according
|
||||
@@ -605,7 +610,7 @@ gpointer xaccAccountForEachLot(Account *acc,
|
||||
* If sort_func is NULL, then the returned list has no particular order.
|
||||
* The caller must free to returned list.
|
||||
*/
|
||||
LotList * xaccAccountFindOpenLots (Account *acc,
|
||||
LotList * xaccAccountFindOpenLots (const Account *acc,
|
||||
gboolean (*match_func)(GNCLot *lot,
|
||||
gpointer user_data),
|
||||
gpointer user_data, GCompareFunc sort_func);
|
||||
@@ -617,35 +622,33 @@ LotList * xaccAccountFindOpenLots (Account *acc,
|
||||
@{
|
||||
*/
|
||||
/** DOCUMENT ME! */
|
||||
gboolean xaccAccountGetReconcileLastDate (Account *account,
|
||||
time_t *last_date);
|
||||
gboolean xaccAccountGetReconcileLastDate (const Account *account,
|
||||
time_t *last_date);
|
||||
/** DOCUMENT ME! */
|
||||
void xaccAccountSetReconcileLastDate (Account *account,
|
||||
time_t last_date);
|
||||
void xaccAccountSetReconcileLastDate (Account *account, time_t last_date);
|
||||
|
||||
/** DOCUMENT ME! */
|
||||
gboolean xaccAccountGetReconcileLastInterval (Account *account,
|
||||
int *months, int *days);
|
||||
gboolean xaccAccountGetReconcileLastInterval (const Account *account,
|
||||
int *months, int *days);
|
||||
/** DOCUMENT ME! */
|
||||
void xaccAccountSetReconcileLastInterval (Account *account,
|
||||
int months, int days);
|
||||
void xaccAccountSetReconcileLastInterval (Account *account,
|
||||
int months, int days);
|
||||
/** DOCUMENT ME! */
|
||||
gboolean xaccAccountGetReconcilePostponeDate (const Account *account,
|
||||
time_t *postpone_date);
|
||||
/** DOCUMENT ME! */
|
||||
void xaccAccountSetReconcilePostponeDate (Account *account,
|
||||
time_t postpone_date);
|
||||
|
||||
/** DOCUMENT ME! */
|
||||
gboolean xaccAccountGetReconcilePostponeDate (Account *account,
|
||||
time_t *postpone_date);
|
||||
gboolean xaccAccountGetReconcilePostponeBalance (const Account *account,
|
||||
gnc_numeric *balance);
|
||||
/** DOCUMENT ME! */
|
||||
void xaccAccountSetReconcilePostponeDate (Account *account,
|
||||
time_t postpone_date);
|
||||
void xaccAccountSetReconcilePostponeBalance (Account *account,
|
||||
gnc_numeric balance);
|
||||
|
||||
/** DOCUMENT ME! */
|
||||
gboolean xaccAccountGetReconcilePostponeBalance (Account *account,
|
||||
gnc_numeric *balance);
|
||||
/** DOCUMENT ME! */
|
||||
void xaccAccountSetReconcilePostponeBalance (Account *account,
|
||||
gnc_numeric balance);
|
||||
|
||||
/** DOCUMENT ME! */
|
||||
void xaccAccountClearReconcilePostpone (Account *account);
|
||||
void xaccAccountClearReconcilePostpone (Account *account);
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -661,17 +664,16 @@ typedef enum
|
||||
@{
|
||||
*/
|
||||
/** DOCUMENT ME! */
|
||||
gboolean xaccAccountGetPlaceholder (Account *account);
|
||||
gboolean xaccAccountGetPlaceholder (const Account *account);
|
||||
/** DOCUMENT ME! */
|
||||
void xaccAccountSetPlaceholder (Account *account,
|
||||
gboolean option);
|
||||
void xaccAccountSetPlaceholder (Account *account, gboolean option);
|
||||
|
||||
/** Returns PLACEHOLDER_NONE if account is NULL or neither account nor
|
||||
* any descendent of account is a placeholder. If account is a
|
||||
* placeholder, returns PLACEHOLDER_THIS. Otherwise, if any
|
||||
* descendant of account is a placeholder, return PLACEHOLDER_CHILD.
|
||||
*/
|
||||
GNCPlaceholderType xaccAccountGetDescendantPlaceholder (Account *account);
|
||||
GNCPlaceholderType xaccAccountGetDescendantPlaceholder(const Account *account);
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -680,20 +682,17 @@ GNCPlaceholderType xaccAccountGetDescendantPlaceholder (Account *account);
|
||||
*/
|
||||
|
||||
/** DOCUMENT ME! */
|
||||
gboolean xaccAccountGetTaxRelated (Account *account);
|
||||
gboolean xaccAccountGetTaxRelated (const Account *account);
|
||||
/** DOCUMENT ME! */
|
||||
void xaccAccountSetTaxRelated (Account *account,
|
||||
gboolean tax_related);
|
||||
|
||||
void xaccAccountSetTaxRelated (Account *account, gboolean tax_related);
|
||||
/** DOCUMENT ME! */
|
||||
const char * xaccAccountGetTaxUSCode (Account *account);
|
||||
const char * xaccAccountGetTaxUSCode (const Account *account);
|
||||
/** DOCUMENT ME! */
|
||||
void xaccAccountSetTaxUSCode (Account *account, const char *code);
|
||||
void xaccAccountSetTaxUSCode (Account *account, const char *code);
|
||||
/** DOCUMENT ME! */
|
||||
const char * xaccAccountGetTaxUSPayerNameSource (Account *account);
|
||||
const char * xaccAccountGetTaxUSPayerNameSource (const Account *account);
|
||||
/** DOCUMENT ME! */
|
||||
void xaccAccountSetTaxUSPayerNameSource (Account *account,
|
||||
const char *source);
|
||||
void xaccAccountSetTaxUSPayerNameSource (Account *account, const char *source);
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -706,20 +705,20 @@ void xaccAccountSetTaxUSPayerNameSource (Account *account,
|
||||
* over the account tree. The mark is *not* stored in the database/file
|
||||
* format. When accounts are newly created, the mark is set to zero.
|
||||
*/
|
||||
void xaccAccountSetMark (Account *account, short mark);
|
||||
void xaccAccountSetMark (Account *account, short mark);
|
||||
|
||||
/** Get the mark set by xaccAccountSetMark */
|
||||
short xaccAccountGetMark (Account *account);
|
||||
short xaccAccountGetMark (const Account *account);
|
||||
|
||||
/** The xaccClearMark will find the topmost group, and clear the mark in
|
||||
* the entire group tree. */
|
||||
void xaccClearMark (Account *account, short val);
|
||||
void xaccClearMark (Account *account, short val);
|
||||
|
||||
/** The xaccClearMarkDown will clear the mark only in this and in
|
||||
* sub-accounts.*/
|
||||
void xaccClearMarkDown (Account *account, short val);
|
||||
void xaccClearMarkDown (Account *account, short val);
|
||||
/** Will clear the mark for all the accounts of the AccountGroup .*/
|
||||
void xaccClearMarkDownGr (AccountGroup *group, short val);
|
||||
void xaccClearMarkDownGr (AccountGroup *group, short val);
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -746,14 +745,14 @@ gnc_commodity * DxaccAccountGetCurrency (const Account *account);
|
||||
* @deprecated Price quote information is now stored on the
|
||||
* commodity, not the account. */
|
||||
|
||||
void dxaccAccountSetQuoteTZ (Account *account, const char *tz);
|
||||
void dxaccAccountSetQuoteTZ (Account *account, const char *tz);
|
||||
/** Get the timezone to be used when interpreting the results from a
|
||||
* given Finance::Quote backend. Unfortunately, the upstream sources
|
||||
* don't label their output, so the user has to specify this bit.
|
||||
*
|
||||
* @deprecated Price quote information is now stored on the
|
||||
* commodity, not the account. */
|
||||
const char * dxaccAccountGetQuoteTZ (Account *account);
|
||||
const char * dxaccAccountGetQuoteTZ (const Account *account);
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ struct account_s
|
||||
* it should be immediately destroyed, or it should be inserted into
|
||||
* an account.
|
||||
*/
|
||||
void xaccAccountRemoveSplit (Account *, Split *);
|
||||
void xaccAccountRemoveSplit (Account *, Split *);
|
||||
|
||||
/* The xaccAccountSortSplits() routine will resort the account's
|
||||
* splits if the sort is dirty. If 'force' is true, the account
|
||||
@@ -151,12 +151,12 @@ void xaccAccountSortSplits (Account *acc, gboolean force);
|
||||
/* The following recompute the partial balances (stored with the
|
||||
* transaction) and the total balance, for this account
|
||||
*/
|
||||
void xaccAccountRecomputeBalance (Account *);
|
||||
void xaccAccountRecomputeBalance (Account *);
|
||||
|
||||
/* Set the account's GUID. This should only be done when reading
|
||||
* an account from a datafile, or some other external source. Never
|
||||
* call this on an existing account! */
|
||||
void xaccAccountSetGUID (Account *account, const GUID *guid);
|
||||
void xaccAccountSetGUID (Account *account, const GUID *guid);
|
||||
|
||||
/* The xaccAccountSetStartingBalance() routine will set the starting
|
||||
* commodity balance for this account. This routine is intended for
|
||||
@@ -189,7 +189,7 @@ void xaccFreeAccount (Account *account);
|
||||
* want anyone except the backend to mess with them.
|
||||
*/
|
||||
void xaccAccountSetVersion (Account*, gint32);
|
||||
gint32 xaccAccountGetVersion (Account*);
|
||||
gint32 xaccAccountGetVersion (const Account* acc);
|
||||
|
||||
/* Register Accounts with the engine */
|
||||
gboolean xaccAccountRegister (void);
|
||||
|
||||
@@ -452,10 +452,9 @@ xaccGroupGetRoot (AccountGroup * grp)
|
||||
}
|
||||
|
||||
AccountGroup *
|
||||
xaccAccountGetRoot (Account * acc)
|
||||
xaccAccountGetRoot (const Account * acc)
|
||||
{
|
||||
if (!acc) return NULL;
|
||||
return xaccGroupGetRoot (acc->parent);
|
||||
return acc ? xaccGroupGetRoot (acc->parent) : NULL;
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@@ -710,8 +709,8 @@ xaccAccountInsertSubAccount (Account *adult, Account *child)
|
||||
static int
|
||||
group_sort_helper (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
Account *aa = (Account *) a;
|
||||
Account *bb = (Account *) b;
|
||||
const Account *aa = (const Account *) a;
|
||||
const Account *bb = (const Account *) b;
|
||||
|
||||
/* return > 1 if aa should come after bb */
|
||||
return xaccAccountOrder (&aa, &bb);
|
||||
@@ -1024,10 +1023,10 @@ xaccSplitsBeginStagedTransactionTraversals (GList *splits)
|
||||
}
|
||||
|
||||
void
|
||||
xaccAccountBeginStagedTransactionTraversals (Account *account)
|
||||
xaccAccountBeginStagedTransactionTraversals (const Account *account)
|
||||
{
|
||||
if (account == NULL) return;
|
||||
xaccSplitsBeginStagedTransactionTraversals (account->splits);
|
||||
if (account)
|
||||
xaccSplitsBeginStagedTransactionTraversals (account->splits);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -1077,7 +1076,7 @@ xaccGroupBeginStagedTransactionTraversals (AccountGroup *grp)
|
||||
}
|
||||
|
||||
int
|
||||
xaccAccountStagedTransactionTraversal (Account *acc,
|
||||
xaccAccountStagedTransactionTraversal (const Account *acc,
|
||||
unsigned int stage,
|
||||
int (*callback)(Transaction *t,
|
||||
void *cb_data),
|
||||
@@ -1170,8 +1169,7 @@ xaccGroupMapAccounts (AccountGroup *grp,
|
||||
GList *result = NULL;
|
||||
GList *node;
|
||||
|
||||
if (!grp) return(NULL);
|
||||
if (!thunk) return(NULL);
|
||||
if (!grp || !thunk) return NULL;
|
||||
|
||||
for (node = grp->accounts; node; node = node->next)
|
||||
{
|
||||
@@ -1195,8 +1193,7 @@ xaccGroupForEachAccount (AccountGroup *grp,
|
||||
{
|
||||
GList *node;
|
||||
|
||||
if (!grp) return(NULL);
|
||||
if (!thunk) return(NULL);
|
||||
if (!grp || !thunk) return(NULL);
|
||||
|
||||
for (node = grp->accounts; node; node = node->next)
|
||||
{
|
||||
|
||||
@@ -212,7 +212,7 @@ AccountGroup * xaccGroupGetRoot (AccountGroup *grp);
|
||||
/** The xaccGetAccountRoot() subroutine will find the topmost
|
||||
* (root) group to which this account belongs.
|
||||
*/
|
||||
AccountGroup * xaccAccountGetRoot (Account *account);
|
||||
AccountGroup * xaccAccountGetRoot (const Account *account);
|
||||
|
||||
/** The xaccGroupGetParentAccount() subroutine returns the parent
|
||||
* account of the group, or NULL.
|
||||
@@ -260,7 +260,7 @@ Account *xaccGetPeerAccountFromFullName (Account *acc,
|
||||
@{
|
||||
*/
|
||||
|
||||
typedef gpointer (*AccountCallback)(Account *a, gpointer data);
|
||||
typedef gpointer (*AccountCallback) (Account *a, gpointer data);
|
||||
|
||||
/** The xaccGroupMapAccounts() routine will traverse the account
|
||||
group, returning a list of accounts. If the callback
|
||||
@@ -344,7 +344,7 @@ void xaccSplitsBeginStagedTransactionTraversals(SplitList *splits);
|
||||
* marker for each transaction which is a parent of one of the
|
||||
* splits in the account.
|
||||
*/
|
||||
void xaccAccountBeginStagedTransactionTraversals(Account *account);
|
||||
void xaccAccountBeginStagedTransactionTraversals(const Account *account);
|
||||
|
||||
/** xaccTransactionTraverse() checks the stage of the given transaction.
|
||||
* If the transaction hasn't reached the given stage, the transaction
|
||||
@@ -387,7 +387,7 @@ int xaccGroupStagedTransactionTraversal(AccountGroup *grp,
|
||||
* a traversal is undefined, so don't do that.
|
||||
*/
|
||||
|
||||
int xaccAccountStagedTransactionTraversal(Account *a,
|
||||
int xaccAccountStagedTransactionTraversal(const Account *a,
|
||||
unsigned int stage,
|
||||
TransactionCallback thunk,
|
||||
void *data);
|
||||
|
||||
@@ -745,7 +745,10 @@ date order.")
|
||||
'gnc:account-order
|
||||
'<gw:int>
|
||||
"xaccAccountOrder"
|
||||
'((<gnc:Account**> a1) (<gnc:Account**> a2))
|
||||
'(
|
||||
((<gnc:Account**> const) a1)
|
||||
((<gnc:Account**> const) a2)
|
||||
)
|
||||
"Defines a sorting order on accounts. Returns -1 if a1 is \"less
|
||||
than\" the second, +1 if the a1 is \"greater than\" the second, and 0
|
||||
if they are equal. To determine the sort order, the account codes are
|
||||
|
||||
Reference in New Issue
Block a user