2001-05-17 Dave Peticolas <dave@krondo.com>

* src/doc/design/gnucash-design.texinfo: update docs

	* src/doc/design/engine.texinfo: update docs

	* src/engine/Account.c: same as below

	* src/engine/Account.h: use GNCAccountType instead of 'int'


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4230 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-05-17 10:18:48 +00:00
parent a936ec348f
commit f23936cfbd
5 changed files with 109 additions and 9 deletions

View File

@ -1,3 +1,13 @@
2001-05-17 Dave Peticolas <dave@krondo.com>
* src/doc/design/gnucash-design.texinfo: update docs
* src/doc/design/engine.texinfo: update docs
* src/engine/Account.c: same as below
* src/engine/Account.h: use GNCAccountType instead of 'int'
2001-05-17 Robert Graham Merkel <rgmerk@mira.net>
* doc/sgml/C/xacc-gnucash-web-browser.sgml: New file.

View File

@ -1744,6 +1744,8 @@ In addition to the above, Accounts contain a key-value pair frame.
@menu
* Account Types::
* General Account API::
* Account Type API::
* Account Getters::
@end menu
@ -1802,7 +1804,7 @@ Possible values are:
@end table
@node General Account API, , Account Types, Accounts
@node General Account API, Account Type API, Account Types, Accounts
@subsection General Account API
@deftypefun {Account *} xaccMallocAccount (void)
@ -1855,6 +1857,88 @@ Set the @code{kvp_frame} associated wih @var{account}. After the call,
@end deftypefun
@node Account Type API, Account Getters, General Account API, Accounts
@subsection Account Type API
@deftypefun {const char *} xaccAccountGetTypeStr (GNCAccountType @var{type})
Return a string corresponding to the given Account type suitable for
display by a GUI. The string is translated with gettext according to
the current locale.
@end deftypefun
@deftypefun {char *} xaccAccountTypeEnumAsString (GNCAccountType @var{type})
Return a string corresponding to the given Account type. The string
is not translated and is independent of the current locale.
@end deftypefun
@deftypefun gboolean xaccAccountStringToType (const char * @var{str}, GNCAccountType * @var{type})
Converts a string of the form returned by @code{xaccAccountTypeEnumAsString}
to a type, return in @var{type}. Returns true if the string corresponds
to an actual type.
@end deftypefun
@deftypefun GNCAccountType xaccAccountStringToEnum (const char * @var{str})
Similar to @code{xaccAccountStringToEnum}, but returns the type. If
@var{str} does not correspond to any valid type, @code{BAD_TYPE} is
returned.
@end deftypefun
@deftypefun gboolean xaccAccountTypesCompatible (GNCAccountType @var{parent_type}, GNCAccountType @var{child_type})
Returns TRUE if accounts of type @var{parent_type} can have child accounts
of type @var{child_type}. This compatibility is not enforced by the
engine, but one day it may be!
@end deftypefun
@node Account Getters, , Account Type API, Accounts
@subsection Account Getters
@deftypefun GNCAccountType xaccAccountGetType (Account * @var{account})
Return the type of @var{account}.
@end deftypefun
@deftypefun {const char *} xaccAccountGetName (Account * @var{account})
Return the name of @var{account}.
@end deftypefun
@deftypefun {const char *} xaccAccountGetCode (Account * @var{account})
Return the code of @var{account}.
@end deftypefun
@deftypefun {const char *} xaccAccountGetDescription (Account * @var{account})
Return the description of @var{account}.
@end deftypefun
@deftypefun {const char *} xaccAccountGetNotes (Account * @var{account})
Return the notes of @var{account}.
@end deftypefun
@deftypefun {gnc_commodity *} xaccAccountGetCurrency (Account * @var{account})
Return the currency of @var{account}.
@end deftypefun
@deftypefun int xaccAccountGetCurrencySCU (Account * @var{account})
Return the SCU (smallest convertible unit) of @var{account}'s
currency.
@end deftypefun
@deftypefun {gnc_commodity *} xaccAccountGetSecurity (Account * @var{account})
Return the security of @var{account}. For accounts without shares, this
field will be @code{NULL}.
@end deftypefun
@deftypefun int xaccAccountGetSecuritySCU (Account * @var{account})
Return the SCU (smallest convertible unit) of @var{account}'s
security.
@end deftypefun
@deftypefun {gnc_commodity *} xaccAccountGetEffectiveSecurity (Account * @var{account})
Get the `effective' security of the account. If the account has a non-NULL
security field, that field will be returned. Otherwise, the currency will
be returned.
@end deftypefun
@node Account Groups, GNCBooks, Accounts, Engine
@section Account Groups
@tindex AccountGroup

View File

@ -140,6 +140,8 @@ Accounts
* Account Types::
* General Account API::
* Account Type API::
* Account Getters::
GNCBooks

View File

@ -1810,7 +1810,7 @@ xaccAccountTypeEnumAsString(GNCAccountType type) {
if(safe_strcmp(#x, (str)) == 0) { *type = x; return(TRUE); }
gboolean
xaccAccountStringToType(const char* str, int *type) {
xaccAccountStringToType(const char* str, GNCAccountType *type) {
GNC_RETURN_ON_MATCH(NO_TYPE);
GNC_RETURN_ON_MATCH(BANK);
@ -1841,11 +1841,11 @@ xaccAccountStringToType(const char* str, int *type) {
GNCAccountType
xaccAccountStringToEnum(const char* str)
{
int type;
GNCAccountType type;
gboolean rc;
rc = xaccAccountStringToType(str, &type);
if (FALSE == rc) return BAD_TYPE;
return ((GNCAccountType) type);
return type;
}
/********************************************************************\
@ -1883,7 +1883,8 @@ xaccAccountGetTypeStr(GNCAccountType type) {
\********************************************************************/
gboolean
xaccAccountTypesCompatible (int parent_type, int child_type)
xaccAccountTypesCompatible (GNCAccountType parent_type,
GNCAccountType child_type)
{
gboolean compatible = FALSE;

View File

@ -105,13 +105,16 @@ typedef enum
const char * xaccAccountGetTypeStr (GNCAccountType type); /* GUI names */
/* Conversion routines for the account types to/from strings.
Critical for the text communication mechanisms. i.e. INCOME ->
"INCOME". */
* Critical for the text communication mechanisms. i.e. INCOME ->
* "INCOME". */
char * xaccAccountTypeEnumAsString (GNCAccountType type);
gboolean xaccAccountStringToType (const char* str, int *type);
gboolean xaccAccountStringToType (const char* str, GNCAccountType *type);
GNCAccountType xaccAccountStringToEnum (const char* str);
gboolean xaccAccountTypesCompatible (int parent_type, int child_type);
/* Return TRUE if accounts of type parent_type can have accounts
* of type child_type as children. */
gboolean xaccAccountTypesCompatible (GNCAccountType parent_type,
GNCAccountType child_type);
/* Compare two accounts for equality - this is a deep compare. */
gboolean xaccAccountEqual(Account *a, Account* b, gboolean check_guids);