|
GnuCash 2.3.0
|
Modules | |
| Account | |
| Cap Gains | |
| Commodities | |
| Lots: Core Function for AR/AP, Inventory, Stock Lots, Cap Gains | |
| Price Database | |
| Prices | |
| Business | |
| Accounting Policy (FIFO/LIFO) | |
| Scheduled/Periodic/Recurring Transactions | |
| Data Validation | |
| Transaction, Split | |
| Transaction Logging | |
Files | |
| file | gnc-engine.h |
All type declarations for the whole Gnucash engine. | |
Defines | |
| #define | ACCOUNT_MATCH_ALL_TYPE "account-match-all" |
| #define | GNC_ID_NONE QOF_ID_NONE |
| IDENTIFIERS GncGUID Identifiers can be used to reference Accounts, Transactions, Splits and other objects. These Gnucash types are referred to as Gnucash entities. GncGUID Identifiers are globally-unique and permanent, i.e., once an entity has been assigned an identifier, it retains that same identifier for its lifetime. | |
| #define | GNC_ID_BOOK QOF_ID_BOOK |
| #define | GNC_ID_SESSION QOF_ID_SESSION |
| #define | GNC_ID_NULL QOF_ID_NULL |
| #define | GNC_ID_ACCOUNT "Account" |
| #define | GNC_ID_COMMODITY "Commodity" |
| #define | GNC_ID_COMMODITY_NAMESPACE "CommodityNamespace" |
| #define | GNC_ID_COMMODITY_TABLE "CommodityTable" |
| #define | GNC_ID_LOT "Lot" |
| #define | GNC_ID_PERIOD "Period" |
| #define | GNC_ID_PRICE "Price" |
| #define | GNC_ID_PRICEDB "PriceDB" |
| #define | GNC_ID_SPLIT "Split" |
| #define | GNC_ID_BUDGET "Budget" |
| #define | GNC_ID_SCHEDXACTION "SchedXaction" |
| #define | GNC_ID_SXES "SchedXactions" |
| #define | GNC_ID_SXTG "SXTGroup" |
| #define | GNC_ID_SXTT "SXTTrans" |
| #define | GNC_ID_TRANS "Trans" |
Typedefs | |
| typedef struct account_s | Account |
| Account in Gnucash. This is the typename for an account. The actual structure is defined in the private header AccountP.h, but no one outside the engine should include that file. Instead, access that data only through the functions in Account.h . | |
| typedef struct split_s | Split |
| Split in Gnucash. A "split" is more commonly referred to as a "entry" in a "transaction". Each split belongs to one Account and one Transaction. The split is one out of several parts a Transaction is divided into. | |
| typedef struct transaction_s | Transaction |
| Transaction in Gnucash. A Transaction is a piece of business done; the transfer of money from one account to one or more other accounts. Each Transaction is divided into one or more Splits (usually two). | |
| typedef struct gnc_commodity_s | gnc_commodity |
| An article that is bought and sold. A Commodity is the most general term of what an account keeps track of. Usually this is a monetary currency, but it can also be a stock share or even a precious metal. Every account keeps track of exactly one gnc_commodity. | |
|
typedef struct gnc_commodity_namespace_s | gnc_commodity_namespace |
| A gnc_commodity_namespace is an collection of commodities. | |
|
typedef struct gnc_commodity_table_s | gnc_commodity_table |
| A gnc_commodity_table is a database of commodity info. | |
| typedef struct gnc_lot_s | GNCLot |
| Identifies that something sold at one time was bought at another. A GNCLot provides a way of tracking physical items as they are bought and sold in different transactions. By identifying the individual, underlying physical objects, it provides the needed framework for implementing depreciation, capital gains, inventory control and invoices. | |
| typedef struct gnc_price_s | GNCPrice |
| Price of commodity on a given date. A GNCPrice encapsulates price information: the cost of a commodity expressed as a currency, on a given date. It also holds info about the provenance of the price: where it came from, its general validity. | |
| typedef struct gnc_quote_source_s | gnc_quote_source |
| typedef GList | AccountList |
| typedef GList | LotList |
| typedef GList | SplitList |
| typedef GList | TransList |
| typedef GList | AccountGUIDList |
| typedef GList | BookGUIDList |
| typedef void(* | EngineCommitErrorCallback )(gpointer data, QofBackendError errcode) |
| typedef gint(* | SplitCallback )(Split *s, gpointer data) |
| typedef gint(* | TransactionCallback )(Transaction *t, void *data) |
| typedef void(* | gnc_engine_init_hook_t )(int, char **) |
Enumerations | |
| enum | GNCPlaceholderType { PLACEHOLDER_NONE, PLACEHOLDER_THIS, PLACEHOLDER_CHILD } |
Functions | |
| void | gnc_engine_init (int argc, char **argv) |
| void | gnc_engine_init_static (int argc, char **argv) |
| void | gnc_engine_shutdown (void) |
| gboolean | gnc_engine_is_initialized (void) |
| void | gnc_log_default (void) |
| void | gnc_engine_add_init_hook (gnc_engine_init_hook_t hook) |
| void | gnc_engine_add_commit_error_callback (EngineCommitErrorCallback cb, gpointer data) |
| void | gnc_engine_signal_commit_error (QofBackendError errcode) |
Lookup Accounts and Subaccounts by name or code | |
| Account * | gnc_account_lookup_by_name (const Account *parent, const char *name) |
| Account * | gnc_account_lookup_by_full_name (const Account *any_account, const gchar *name) |
| Account * | gnc_account_lookup_by_code (const Account *parent, const char *code) |
GNCAccountType conversion/checking | |
| const char * | xaccAccountTypeEnumAsString (GNCAccountType type) |
| gboolean | xaccAccountStringToType (const char *str, GNCAccountType *type) |
| GNCAccountType | xaccAccountStringToEnum (const char *str) |
| const char * | xaccAccountGetTypeStr (GNCAccountType type) |
| guint32 | xaccParentAccountTypesCompatibleWith (GNCAccountType type) |
| gboolean | xaccAccountTypesCompatible (GNCAccountType parent_type, GNCAccountType child_type) |
| guint32 | xaccAccountTypesValid (void) |
Account split/transaction list management | |
| SplitList * | xaccAccountGetSplitList (const Account *account) |
| void | xaccAccountMoveAllSplits (Account *accfrom, Account *accto) |
| gint | xaccAccountForEachTransaction (const Account *account, TransactionCallback proc, void *data) |
| Transaction * | xaccAccountFindTransByDesc (const Account *account, const char *description) |
| Split * | xaccAccountFindSplitByDesc (const Account *account, const char *description) |
| #define | xaccAccountInsertSplit(acc, s) xaccSplitSetAccount((s), (acc)) |
Account lots | |
| void | xaccAccountInsertLot (Account *, GNCLot *) |
| void | xaccAccountRemoveLot (Account *, GNCLot *) |
| LotList * | xaccAccountGetLotList (const Account *account) |
| gpointer | xaccAccountForEachLot (const Account *acc, gpointer(*proc)(GNCLot *lot, gpointer user_data), gpointer user_data) |
| LotList * | xaccAccountFindOpenLots (const Account *acc, gboolean(*match_func)(GNCLot *lot, gpointer user_data), gpointer user_data, GCompareFunc sort_func) |
Account Reconciliation information getters/setters | |
| gboolean | xaccAccountGetReconcileLastDate (const Account *account, time_t *last_date) |
| void | xaccAccountSetReconcileLastDate (Account *account, time_t last_date) |
| gboolean | xaccAccountGetReconcileLastInterval (const Account *account, int *months, int *days) |
| void | xaccAccountSetReconcileLastInterval (Account *account, int months, int days) |
| gboolean | xaccAccountGetReconcilePostponeDate (const Account *account, time_t *postpone_date) |
| void | xaccAccountSetReconcilePostponeDate (Account *account, time_t postpone_date) |
| gboolean | xaccAccountGetReconcilePostponeBalance (const Account *account, gnc_numeric *balance) |
| void | xaccAccountSetReconcilePostponeBalance (Account *account, gnc_numeric balance) |
| void | xaccAccountClearReconcilePostpone (Account *account) |
Account Placeholder flag | |
| gboolean | xaccAccountGetPlaceholder (const Account *account) |
| void | xaccAccountSetPlaceholder (Account *account, gboolean val) |
| GNCPlaceholderType | xaccAccountGetDescendantPlaceholder (const Account *account) |
Account Hidden flag | |
| gboolean | xaccAccountGetHidden (const Account *acc) |
| void | xaccAccountSetHidden (Account *acc, gboolean val) |
| gboolean | xaccAccountIsHidden (const Account *acc) |
Account Tax related getters/setters | |
| gboolean | xaccAccountGetTaxRelated (const Account *account) |
| void | xaccAccountSetTaxRelated (Account *account, gboolean tax_related) |
| const char * | xaccAccountGetTaxUSCode (const Account *account) |
| void | xaccAccountSetTaxUSCode (Account *account, const char *code) |
| const char * | xaccAccountGetTaxUSPayerNameSource (const Account *account) |
| void | xaccAccountSetTaxUSPayerNameSource (Account *account, const char *source) |
| gint64 | xaccAccountGetTaxUSCopyNumber (const Account *account) |
| void | xaccAccountSetTaxUSCopyNumber (Account *account, gint64 copy_number) |
Account marking | |
| void | xaccAccountSetMark (Account *account, short mark) |
| void | xaccClearMark (Account *account, short val) |
| void | xaccClearMarkDown (Account *account, short val) |
Staged Traversal | |
The following functions provide support for "staged traversals" over all of the transactions in an account or group. The idea is to be able to perform a sequence of traversals ("stages"), and perform an operation on each transaction exactly once for that stage. Only transactions whose current "stage" is less than the stage of the current traversal will be affected, and they will be "brought up" to the current stage when they are processed. For example, you could perform a stage 1 traversal of all the transactions in an account, and then perform a stage 1 traversal of the transactions in a second account. Presuming the traversal of the first account didn't abort prematurely, any transactions shared by both accounts would be ignored during the traversal of the second account since they had been processed while traversing the first account. However, if you had traversed the second account using a stage of 2, then all the transactions in the second account would have been processed. Traversal can be aborted by having the callback function return a non-zero value. The traversal is aborted immediately, and the non-zero value is returned. Note that an aborted traversal can be restarted; no information is lost due to an abort. The initial impetus for this particular approach came from generalizing a mark/sweep practice that was already being used in FileIO.c. Note that currently, there is a hard limit of 256 stages, which can be changed by enlarging "marker" in the transaction struct. | |
| void | gnc_account_tree_begin_staged_transaction_traversals (Account *acc) |
| void | xaccSplitsBeginStagedTransactionTraversals (SplitList *splits) |
| void | xaccAccountBeginStagedTransactionTraversals (const Account *account) |
| gboolean | xaccTransactionTraverse (Transaction *trans, int stage) |
| int | xaccAccountStagedTransactionTraversal (const Account *a, unsigned int stage, TransactionCallback thunk, void *data) |
| int | gnc_account_tree_staged_transaction_traversal (const Account *account, unsigned int stage, TransactionCallback thunk, void *data) |
| int | xaccAccountTreeForEachTransaction (Account *acc, TransactionCallback proc, void *data) |
Deprecated Routines. | |
| void | DxaccAccountSetCurrency (Account *account, gnc_commodity *currency) |
| gnc_commodity * | DxaccAccountGetCurrency (const Account *account) |
| void | dxaccAccountSetQuoteTZ (Account *account, const char *tz) |
| const char * | dxaccAccountGetQuoteTZ (const Account *account) |
Account parameter names | |
| #define | ACCOUNT_KVP "kvp" |
| #define | ACCOUNT_NAME_ "name" |
| #define | ACCOUNT_CODE_ "code" |
| #define | ACCOUNT_DESCRIPTION_ "desc" |
| #define | ACCOUNT_COLOR_ "color" |
| #define | ACCOUNT_FILTER_ "filter" |
| #define | ACCOUNT_SORT_ORDER_ "sort-order" |
| #define | ACCOUNT_NOTES_ "notes" |
| #define | ACCOUNT_BALANCE_ "balance" |
| #define | ACCOUNT_CLEARED_ "cleared" |
| #define | ACCOUNT_RECONCILED_ "reconciled" |
| #define | ACCOUNT_PRESENT_ "present" |
| #define | ACCOUNT_FUTURE_MINIMUM_ "future-minimum" |
| #define | ACCOUNT_TAX_RELATED "tax-related-p" |
| #define | ACCOUNT_TYPE_ "account-type" |
| #define | ACCOUNT_SCU "smallest-commodity-unit" |
| #define | ACCOUNT_NSCU "non-standard-scu" |
| #define | ACCOUNT_PARENT "parent-account" |
QofLogModule identifiers | |
| #define | GNC_MOD_ROOT "gnc" |
| #define | GNC_MOD_ENGINE "gnc.engine" |
| #define | GNC_MOD_ACCOUNT "gnc.account" |
| #define | GNC_MOD_SX "gnc.engine.sx" |
| #define | GNC_MOD_QUERY "gnc.query" |
| #define | GNC_MOD_SCRUB "gnc.scrub" |
| #define | GNC_MOD_LOT "gnc.lots" |
| #define | GNC_MOD_COMMODITY "gnc.commodity" |
| #define | GNC_MOD_BACKEND "gnc.backend" |
| #define | GNC_MOD_PRICE "gnc.pricedb" |
| #define | GNC_MOD_BUSINESS "gnc.business" |
| #define | GNC_MOD_IO "gnc.io" |
| #define | GNC_MOD_BOOK "gnc.book-period" |
| #define | GNC_MOD_GUI "gnc.gui" |
| #define | GNC_MOD_GUI_SX "gnc.gui.sx" |
| #define | GNC_MOD_GUILE "gnc.guile" |
| #define | GNC_MOD_LEDGER "gnc.ledger" |
| #define | GNC_MOD_REGISTER "gnc.register" |
| #define | GNC_MOD_HTML "gnc.html" |
| #define | GNC_MOD_PREFS "gnc.pref" |
| #define | GNC_MOD_IMPORT "gnc.import" |
| #define | GNC_MOD_ASSISTANT "gnc.assistant" |
| #define | GNC_MOD_TEST "gnc.tests" |
| #define | GNC_MOD_BUDGET "gnc.budget" |
The GnuCash Engine provides a set of objects and classes that encapsulate typical financial accounting concepts. The GnuCash GUI is expected to manipulate these objects through the provided engine API.
| #define ACCOUNT_MATCH_ALL_TYPE "account-match-all" |
| #define GNC_ID_NONE QOF_ID_NONE |
IDENTIFIERS GncGUID Identifiers can be used to reference Accounts, Transactions, Splits and other objects. These Gnucash types are referred to as Gnucash entities. GncGUID Identifiers are globally-unique and permanent, i.e., once an entity has been assigned an identifier, it retains that same identifier for its lifetime.
Definition at line 87 of file gnc-engine.h.
| #define xaccAccountInsertSplit | ( | acc, | |
| s | |||
| ) | xaccSplitSetAccount((s), (acc)) |
The xaccAccountInsertSplit() method will insert the indicated split into the indicated account. If the split already belongs to another account, it will be removed from that account first.
| typedef GList AccountGUIDList |
GList of GUIDs of a Account
Definition at line 207 of file gnc-engine.h.
| typedef GList AccountList |
GList of Account
Definition at line 199 of file gnc-engine.h.
| typedef GList BookGUIDList |
GList of GUIDs of a QofBook
Definition at line 209 of file gnc-engine.h.
| typedef struct gnc_commodity_s gnc_commodity |
An article that is bought and sold. A Commodity is the most general term of what an account keeps track of. Usually this is a monetary currency, but it can also be a stock share or even a precious metal. Every account keeps track of exactly one gnc_commodity.
(Up to version 1.6.x, we used to have currencies and securities. Now these concepts have been merged into this gnc_commodity. See the comments at xaccAccountSetCommodity() for more about that.)
This is the typename for a gnc_commodity. The actual structure is defined in a private source file. For accessing that data, only use the functions in gnc-commodity.h .
Definition at line 171 of file gnc-engine.h.
| typedef void(* gnc_engine_init_hook_t)(int, char **) |
Function type for init hooks in the engine.
Definition at line 217 of file gnc-engine.h.
Identifies that something sold at one time was bought at another. A GNCLot provides a way of tracking physical items as they are bought and sold in different transactions. By identifying the individual, underlying physical objects, it provides the needed framework for implementing depreciation, capital gains, inventory control and invoices.
See the file src/doc/lots.txt for implementation overview.
Definition at line 188 of file gnc-engine.h.
| typedef GList LotList |
GList of GNCLots
Definition at line 201 of file gnc-engine.h.
Split in Gnucash. A "split" is more commonly referred to as a "entry" in a "transaction". Each split belongs to one Account and one Transaction. The split is one out of several parts a Transaction is divided into.
This is the typename for a split. The actual structure is defined in the private header TransactionP.h, but no one outside the engine should include that file. Instead, access that data only through the functions in Transaction.h .
Definition at line 144 of file gnc-engine.h.
| typedef GList SplitList |
GList of Split
Definition at line 203 of file gnc-engine.h.
| typedef struct transaction_s Transaction |
Transaction in Gnucash. A Transaction is a piece of business done; the transfer of money from one account to one or more other accounts. Each Transaction is divided into one or more Splits (usually two).
This is the typename for a transaction. The actual structure is defined in the private header TransactionP.h, but no one outside the engine should include that file. Instead, access that data only through the functions in Transaction.h .
Definition at line 155 of file gnc-engine.h.
| typedef GList TransList |
GList of Transaction
Definition at line 205 of file gnc-engine.h.
| enum GNCPlaceholderType |
DOCUMENT ME!
Definition at line 1087 of file Account.h.
{
PLACEHOLDER_NONE,
PLACEHOLDER_THIS,
PLACEHOLDER_CHILD,
} GNCPlaceholderType;
| gnc_commodity* DxaccAccountGetCurrency | ( | const Account * | account | ) |
Definition at line 2951 of file Account.c.
{
KvpValue *v;
const char *s;
gnc_commodity_table *table;
if (!acc) return NULL;
v = kvp_frame_get_slot(acc->inst.kvp_data, "old-currency");
if (!v) return NULL;
s = kvp_value_get_string (v);
if (!s) return NULL;
table = gnc_commodity_table_get_table (qof_instance_get_book(acc));
return gnc_commodity_table_lookup_unique (table, s);
}
| const char* dxaccAccountGetQuoteTZ | ( | const Account * | account | ) |
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.
Definition at line 4287 of file Account.c.
{
if (!acc) return NULL;
if (xaccAccountIsPriced(acc))
{
KvpValue *value = kvp_frame_get_slot(acc->inst.kvp_data, "old-quote-tz");
if (value) return (kvp_value_get_string(value));
}
return NULL;
}
| void DxaccAccountSetCurrency | ( | Account * | account, |
| gnc_commodity * | currency | ||
| ) |
These two funcs take control of their gnc_commodity args. Don't free
Definition at line 2321 of file Account.c.
{
QofBook *book;
const char *string;
gnc_commodity *commodity;
if ((!acc) || (!currency)) return;
xaccAccountBeginEdit(acc);
string = gnc_commodity_get_unique_name (currency);
kvp_frame_set_slot_nc(acc->inst.kvp_data, "old-currency",
kvp_value_new_string(string));
mark_account (acc);
xaccAccountCommitEdit(acc);
commodity = DxaccAccountGetCurrency (acc);
if (!commodity)
{
book = qof_instance_get_book(acc);
gnc_commodity_table_insert (gnc_commodity_table_get_table (book), currency);
}
}
| void dxaccAccountSetQuoteTZ | ( | Account * | account, |
| const char * | tz | ||
| ) |
Set 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.
Definition at line 4267 of file Account.c.
{
if (!acc) return;
xaccAccountBeginEdit(acc);
if (xaccAccountIsPriced(acc))
{
kvp_frame_set_slot_nc(acc->inst.kvp_data,
"old-quote-tz",
tz ? kvp_value_new_string(tz) : NULL);
mark_account (acc);
}
qof_instance_set_dirty(&acc->inst);
xaccAccountCommitEdit(acc);
}
The gnc_account_lookup_full_name() subroutine works like gnc_account_lookup_by_name, but uses the account code.
Definition at line 2659 of file Account.c.
{
AccountPrivate *cpriv, *ppriv;
Account *child, *result;
GList *node;
g_return_val_if_fail(GNC_IS_ACCOUNT(parent), NULL);
g_return_val_if_fail(code, NULL);
/* first, look for accounts hanging off the current node */
ppriv = GET_PRIVATE(parent);
for (node = ppriv->children; node; node = node->next)
{
child = node->data;
cpriv = GET_PRIVATE(child);
if (safe_strcmp(cpriv->accountCode, code) == 0)
return child;
}
/* if we are still here, then we haven't found the account yet.
* Recursively search each of the child accounts next */
for (node = ppriv->children; node; node = node->next)
{
child = node->data;
result = gnc_account_lookup_by_code (child, code);
if (result)
return result;
}
return NULL;
}
The gnc_account_lookup_full_name() subroutine works like gnc_account_lookup_by_name, but uses fully-qualified names using the given separator.
Definition at line 2738 of file Account.c.
{
const AccountPrivate *rpriv;
const Account *root;
Account *found;
gchar **names;
g_return_val_if_fail(GNC_IS_ACCOUNT(any_acc), NULL);
g_return_val_if_fail(name, NULL);
root = any_acc;
rpriv = GET_PRIVATE(root);
while (rpriv->parent)
{
root = rpriv->parent;
rpriv = GET_PRIVATE(root);
}
names = g_strsplit(name, gnc_get_account_separator_string(), -1);
found = gnc_account_lookup_by_full_name_helper(root, names);
g_strfreev(names);
return found;
}
The gnc_account_lookup_by_name() subroutine fetches the account by name from the descendants of the specified account. The immediate children are searched first. If there is no match,, then a recursive search of all descendants is performed looking for a match.
Definition at line 2626 of file Account.c.
{
AccountPrivate *cpriv, *ppriv;
Account *child, *result;
GList *node;
g_return_val_if_fail(GNC_IS_ACCOUNT(parent), NULL);
g_return_val_if_fail(name, NULL);
/* first, look for accounts hanging off the current node */
ppriv = GET_PRIVATE(parent);
for (node = ppriv->children; node; node = node->next)
{
child = node->data;
cpriv = GET_PRIVATE(child);
if (safe_strcmp(cpriv->accountName, name) == 0)
return child;
}
/* if we are still here, then we haven't found the account yet.
* Recursively search each of the child accounts next */
for (node = ppriv->children; node; node = node->next)
{
child = node->data;
result = gnc_account_lookup_by_name (child, name);
if (result)
return result;
}
return NULL;
}
| void gnc_account_tree_begin_staged_transaction_traversals | ( | Account * | acc | ) |
gnc_account_tree_begin_staged_transaction_traversals() resets the traversal marker inside every transactions of every account in the account tree originating with the specified node. This is done so that a new sequence of staged traversals can begin.
Definition at line 4549 of file Account.c.
{
GList *descendants;
descendants = gnc_account_get_descendants(account);
g_list_foreach(descendants, (GFunc)do_one_account, NULL);
g_list_free(descendants);
}
| int gnc_account_tree_staged_transaction_traversal | ( | const Account * | account, |
| unsigned int | stage, | ||
| TransactionCallback | thunk, | ||
| void * | data | ||
| ) |
gnc_account_tree_staged_transaction_traversal() calls thunk on each transaction in the group whose current marker is less than the given stage and updates each transaction's marker to be stage. The traversal will stop if thunk returns a non-zero value. gnc_account_tree_staged_transaction_traversal() function will return zero or the non-zero value returned by thunk. This API does not handle handle recursive traversals.
Definition at line 4599 of file Account.c.
{
const AccountPrivate *priv;
GList *acc_p, *split_p;
Transaction *trans;
Split *s;
int retval;
if (!acc) return 0;
/* depth first traversal */
priv = GET_PRIVATE(acc);
for (acc_p = priv->children; acc_p; acc_p = g_list_next(acc_p))
{
retval = gnc_account_tree_staged_transaction_traversal(acc_p->data, stage,
thunk, cb_data);
if (retval) return retval;
}
/* Now this account */
for (split_p = priv->splits; split_p; split_p = g_list_next(split_p))
{
s = split_p->data;
trans = s->parent;
if (trans && (trans->marker < stage))
{
trans->marker = stage;
if (thunk)
{
retval = thunk(trans, cb_data);
if (retval) return retval;
}
}
}
return 0;
}
| void gnc_engine_add_commit_error_callback | ( | EngineCommitErrorCallback | cb, |
| gpointer | data | ||
| ) |
Set a callback function to be called in case an engine commit fails
Definition at line 197 of file gnc-engine.c.
{
g_error_cb = cb;
g_error_cb_data = data;
}
| void gnc_engine_add_init_hook | ( | gnc_engine_init_hook_t | hook | ) |
Pass a function pointer to gnc_engine_add_init_hook and it will be called during the evaluation of gnc_engine_init
Definition at line 173 of file gnc-engine.c.
{
engine_init_hooks = g_list_append(engine_init_hooks, (gpointer)h);
}
| void gnc_engine_init | ( | int | argc, |
| char ** | argv | ||
| ) |
PROTOTYPES gnc_engine_init should be called before gnc engine functions can be used - see also qof_init for a method that does not require Guile.
Definition at line 139 of file gnc-engine.c.
{
gnc_engine_init_part1();
gnc_engine_init_part2();
gnc_engine_init_part3(argc, argv);
}
| void gnc_engine_init_static | ( | int | argc, |
| char ** | argv | ||
| ) |
This is the statically linked-in version of gnc_engine_init. It is identically to that function except that it doesn't load the loadable shared module, which means this function will not load the "(gnucash engine)" scheme module.
Definition at line 147 of file gnc-engine.c.
{
gnc_engine_init_part1();
gnc_engine_init_part3(argc, argv);
}
| gboolean gnc_engine_is_initialized | ( | void | ) |
check the engine is fully initialized
Definition at line 179 of file gnc-engine.c.
{
return (engine_is_initialized == 1) ? TRUE : FALSE;
}
| void gnc_engine_shutdown | ( | void | ) |
Called to shutdown the engine, see also qof_close for use without Guile.
Definition at line 160 of file gnc-engine.c.
{
qof_log_shutdown();
qof_close();
engine_is_initialized = 0;
}
| void gnc_log_default | ( | void | ) |
enable default log modules
Definition at line 189 of file gnc-engine.c.
{
qof_log_set_default(QOF_LOG_WARNING);
qof_log_set_level(GNC_MOD_ROOT, QOF_LOG_WARNING);
qof_log_set_level(GNC_MOD_TEST, QOF_LOG_DEBUG);
}
| void xaccAccountBeginStagedTransactionTraversals | ( | const Account * | account | ) |
xaccAccountBeginStagedTransactionTraversals() resets the traversal marker for each transaction which is a parent of one of the splits in the account.
Definition at line 4511 of file Account.c.
{
AccountPrivate *priv;
if (!account)
return;
priv = GET_PRIVATE(account);
xaccSplitsBeginStagedTransactionTraversals(priv->splits);
}
| void xaccAccountClearReconcilePostpone | ( | Account * | account | ) |
DOCUMENT ME!
Definition at line 4157 of file Account.c.
{
if (!acc) return;
xaccAccountBeginEdit (acc);
kvp_frame_set_value (acc->inst.kvp_data, "reconcile-info/postpone", NULL);
mark_account (acc);
xaccAccountCommitEdit (acc);
}
| LotList* xaccAccountFindOpenLots | ( | const Account * | acc, |
| gboolean(*)(GNCLot *lot, gpointer user_data) | match_func, | ||
| gpointer | user_data, | ||
| GCompareFunc | sort_func | ||
| ) |
Find a list of open lots that match the match_func. Sort according to sort_func. If match_func is NULL, then all open lots are returned. If sort_func is NULL, then the returned list has no particular order. The caller must free to returned list.
Definition at line 3521 of file Account.c.
{
AccountPrivate *priv;
GList *lot_list;
GList *retval = NULL;
g_return_val_if_fail(GNC_IS_ACCOUNT(acc), NULL);
priv = GET_PRIVATE(acc);
for (lot_list = priv->lots; lot_list; lot_list = lot_list->next)
{
GNCLot *lot = lot_list->data;
/* If this lot is closed, then ignore it */
if (gnc_lot_is_closed (lot))
continue;
if (match_func && !(match_func)(lot, user_data))
continue;
/* Ok, this is a valid lot. Add it to our list of lots */
if (sort_func)
retval = g_list_insert_sorted (retval, lot, sort_func);
else
retval = g_list_prepend (retval, lot);
}
return retval;
}
| Transaction* xaccAccountFindTransByDesc | ( | const Account * | account, |
| const char * | description | ||
| ) |
Returns a pointer to the transaction, not a copy.
Definition at line 4386 of file Account.c.
{
Transaction *trans;
/* Get the translation matching the description. */
finder_help_function(acc, description, NULL, &trans);
return trans;
}
| gpointer xaccAccountForEachLot | ( | const Account * | acc, |
| gpointer(*)(GNCLot *lot, gpointer user_data) | proc, | ||
| gpointer | user_data | ||
| ) |
The xaccAccountForEachLot() method will apply the function 'proc' to each lot in the account. If 'proc' returns a non-NULL value, further application will be stopped, and the resulting value will be returned. There is no guaranteed order over which the Lots will be traversed.
| gint xaccAccountForEachTransaction | ( | const Account * | account, |
| TransactionCallback | proc, | ||
| void * | data | ||
| ) |
The xaccAccountForEachTransaction() routine will traverse all of the transactions in account and call the callback function proc on each transaction. Processing will continue if-and-only-if proc returns 0. The user data pointer data will be passed on to the callback function proc.
This function does not descend recursively to traverse transactions in child accounts.
proc will be called exactly once for each transaction that is pointed to by at least one split in the given account.
The result of this function will be 0 if and only if every relevant transaction was traversed exactly once. Else the return value is the last non-zero value returned by proc.
Definition at line 4656 of file Account.c.
{
if (!acc || !proc) return 0;
xaccAccountBeginStagedTransactionTraversals (acc);
return xaccAccountStagedTransactionTraversal(acc, 42, proc, data);
}
| GNCPlaceholderType xaccAccountGetDescendantPlaceholder | ( | const Account * | account | ) |
Returns PLACEHOLDER_NONE if account is NULL or neither account nor any descendant 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.
Definition at line 3705 of file Account.c.
{
GList *descendants, *node;
GNCPlaceholderType ret = PLACEHOLDER_NONE;
g_return_val_if_fail(GNC_IS_ACCOUNT(acc), PLACEHOLDER_NONE);
if (xaccAccountGetPlaceholder(acc)) return PLACEHOLDER_THIS;
descendants = gnc_account_get_descendants(acc);
for (node = descendants; node; node = node->next)
if (xaccAccountGetPlaceholder((Account *) node->data))
{
ret = PLACEHOLDER_CHILD;
break;
}
g_list_free(descendants);
return ret;
}
| gboolean xaccAccountGetHidden | ( | const Account * | acc | ) |
Get the "hidden" flag for an account. If this flag is set then the account (and any children) will be hidden from the user unless they explicitly ask to see them.
| acc | The account whose flag should be retrieved. |
Definition at line 3729 of file Account.c.
{
const char *str;
g_return_val_if_fail(GNC_IS_ACCOUNT(acc), FALSE);
str = kvp_frame_get_string(acc->inst.kvp_data, "hidden");
return (str && !strcmp(str, "true"));
}
The xaccAccountGetLotList() routine returns a list of all lots in this account.
| account | The account whose lots should be returned. |
Definition at line 3514 of file Account.c.
{
g_return_val_if_fail(GNC_IS_ACCOUNT(acc), NULL);
return g_list_copy(GET_PRIVATE(acc)->lots);
}
| gboolean xaccAccountGetPlaceholder | ( | const Account * | account | ) |
Get the "placeholder" flag for an account. If this flag is set then the account may not be modified by the user.
| account | The account whose flag should be retrieved. |
Definition at line 3682 of file Account.c.
{
const char *str;
g_return_val_if_fail(GNC_IS_ACCOUNT(acc), FALSE);
str = kvp_frame_get_string(acc->inst.kvp_data, "placeholder");
return (str && !strcmp(str, "true"));
}
| gboolean xaccAccountGetReconcileLastDate | ( | const Account * | account, |
| time_t * | last_date | ||
| ) |
DOCUMENT ME!
Definition at line 3998 of file Account.c.
{
KvpValue *v;
if (!acc) return FALSE;
v = kvp_frame_get_value(acc->inst.kvp_data, "reconcile-info/last-date");
if (!v || kvp_value_get_type(v) != KVP_TYPE_GINT64)
return FALSE;
if (last_date)
*last_date = kvp_value_get_gint64(v);
return TRUE;
}
| gboolean xaccAccountGetReconcileLastInterval | ( | const Account * | account, |
| int * | months, | ||
| int * | days | ||
| ) |
DOCUMENT ME!
Definition at line 4034 of file Account.c.
{
KvpValue *v1, *v2;
if (!acc) return FALSE;
v1 = kvp_frame_get_value(acc->inst.kvp_data,
"reconcile-info/last-interval/months");
v2 = kvp_frame_get_value(acc->inst.kvp_data,
"reconcile-info/last-interval/days");
if (!v1 || (kvp_value_get_type (v1) != KVP_TYPE_GINT64) ||
!v2 || (kvp_value_get_type (v2) != KVP_TYPE_GINT64))
return FALSE;
if (months)
*months = kvp_value_get_gint64 (v1);
if (days)
*days = kvp_value_get_gint64 (v2);
return TRUE;
}
| gboolean xaccAccountGetReconcilePostponeBalance | ( | const Account * | account, |
| gnc_numeric * | balance | ||
| ) |
DOCUMENT ME!
Definition at line 4119 of file Account.c.
{
KvpValue *v;
if (!acc) return FALSE;
v = kvp_frame_get_value(acc->inst.kvp_data,
"reconcile-info/postpone/balance");
if (!v || kvp_value_get_type (v) != KVP_TYPE_NUMERIC)
return FALSE;
if (balance)
*balance = kvp_value_get_numeric (v);
return TRUE;
}
| gboolean xaccAccountGetReconcilePostponeDate | ( | const Account * | account, |
| time_t * | postpone_date | ||
| ) |
DOCUMENT ME!
Definition at line 4082 of file Account.c.
{
KvpValue *v;
if (!acc) return FALSE;
v = kvp_frame_get_value(acc->inst.kvp_data, "reconcile-info/postpone/date");
if (!v || kvp_value_get_type (v) != KVP_TYPE_GINT64)
return FALSE;
if (postpone_date)
*postpone_date = kvp_value_get_gint64 (v);
return TRUE;
}
The xaccAccountGetSplitList() routine returns a pointer to a GList of the splits in the account.
Definition at line 3506 of file Account.c.
{
g_return_val_if_fail(GNC_IS_ACCOUNT(acc), NULL);
xaccAccountSortSplits((Account*)acc, FALSE); // normally a noop
return GET_PRIVATE(acc)->splits;
}
| gboolean xaccAccountGetTaxRelated | ( | const Account * | account | ) |
| const char* xaccAccountGetTaxUSCode | ( | const Account * | account | ) |
| gint64 xaccAccountGetTaxUSCopyNumber | ( | const Account * | account | ) |
| const char* xaccAccountGetTaxUSPayerNameSource | ( | const Account * | account | ) |
| const char* xaccAccountGetTypeStr | ( | GNCAccountType | type | ) |
The xaccAccountGetTypeStr() routine returns a string suitable for use in the GUI/Interface. These strings should be translated to the local language.
Definition at line 3907 of file Account.c.
{
if (type < 0 || NUM_ACCOUNT_TYPES <= type ) return "";
return _(account_type_name [type]);
}
The xaccAccountInsertLot() method will register the indicated lot with this account. Any splits later inserted into this lot must belong to this account. If the lot is already in another account, the lot, and all of the splits in it, will be moved from that account to this account.
Definition at line 1740 of file Account.c.
{
AccountPrivate *priv, *opriv;
Account * old_acc = NULL;
Account* lot_account;
/* errors */
g_return_if_fail(GNC_IS_ACCOUNT(acc));
g_return_if_fail(GNC_IS_LOT(lot));
/* optimizations */
lot_account = gnc_lot_get_account(lot);
if (lot_account == acc)
return;
ENTER ("(acc=%p, lot=%p)", acc, lot);
/* pull it out of the old account */
if (lot_account)
{
old_acc = lot_account;
opriv = GET_PRIVATE(old_acc);
opriv->lots = g_list_remove(opriv->lots, lot);
}
priv = GET_PRIVATE(acc);
priv->lots = g_list_prepend(priv->lots, lot);
gnc_lot_set_account(lot, acc);
/* Don't move the splits to the new account. The caller will do this
* if appropriate, and doing it here will not work if we are being
* called from gnc_book_close_period since xaccAccountInsertSplit
* will try to balance capital gains and things aren't ready for that. */
qof_event_gen (QOF_INSTANCE(lot), QOF_EVENT_ADD, NULL);
qof_event_gen (&acc->inst, QOF_EVENT_MODIFY, NULL);
LEAVE ("(acc=%p, lot=%p)", acc, lot);
}
| gboolean xaccAccountIsHidden | ( | const Account * | acc | ) |
Should this account be "hidden". If this flag is set for this account (or any parent account) then the account should be hidden from the user unless they explicitly ask to see it. This function is different from the xaccAccountGetHidden() function because it checks the flag in parent accounts in addition to this account.
| acc | The account whose flag should be retrieved. |
Definition at line 3752 of file Account.c.
{
AccountPrivate *priv;
g_return_val_if_fail(GNC_IS_ACCOUNT(acc), FALSE);
if (xaccAccountGetHidden(acc))
return TRUE;
priv = GET_PRIVATE(acc);
while ((acc = priv->parent) != NULL)
{
priv = GET_PRIVATE(acc);
if (xaccAccountGetHidden(acc))
return TRUE;
}
return FALSE;
}
The xaccAccountMoveAllSplits() routine reassigns each of the splits in accfrom to accto.
Definition at line 1800 of file Account.c.
{
AccountPrivate *from_priv, *to_priv;
/* errors */
g_return_if_fail(GNC_IS_ACCOUNT(accfrom));
g_return_if_fail(GNC_IS_ACCOUNT(accto));
/* optimizations */
from_priv = GET_PRIVATE(accfrom);
to_priv = GET_PRIVATE(accto);
if (!from_priv->splits || accfrom == accto)
return;
/* check for book mix-up */
g_return_if_fail (qof_instance_books_equal(accfrom, accto));
ENTER ("(accfrom=%p, accto=%p)", accfrom, accto);
xaccAccountBeginEdit(accfrom);
xaccAccountBeginEdit(accto);
/* Begin editing both accounts and all transactions in accfrom. */
g_list_foreach(from_priv->splits, (GFunc)xaccPreSplitMove, NULL);
/* Concatenate accfrom's lists of splits and lots to accto's lists. */
//to_priv->splits = g_list_concat(to_priv->splits, from_priv->splits);
//to_priv->lots = g_list_concat(to_priv->lots, from_priv->lots);
/* Set appropriate flags. */
//from_priv->balance_dirty = TRUE;
//from_priv->sort_dirty = FALSE;
//to_priv->balance_dirty = TRUE;
//to_priv->sort_dirty = TRUE;
/*
* Change each split's account back pointer to accto.
* Convert each split's amount to accto's commodity.
* Commit to editing each transaction.
*/
g_list_foreach(from_priv->splits, (GFunc)xaccPostSplitMove, (gpointer)accto);
/* Finally empty accfrom. */
g_assert(from_priv->splits == NULL);
g_assert(from_priv->lots == NULL);
xaccAccountCommitEdit(accfrom);
xaccAccountCommitEdit(accto);
LEAVE ("(accfrom=%p, accto=%p)", accfrom, accto);
}
| void xaccAccountSetHidden | ( | Account * | acc, |
| gboolean | val | ||
| ) |
Set the "hidden" flag for an account. If this flag is set then the account (and any children) will be hidden from the user unless they explicitly ask to see them.
| acc | The account whose flag should be retrieved. |
| val | The new state for the account's "hidden" flag. |
Definition at line 3740 of file Account.c.
{
g_return_if_fail(GNC_IS_ACCOUNT(acc));
xaccAccountBeginEdit (acc);
kvp_frame_set_string (acc->inst.kvp_data, "hidden",
val ? "true" : NULL);
mark_account (acc);
xaccAccountCommitEdit (acc);
}
| void xaccAccountSetMark | ( | Account * | account, |
| short | mark | ||
| ) |
Set a mark on the account. The meaning of this mark is completely undefined. Its presented here as a utility for the programmer, to use as desired. Handy for performing customer traversals 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.
Definition at line 1659 of file Account.c.
{
AccountPrivate *priv;
g_return_if_fail(GNC_IS_ACCOUNT(acc));
priv = GET_PRIVATE(acc);
priv->mark = m;
}
| void xaccAccountSetPlaceholder | ( | Account * | account, |
| gboolean | val | ||
| ) |
Set the "placeholder" flag for an account. If this flag is set then the account may not be modified by the user.
| account | The account whose flag should be retrieved. |
| val | The new state for the account's "placeholder" flag. |
Definition at line 3693 of file Account.c.
{
g_return_if_fail(GNC_IS_ACCOUNT(acc));
xaccAccountBeginEdit (acc);
kvp_frame_set_string (acc->inst.kvp_data,
"placeholder", val ? "true" : NULL);
mark_account (acc);
xaccAccountCommitEdit (acc);
}
| void xaccAccountSetReconcileLastDate | ( | Account * | account, |
| time_t | last_date | ||
| ) |
DOCUMENT ME!
Definition at line 4019 of file Account.c.
{
if (!acc) return;
xaccAccountBeginEdit (acc);
kvp_frame_set_gint64 (acc->inst.kvp_data,
"/reconcile-info/last-date", last_date);
mark_account (acc);
xaccAccountCommitEdit (acc);
}
| void xaccAccountSetReconcileLastInterval | ( | Account * | account, |
| int | months, | ||
| int | days | ||
| ) |
DOCUMENT ME!
Definition at line 4060 of file Account.c.
{
KvpFrame *frame;
if (!acc) return;
xaccAccountBeginEdit (acc);
frame = kvp_frame_get_frame_slash (acc->inst.kvp_data,
"/reconcile-info/last-interval");
g_assert(frame);
kvp_frame_set_gint64 (frame, "months", months);
kvp_frame_set_gint64 (frame, "days", days);
mark_account (acc);
xaccAccountCommitEdit (acc);
}
| void xaccAccountSetReconcilePostponeBalance | ( | Account * | account, |
| gnc_numeric | balance | ||
| ) |
DOCUMENT ME!
Definition at line 4141 of file Account.c.
{
if (!acc) return;
xaccAccountBeginEdit (acc);
kvp_frame_set_gnc_numeric (acc->inst.kvp_data,
"/reconcile-info/postpone/balance", balance);
mark_account (acc);
xaccAccountCommitEdit (acc);
}
| void xaccAccountSetReconcilePostponeDate | ( | Account * | account, |
| time_t | postpone_date | ||
| ) |
DOCUMENT ME!
Definition at line 4102 of file Account.c.
{
if (!acc) return;
xaccAccountBeginEdit (acc);
/* XXX this should be using timespecs, not gints !! */
kvp_frame_set_gint64 (acc->inst.kvp_data,
"reconcile-info/postpone/date", postpone_date);
mark_account (acc);
xaccAccountCommitEdit (acc);
}
| void xaccAccountSetTaxRelated | ( | Account * | account, |
| gboolean | tax_related | ||
| ) |
DOCUMENT ME!
Definition at line 3585 of file Account.c.
{
KvpValue *new_value;
g_return_if_fail(GNC_IS_ACCOUNT(acc));
if (tax_related)
new_value = kvp_value_new_gint64 (tax_related);
else
new_value = NULL;
xaccAccountBeginEdit (acc);
kvp_frame_set_slot_nc(acc->inst.kvp_data, "tax-related", new_value);
mark_account (acc);
xaccAccountCommitEdit (acc);
}
| void xaccAccountSetTaxUSCode | ( | Account * | account, |
| const char * | code | ||
| ) |
DOCUMENT ME!
Definition at line 3610 of file Account.c.
{
g_return_if_fail(GNC_IS_ACCOUNT(acc));
xaccAccountBeginEdit (acc);
kvp_frame_set_string (acc->inst.kvp_data, "/tax-US/code", code);
if (!code)
{
KvpFrame *frame = NULL;
kvp_frame_set_frame (acc->inst.kvp_data, "/tax-US", frame);
}
mark_account (acc);
xaccAccountCommitEdit (acc);
}
| void xaccAccountSetTaxUSCopyNumber | ( | Account * | account, |
| gint64 | copy_number | ||
| ) |
DOCUMENT ME!
Definition at line 3657 of file Account.c.
{
g_return_if_fail(GNC_IS_ACCOUNT(acc));
xaccAccountBeginEdit (acc);
if (copy_number != 0)
kvp_frame_set_gint64 (acc->inst.kvp_data, "/tax-US/copy-number", copy_number);
else
{
KvpFrame * frame;
KvpValue *value;
value = NULL;
frame = kvp_frame_set_value_nc (acc->inst.kvp_data,
"/tax-US/copy-number", value);
if (!frame) kvp_value_delete (value);
}
mark_account (acc);
xaccAccountCommitEdit (acc);
}
| void xaccAccountSetTaxUSPayerNameSource | ( | Account * | account, |
| const char * | source | ||
| ) |
DOCUMENT ME!
Definition at line 3634 of file Account.c.
{
g_return_if_fail(GNC_IS_ACCOUNT(acc));
xaccAccountBeginEdit (acc);
kvp_frame_set_string (acc->inst.kvp_data,
"/tax-US/payer-name-source", source);
mark_account (acc);
xaccAccountCommitEdit (acc);
}
| int xaccAccountStagedTransactionTraversal | ( | const Account * | a, |
| unsigned int | stage, | ||
| TransactionCallback | thunk, | ||
| void * | data | ||
| ) |
xaccAccountStagedTransactionTraversal() calls thunk on each transaction in account a whose current marker is less than the given stage and updates each transaction's marker to be stage. The traversal will stop if thunk returns a non-zero value. xaccAccountStagedTransactionTraversal() function will return zero or the non-zero value returned by thunk. This API does not handle handle recursive traversals.
Definition at line 4559 of file Account.c.
{
AccountPrivate *priv;
GList *split_p;
GList *next;
Transaction *trans;
Split *s;
int retval;
if (!acc) return 0;
priv = GET_PRIVATE(acc);
for (split_p = priv->splits; split_p; split_p = next)
{
/* Get the next element in the split list now, just in case some
* naughty thunk destroys the one we're using. This reduces, but
* does not eliminate, the possibility of undefined results if
* a thunk removes splits from this account. */
next = g_list_next(split_p);
s = split_p->data;
trans = s->parent;
if (trans && (trans->marker < stage))
{
trans->marker = stage;
if (thunk)
{
retval = thunk(trans, cb_data);
if (retval) return retval;
}
}
}
return 0;
}
| GNCAccountType xaccAccountStringToEnum | ( | const char * | str | ) |
Conversion routines for the account types to/from strings that are used in persistent storage, communications. These strings should *not* be translated to the local language. Typical conversion is "INCOME" -> ACCT_TYPE_INCOME.
Definition at line 3868 of file Account.c.
{
GNCAccountType type;
gboolean rc;
rc = xaccAccountStringToType(str, &type);
if (FALSE == rc) return ACCT_TYPE_INVALID;
return type;
}
| gboolean xaccAccountStringToType | ( | const char * | str, |
| GNCAccountType * | type | ||
| ) |
Conversion routines for the account types to/from strings that are used in persistent storage, communications. These strings should *not* be translated to the local language. Typical conversion is "INCOME" -> ACCT_TYPE_INCOME.
Definition at line 3834 of file Account.c.
{
GNC_RETURN_ON_MATCH(NONE);
GNC_RETURN_ON_MATCH(BANK);
GNC_RETURN_ON_MATCH(CASH);
GNC_RETURN_ON_MATCH(CREDIT);
GNC_RETURN_ON_MATCH(ASSET);
GNC_RETURN_ON_MATCH(LIABILITY);
GNC_RETURN_ON_MATCH(STOCK);
GNC_RETURN_ON_MATCH(MUTUAL);
GNC_RETURN_ON_MATCH(CURRENCY);
GNC_RETURN_ON_MATCH(INCOME);
GNC_RETURN_ON_MATCH(EXPENSE);
GNC_RETURN_ON_MATCH(EQUITY);
GNC_RETURN_ON_MATCH(RECEIVABLE);
GNC_RETURN_ON_MATCH(PAYABLE);
GNC_RETURN_ON_MATCH(ROOT);
GNC_RETURN_ON_MATCH(TRADING);
GNC_RETURN_ON_MATCH(CHECKING);
GNC_RETURN_ON_MATCH(SAVINGS);
GNC_RETURN_ON_MATCH(MONEYMRKT);
GNC_RETURN_ON_MATCH(CREDITLINE);
PERR("asked to translate unknown account type string %s.\n",
str ? str : "(null)");
return(FALSE);
}
| int xaccAccountTreeForEachTransaction | ( | Account * | acc, |
| TransactionCallback | proc, | ||
| void * | data | ||
| ) |
Traverse all of the transactions in the given account group. Continue processing IF proc returns 0. This function will descend recursively to traverse transactions in the children of the accounts in the group.
Proc will be called exactly once for each transaction that is pointed to by at least one split in any account in the hierarchy topped by the root Account acc.
The result of this function will be 0 IF every relevant transaction was traversed exactly once; otherwise, the return value is the last non-zero value returned by the callback.
Note that this routine is just a trivial wrapper for
gnc_account_tree_begin_staged_transaction_traversals(g); gnc_account_tree_staged_transaction_traversal(g, 42, proc, data);
| const char* xaccAccountTypeEnumAsString | ( | GNCAccountType | type | ) |
Conversion routines for the account types to/from strings that are used in persistent storage, communications. These strings should *not* be translated to the local language. Typical conversion is ACCT_TYPE_INCOME -> "INCOME".
Definition at line 3797 of file Account.c.
{
switch (type)
{
GNC_RETURN_ENUM_AS_STRING(NONE);
GNC_RETURN_ENUM_AS_STRING(BANK);
GNC_RETURN_ENUM_AS_STRING(CASH);
GNC_RETURN_ENUM_AS_STRING(CREDIT);
GNC_RETURN_ENUM_AS_STRING(ASSET);
GNC_RETURN_ENUM_AS_STRING(LIABILITY);
GNC_RETURN_ENUM_AS_STRING(STOCK);
GNC_RETURN_ENUM_AS_STRING(MUTUAL);
GNC_RETURN_ENUM_AS_STRING(CURRENCY);
GNC_RETURN_ENUM_AS_STRING(INCOME);
GNC_RETURN_ENUM_AS_STRING(EXPENSE);
GNC_RETURN_ENUM_AS_STRING(EQUITY);
GNC_RETURN_ENUM_AS_STRING(RECEIVABLE);
GNC_RETURN_ENUM_AS_STRING(PAYABLE);
GNC_RETURN_ENUM_AS_STRING(ROOT);
GNC_RETURN_ENUM_AS_STRING(TRADING);
GNC_RETURN_ENUM_AS_STRING(CHECKING);
GNC_RETURN_ENUM_AS_STRING(SAVINGS);
GNC_RETURN_ENUM_AS_STRING(MONEYMRKT);
GNC_RETURN_ENUM_AS_STRING(CREDITLINE);
default:
PERR ("asked to translate unknown account type %d.\n", type);
break;
}
return(NULL);
}
| gboolean xaccAccountTypesCompatible | ( | GNCAccountType | parent_type, |
| GNCAccountType | child_type | ||
| ) |
Return TRUE if accounts of type parent_type can have accounts of type child_type as children.
Definition at line 3964 of file Account.c.
{
return ((xaccParentAccountTypesCompatibleWith (parent_type) &
(1 << child_type))
!= 0);
}
| guint32 xaccAccountTypesValid | ( | void | ) |
Returns the bitmask of the account type enums that are valid. Deprecated and root account types are stripped.
Definition at line 3973 of file Account.c.
{
guint32 mask = (1 << NUM_ACCOUNT_TYPES) - 1;
mask &= ~((1 << ACCT_TYPE_CURRENCY) | /* DEPRECATED */
(1 << ACCT_TYPE_ROOT)); /* ROOT */
return mask;
}
| void xaccClearMark | ( | Account * | account, |
| short | val | ||
| ) |
Get the mark set by xaccAccountSetMark short xaccAccountGetMark (const Account *account); The xaccClearMark will find the root account, and clear the mark in the entire account tree.
Definition at line 1670 of file Account.c.
{
Account *root;
g_return_if_fail(GNC_IS_ACCOUNT(acc));
root = gnc_account_get_root(acc);
xaccClearMarkDown(root ? root : acc, val);
}
| void xaccClearMarkDown | ( | Account * | account, |
| short | val | ||
| ) |
The xaccClearMarkDown will clear the mark only in this and in sub-accounts.
Definition at line 1681 of file Account.c.
{
AccountPrivate *priv;
GList *node;
g_return_if_fail(GNC_IS_ACCOUNT(acc));
priv = GET_PRIVATE(acc);
priv->mark = val;
for (node = priv->children; node; node = node->next)
{
xaccClearMarkDown(node->data, val);
}
}
| guint32 xaccParentAccountTypesCompatibleWith | ( | GNCAccountType | type | ) |
Return the bitmask of parent account types compatible with a given type.
Definition at line 3917 of file Account.c.
{
switch (type)
{
case ACCT_TYPE_BANK:
case ACCT_TYPE_CASH:
case ACCT_TYPE_ASSET:
case ACCT_TYPE_STOCK:
case ACCT_TYPE_MUTUAL:
case ACCT_TYPE_CURRENCY:
case ACCT_TYPE_CREDIT:
case ACCT_TYPE_LIABILITY:
case ACCT_TYPE_RECEIVABLE:
case ACCT_TYPE_PAYABLE:
return
(1 << ACCT_TYPE_BANK) |
(1 << ACCT_TYPE_CASH) |
(1 << ACCT_TYPE_ASSET) |
(1 << ACCT_TYPE_STOCK) |
(1 << ACCT_TYPE_MUTUAL) |
(1 << ACCT_TYPE_CURRENCY) |
(1 << ACCT_TYPE_CREDIT) |
(1 << ACCT_TYPE_LIABILITY) |
(1 << ACCT_TYPE_RECEIVABLE) |
(1 << ACCT_TYPE_PAYABLE) |
(1 << ACCT_TYPE_ROOT);
case ACCT_TYPE_INCOME:
case ACCT_TYPE_EXPENSE:
return
(1 << ACCT_TYPE_INCOME) |
(1 << ACCT_TYPE_EXPENSE) |
(1 << ACCT_TYPE_ROOT);
case ACCT_TYPE_EQUITY:
return
(1 << ACCT_TYPE_EQUITY) |
(1 << ACCT_TYPE_ROOT);
case ACCT_TYPE_TRADING:
return
(1 << ACCT_TYPE_TRADING) |
(1 << ACCT_TYPE_ROOT);
default:
PERR("bad account type: %d", type);
return 0;
}
}
| void xaccSplitsBeginStagedTransactionTraversals | ( | SplitList * | splits | ) |
xaccSplitsBeginStagedTransactionTraversals() resets the traversal marker for each transaction which is a parent of one of the splits in the list.
Definition at line 4495 of file Account.c.
{
GList *lp;
for (lp = splits; lp; lp = lp->next)
{
Split *s = lp->data;
Transaction *trans = s->parent;
if (trans)
trans->marker = 0;
}
}
| gboolean xaccTransactionTraverse | ( | Transaction * | trans, |
| int | stage | ||
| ) |
xaccTransactionTraverse() checks the stage of the given transaction. If the transaction hasn't reached the given stage, the transaction is updated to that stage and the function returns TRUE. Otherwise no change is made and the function returns FALSE.
Definition at line 4522 of file Account.c.
{
if (trans == NULL) return FALSE;
if (trans->marker < stage)
{
trans->marker = stage;
return TRUE;
}
return FALSE;
}
1.7.4