* src/engine/Account.c (xaccCloneAccountSimple): new func.

(xaccAccountEnumAsString): change arg to GNCAccountType.

* src/engine/Account.c (xaccAccountGetChildren): Add children
group if ->children == NULL.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4151 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
James LewisMoss
2001-05-10 16:12:02 +00:00
parent 7753a796be
commit e01b217c43
2 changed files with 26 additions and 2 deletions
+24 -1
View File
@@ -135,6 +135,27 @@ xaccMallocAccount (void)
return acc;
}
Account *
xaccCloneAccountSimple(const Account *from)
{
Account *ret;
ret = xaccMallocAccount();
xaccInitAccount(ret);
ret->type = from->type;
ret->accountName = g_strdup(from->accountName);
ret->accountCode = g_strdup(from->accountCode);
ret->description = g_strdup(from->description);
ret->kvp_data = kvp_frame_copy(from->kvp_data);
ret->currency = from->currency;
return ret;
}
/********************************************************************\
\********************************************************************/
@@ -1273,6 +1294,8 @@ AccountGroup *
xaccAccountGetChildren (Account *acc)
{
if (!acc) return NULL;
if (acc->children == NULL)
acc->children = xaccMallocAccountGroup ();
return (acc->children);
}
@@ -1755,7 +1778,7 @@ xaccAccountHasAncestor (Account *account, Account * ancestor)
#define GNC_RETURN_ENUM_AS_STRING(x) case (x): return #x;
char *
xaccAccountTypeEnumAsString(int type) {
xaccAccountTypeEnumAsString(GNCAccountType type) {
switch(type) {
GNC_RETURN_ENUM_AS_STRING(NO_TYPE);
GNC_RETURN_ENUM_AS_STRING(BANK);
+2 -1
View File
@@ -110,7 +110,7 @@ char * xaccAccountGetTypeStr (int type); /* GUI names */
/* Conversion routines for the account types to/from strings.
Critical for the text communication mechanisms. i.e. INCOME ->
"INCOME". */
char * xaccAccountTypeEnumAsString (int type);
char * xaccAccountTypeEnumAsString (GNCAccountType type);
gboolean xaccAccountStringToType (const char* str, int *type);
GNCAccountType xaccAccountStringToEnum (const char* str);
@@ -129,6 +129,7 @@ gboolean xaccAccountEqual(Account *a, Account* b, gboolean check_guids);
* (by calling xaccAccountBeginEdit()) before calling this routine.
*/
Account *xaccMallocAccount (void);
Account * xaccCloneAccountSimple(const Account *from);
void xaccAccountBeginEdit (Account *account);
void xaccAccountCommitEdit (Account *account);
void xaccAccountDestroy (Account *account);