From 6dc0871f2634530522671963d8283f704f766123 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Tue, 16 Jan 2001 06:11:20 +0000 Subject: [PATCH] add routine to convert account type string to enum git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3478 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/Account.c | 11 +++++++++++ src/engine/Account.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/engine/Account.c b/src/engine/Account.c index 620c22f0e6..3db7c5676d 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -1453,6 +1453,17 @@ xaccAccountStringToType(const char* str, int *type) { #undef GNC_RETURN_ON_MATCH +/* impedance mismatch is a source of loss */ +GNCAccountType +xaccAccountStringToEnum(const char* str) +{ + int type; + gboolean rc; + rc = xaccAccountStringToType(str, &type); + if (FALSE == rc) return BAD_TYPE; + return ((GNCAccountType) type); +} + /********************************************************************\ \********************************************************************/ diff --git a/src/engine/Account.h b/src/engine/Account.h index 8400df8991..50ca7d91f9 100644 --- a/src/engine/Account.h +++ b/src/engine/Account.h @@ -112,6 +112,7 @@ char * xaccAccountGetTypeStr (int type); /* GUI names */ "INCOME". */ char * xaccAccountTypeEnumAsString (int type); gboolean xaccAccountStringToType (const char* str, int *type); +GNCAccountType xaccAccountStringToEnum (const char* str); gboolean xaccAccountTypesCompatible (int parent_type, int child_type);