Constify the AccountGroup variables where possible in Group.[ch]

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12228 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Chris Shoemaker
2005-12-31 22:28:42 +00:00
parent 2deaa26188
commit 2b7c1430e1
3 changed files with 36 additions and 36 deletions

View File

@@ -126,8 +126,8 @@ xaccSetAccountGroup (QofBook *book, AccountGroup *grp)
\********************************************************************/ \********************************************************************/
gboolean gboolean
xaccGroupEqual(AccountGroup *ga, xaccGroupEqual(const AccountGroup *ga,
AccountGroup *gb, const AccountGroup *gb,
gboolean check_guids) gboolean check_guids)
{ {
GList *na; GList *na;
@@ -250,7 +250,7 @@ xaccAccountGroupDestroy (AccountGroup *grp)
\********************************************************************/ \********************************************************************/
QofBook * QofBook *
xaccGroupGetBook (AccountGroup *group) xaccGroupGetBook (const AccountGroup *group)
{ {
if (!group) return NULL; if (!group) return NULL;
return group->book; return group->book;
@@ -341,7 +341,7 @@ xaccGroupMarkNotSaved (AccountGroup *grp)
\********************************************************************/ \********************************************************************/
gboolean gboolean
xaccGroupNotSaved (AccountGroup *grp) xaccGroupNotSaved (const AccountGroup *grp)
{ {
GList *node; GList *node;
@@ -365,7 +365,7 @@ xaccGroupNotSaved (AccountGroup *grp)
\********************************************************************/ \********************************************************************/
int int
xaccGroupGetNumSubAccounts (AccountGroup *grp) xaccGroupGetNumSubAccounts (const AccountGroup *grp)
{ {
GList *node; GList *node;
int num_acc; int num_acc;
@@ -389,7 +389,7 @@ xaccGroupGetNumSubAccounts (AccountGroup *grp)
\********************************************************************/ \********************************************************************/
static void static void
xaccPrependAccounts (AccountGroup *grp, GList **accounts_p) xaccPrependAccounts (const AccountGroup *grp, GList **accounts_p)
{ {
GList *node; GList *node;
@@ -406,7 +406,7 @@ xaccPrependAccounts (AccountGroup *grp, GList **accounts_p)
} }
AccountList * AccountList *
xaccGroupGetSubAccounts (AccountGroup *grp) xaccGroupGetSubAccounts (const AccountGroup *grp)
{ {
GList *accounts = NULL; GList *accounts = NULL;
@@ -418,7 +418,7 @@ xaccGroupGetSubAccounts (AccountGroup *grp)
} }
AccountList * AccountList *
xaccGroupGetAccountList (AccountGroup *grp) xaccGroupGetAccountList (const AccountGroup *grp)
{ {
if (!grp) return NULL; if (!grp) return NULL;
@@ -430,9 +430,9 @@ xaccGroupGetAccountList (AccountGroup *grp)
\********************************************************************/ \********************************************************************/
AccountGroup * AccountGroup *
xaccGroupGetRoot (AccountGroup * grp) xaccGroupGetRoot (const AccountGroup * grp)
{ {
AccountGroup * root = NULL; const AccountGroup * root = NULL;
/* find the root of the account group structure */ /* find the root of the account group structure */
while (grp) while (grp)
@@ -448,7 +448,7 @@ xaccGroupGetRoot (AccountGroup * grp)
grp = NULL; grp = NULL;
} }
return root; return (AccountGroup*)root;
} }
AccountGroup * AccountGroup *
@@ -462,7 +462,7 @@ xaccAccountGetRoot (const Account * acc)
\********************************************************************/ \********************************************************************/
Account * Account *
xaccGetAccountFromName (AccountGroup *grp, const char * name) xaccGetAccountFromName (const AccountGroup *grp, const char * name)
{ {
GList *node; GList *node;
@@ -499,7 +499,7 @@ xaccGetAccountFromName (AccountGroup *grp, const char * name)
\********************************************************************/ \********************************************************************/
Account * Account *
xaccGetAccountFromFullName (AccountGroup *grp, xaccGetAccountFromFullName (const AccountGroup *grp,
const char *name, const char *name,
const char separator) const char separator)
{ {
@@ -577,7 +577,7 @@ xaccGetAccountFromFullName (AccountGroup *grp,
\********************************************************************/ \********************************************************************/
Account * Account *
xaccGetPeerAccountFromName (Account *acc, const char * name) xaccGetPeerAccountFromName (const Account *acc, const char * name)
{ {
AccountGroup * root; AccountGroup * root;
Account *peer_acc; Account *peer_acc;
@@ -599,7 +599,7 @@ xaccGetPeerAccountFromName (Account *acc, const char * name)
\********************************************************************/ \********************************************************************/
Account * Account *
xaccGetPeerAccountFromFullName (Account *acc, const char * name, xaccGetPeerAccountFromFullName (const Account *acc, const char * name,
const char separator) const char separator)
{ {
AccountGroup * root; AccountGroup * root;
@@ -955,7 +955,7 @@ xaccGroupMergeAccounts (AccountGroup *grp)
\********************************************************************/ \********************************************************************/
int int
xaccGroupGetNumAccounts (AccountGroup *grp) xaccGroupGetNumAccounts (const AccountGroup *grp)
{ {
if (!grp) return 0; if (!grp) return 0;
@@ -963,7 +963,7 @@ xaccGroupGetNumAccounts (AccountGroup *grp)
} }
Account * Account *
xaccGroupGetAccount (AccountGroup *grp, int i) xaccGroupGetAccount (const AccountGroup *grp, int i)
{ {
if (!grp) return NULL; if (!grp) return NULL;
@@ -971,7 +971,7 @@ xaccGroupGetAccount (AccountGroup *grp, int i)
} }
Account * Account *
xaccGroupGetParentAccount (AccountGroup * grp) xaccGroupGetParentAccount (const AccountGroup * grp)
{ {
if (!grp) return NULL; if (!grp) return NULL;
@@ -982,7 +982,7 @@ xaccGroupGetParentAccount (AccountGroup * grp)
\********************************************************************/ \********************************************************************/
int int
xaccGroupGetDepth (AccountGroup *grp) xaccGroupGetDepth (const AccountGroup *grp)
{ {
GList *node; GList *node;
int depth = 0; int depth = 0;
@@ -1217,7 +1217,7 @@ xaccGroupForEachAccount (AccountGroup *grp,
/* ============================================================== */ /* ============================================================== */
QofBackend * QofBackend *
xaccGroupGetBackend (AccountGroup *grp) xaccGroupGetBackend (const AccountGroup *grp)
{ {
grp = xaccGroupGetRoot (grp); grp = xaccGroupGetRoot (grp);
if (!grp || !grp->book) return NULL; if (!grp || !grp->book) return NULL;

View File

@@ -73,7 +73,7 @@ void xaccAccountGroupDestroy (AccountGroup *grp);
#define gnc_book_get_group xaccGetAccountGroup #define gnc_book_get_group xaccGetAccountGroup
/** Return the book to which this account belongs */ /** Return the book to which this account belongs */
QofBook * xaccGroupGetBook (AccountGroup *group); QofBook * xaccGroupGetBook (const AccountGroup *group);
/** Compare two account groups /** Compare two account groups
@@ -82,7 +82,7 @@ groups have different numbers of accounts.
@return TRUE if the two account groups are equal, FALSE otherwise. @return TRUE if the two account groups are equal, FALSE otherwise.
*/ */
gboolean xaccGroupEqual(AccountGroup *a, AccountGroup *b, gboolean xaccGroupEqual(const AccountGroup *a, const AccountGroup *b,
gboolean check_guids); gboolean check_guids);
/** @} */ /** @} */
@@ -105,7 +105,7 @@ void xaccAccountGroupCommitEdit (AccountGroup *grp);
* hasn't been saved. * hasn't been saved.
XXX this should be moved to private header file, this is not a public routine! XXX this should be moved to private header file, this is not a public routine!
*/ */
gboolean xaccGroupNotSaved (AccountGroup *grp); gboolean xaccGroupNotSaved (const AccountGroup *grp);
/** The xaccGroupMarkSaved() subroutine will mark /** The xaccGroupMarkSaved() subroutine will mark
* the entire group as having been saved, including * the entire group as having been saved, including
@@ -172,42 +172,42 @@ void xaccAccountInsertSubAccount (Account *parent, Account *child);
/** The xaccGroupGetNumSubAccounts() subroutine returns the number /** The xaccGroupGetNumSubAccounts() subroutine returns the number
* of accounts, including subaccounts, in the account group * of accounts, including subaccounts, in the account group
*/ */
int xaccGroupGetNumSubAccounts (AccountGroup *grp); int xaccGroupGetNumSubAccounts (const AccountGroup *grp);
/** The xaccGroupGetNumAccounts() subroutine returns the number /** The xaccGroupGetNumAccounts() subroutine returns the number
* of accounts in the indicated group only (children not counted). * of accounts in the indicated group only (children not counted).
*/ */
int xaccGroupGetNumAccounts (AccountGroup *grp); int xaccGroupGetNumAccounts (const AccountGroup *grp);
/** The xaccGroupGetDepth() subroutine returns the length of the /** The xaccGroupGetDepth() subroutine returns the length of the
* longest tree branch. Each link between an account and its * longest tree branch. Each link between an account and its
* (non-null) children counts as one unit of length. * (non-null) children counts as one unit of length.
*/ */
int xaccGroupGetDepth (AccountGroup *grp); int xaccGroupGetDepth (const AccountGroup *grp);
/** @} */ /** @} */
/** @name Getting Accounts and Subaccounts /** @name Getting Accounts and Subaccounts
@{ @{
*/ */
/** DOCUMENT ME! is this routine deprecated? XXX using index is weird! */ /** DOCUMENT ME! is this routine deprecated? XXX using index is weird! */
Account * xaccGroupGetAccount (AccountGroup *group, int index); Account * xaccGroupGetAccount (const AccountGroup *group, int index);
/** The xaccGroupGetSubAccounts() subroutine returns an list of the accounts, /** The xaccGroupGetSubAccounts() subroutine returns an list of the accounts,
* including subaccounts, in the account group. The returned list * including subaccounts, in the account group. The returned list
* should be freed with g_list_free() when no longer needed. * should be freed with g_list_free() when no longer needed.
*/ */
AccountList * xaccGroupGetSubAccounts (AccountGroup *grp); AccountList * xaccGroupGetSubAccounts (const AccountGroup *grp);
/** The xaccGroupGetAccountList() subroutines returns only the immediate /** The xaccGroupGetAccountList() subroutines returns only the immediate
* children of the account group. The returned list should *not* * children of the account group. The returned list should *not*
* be freed by the caller. * be freed by the caller.
*/ */
AccountList * xaccGroupGetAccountList (AccountGroup *grp); AccountList * xaccGroupGetAccountList (const AccountGroup *grp);
/** The xaccGroupGetRoot() subroutine will find the topmost /** The xaccGroupGetRoot() subroutine will find the topmost
* (root) group to which this group belongs. * (root) group to which this group belongs.
*/ */
AccountGroup * xaccGroupGetRoot (AccountGroup *grp); AccountGroup * xaccGroupGetRoot (const AccountGroup *grp);
/** The xaccGetAccountRoot() subroutine will find the topmost /** The xaccGetAccountRoot() subroutine will find the topmost
* (root) group to which this account belongs. * (root) group to which this account belongs.
@@ -217,7 +217,7 @@ AccountGroup * xaccAccountGetRoot (const Account *account);
/** The xaccGroupGetParentAccount() subroutine returns the parent /** The xaccGroupGetParentAccount() subroutine returns the parent
* account of the group, or NULL. * account of the group, or NULL.
*/ */
Account * xaccGroupGetParentAccount (AccountGroup *group); Account * xaccGroupGetParentAccount (const AccountGroup *group);
/** @} */ /** @} */
@@ -229,13 +229,13 @@ Account * xaccGroupGetParentAccount (AccountGroup *group);
* in the indicated AccountGroup group. It returns NULL if the * in the indicated AccountGroup group. It returns NULL if the
* account was not found. * account was not found.
*/ */
Account *xaccGetAccountFromName (AccountGroup *group, const char *name); Account *xaccGetAccountFromName (const AccountGroup *group, const char *name);
/** The xaccGetAccountFromFullName() subroutine works like /** The xaccGetAccountFromFullName() subroutine works like
* xaccGetAccountFromName, but uses fully-qualified names * xaccGetAccountFromName, but uses fully-qualified names
* using the given separator. * using the given separator.
*/ */
Account *xaccGetAccountFromFullName (AccountGroup *group, Account *xaccGetAccountFromFullName (const AccountGroup *group,
const char *name, const char *name,
const char separator); const char separator);
@@ -244,13 +244,13 @@ Account *xaccGetAccountFromFullName (AccountGroup *group,
* in the same AccountGroup anchor group. It returns NULL if the * in the same AccountGroup anchor group. It returns NULL if the
* account was not found. * account was not found.
*/ */
Account *xaccGetPeerAccountFromName (Account *account, const char *name); Account *xaccGetPeerAccountFromName (const Account *account, const char *name);
/** The xaccGetPeerAccountFromFullName() subroutine works like /** The xaccGetPeerAccountFromFullName() subroutine works like
* xaccGetPeerAccountFromName, but uses fully-qualified * xaccGetPeerAccountFromName, but uses fully-qualified
* names using the given separator. * names using the given separator.
*/ */
Account *xaccGetPeerAccountFromFullName (Account *acc, Account *xaccGetPeerAccountFromFullName (const Account *acc,
const char * name, const char * name,
const char separator); const char separator);

View File

@@ -96,7 +96,7 @@ void xaccCollSetAccountGroup (QofCollection *col, AccountGroup *grp);
* The xaccGroupGetBackend() subroutine will find the * The xaccGroupGetBackend() subroutine will find the
* persistent-data storage backend associated with this account group. * persistent-data storage backend associated with this account group.
*/ */
QofBackend * xaccGroupGetBackend (AccountGroup *group); QofBackend * xaccGroupGetBackend (const AccountGroup *group);
gboolean xaccGroupRegister (void); gboolean xaccGroupRegister (void);