Update docs.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2933 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-09-23 10:11:55 +00:00
parent 49f93fe7ee
commit 9b07ec0629
2 changed files with 72 additions and 18 deletions

View File

@ -671,6 +671,18 @@ user input.
Allocate, initialize, and return a new Split. Allocate, initialize, and return a new Split.
@end deftypefun @end deftypefun
@deftypefun void xaccSplitDestroy (Split * @var{split})
Update @var{split}'s parent Account and Transaction in a consistent
manner, completely unlinking of @var{split} and freeing its memory. The
goal of this routine is to perform the removal and destruction of the
Split in an atomic fashion, with no chance of accidentally leaving the
accounting structure out-of-balance or otherwise inconsistent.
If the deletion of the Split leaves the Transaction with no Splits, then
the Transaction will be marked for deletion, but will not be deleted
until the @code{xaccTransCommitEdit()} routine is called.
@end deftypefun
@deftypefun {const GUID *} xaccSplitGetGUID (Split * @var{split}) @deftypefun {const GUID *} xaccSplitGetGUID (Split * @var{split})
Return the GUID of @var{split}. Return the GUID of @var{split}.
@end deftypefun @end deftypefun
@ -924,6 +936,50 @@ for editing.
Allocate, initialize, and return a new Transaction. Allocate, initialize, and return a new Transaction.
@end deftypefun @end deftypefun
@deftypefun void xaccTransAppendSplit (Transaction * @var{trans}, Split * @var{split})
Append @var{split} to the collection of Splits in @var{trans}. If the
Split is already a part of another Transaction, it will be removed from
that Transaction first.
@end deftypefun
@deftypefun void xaccTransDestroy (Transaction * {trans})
Remove all of the Splits from each of their accounts and free the memory
associated with them. This routine must be followed by either an
@code{xaccTransCommitEdit()} in which case the transaction memory will
be freed, or by @code{xaccTransRollbackEdit()}, in which case all the
original Splits are put back into place.
@end deftypefun
@deftypefun void xaccTransBeginEdit (Transaction * @var{trans}, gboolean @var{defer})
This method must be called before any changes are made to @var{trans} or
any of its component Splits. If this is not done, errors will result. If
@var{defer} is true, then the automated re-balancing of all Splits in
this transaction is deferred until the @code{xaccTransCommitEdit()}
call. This allows multiple splits to be edited, quantities modified,
with the whole system temporarily out of balance, up until the
Commit call is made when double-entry is once again enforced.
@end deftypefun
@deftypefun void xaccTransCommitEdit (Transaction * @var{trans})
This method indicates that the changes to @var{trans} and its Splits are
complete and should be made permanent. Note this routine may result in
the deletion of the transaction, if the Transaction is "empty" (has no
Splits) or if @code{xaccTransDestroy()} was called on the Transaction.
@end deftypefun
@deftypefun void xaccTransRollbackEdit (Transaction * @var{trans})
Rejects all changes made to @var{trans} and its Splits, and sets
@var{trans} back to where it was before the @code{xaccTransBeginEdit()}
call. This includes restoring any deleted Splits, removing any added
Splits, and undoing the effects of @code{xaccTransDestroy()}, as well
as restoring share quantities, memos, descriptions, etc.
@end deftypefun
@deftypefun gboolean xaccTransIsOpen (Transaction * @var{trans})
Return @code{TRUE} if @var{trans} is open for editing. Otherwise, it
returns @code{FALSE}.
@end deftypefun
@deftypefun {const GUID *} xaccTransGetGUID (Transaction * @var{trans}) @deftypefun {const GUID *} xaccTransGetGUID (Transaction * @var{trans})
Return the GUID of @var{trans}. Return the GUID of @var{trans}.
@end deftypefun @end deftypefun
@ -988,6 +1044,9 @@ Return the number of Splits in @var{trans}.
@node Transaction Setters, , Transaction Getters, Transactions @node Transaction Setters, , Transaction Getters, Transactions
@subsection Transaction Setters @subsection Transaction Setters
Remember, before you modify a Transaction, you must open it for editing
with @code{xaccTransBeginEdit}.
@deftypefun void xaccTransSetDate (Transaction * @var{trans}, int @var{day}, int @var{mon}, int @var{year}) @deftypefun void xaccTransSetDate (Transaction * @var{trans}, int @var{day}, int @var{mon}, int @var{year})
Set the post date of @var{trans} with @var{day}, @var{month}, and @var{year}. Set the post date of @var{trans} with @var{day}, @var{month}, and @var{year}.
@end deftypefun @end deftypefun

View File

@ -93,26 +93,24 @@ void xaccTransDestroy (Transaction *trans);
* this is not done, errors will result. If the defer flag is set, * this is not done, errors will result. If the defer flag is set,
* then the automated re-balancing of all splits in this transaction * then the automated re-balancing of all splits in this transaction
* is deferred until the xaccTransCommitEdit() call. This allows * is deferred until the xaccTransCommitEdit() call. This allows
* multiple splits to be edited, and prices fiddled with, and the whole * multiple splits to be edited, and quantities modified, and the
* system sent temporarily out of balance, up until the Commit * whole system temporarily out of balance, up until the Commit
* call is made when double-entry is once again enforced. * call is made when double-entry is once again enforced.
* *
* The xaccTransCommitEdit() method should be used to indicate that * The xaccTransCommitEdit() method indicates that the changes to the
* all of the manipulations on the transaction are complete, and * transaction and its splits are complete and should be made
* that these should be made permanent. Note that this routine * permanent. Note this routine may result in the deletion of the
* may result in the deletion of the transaction, if the transaction * transaction, if the transaction is "empty" (has no splits), or
* is "empty" (has no splits, or * has a single split in it whose * of xaccTransDestroy() was called on the transaction.
* value is non-zero.)
* *
* The xaccTransRollbackEdit() routine rejects all edits made, and * The xaccTransRollbackEdit() routine rejects all edits made, and
* sets the transaction back to where it was before the editing * sets the transaction back to where it was before the editing
* started. This includes restoring any deleted splits, removing * started. This includes restoring any deleted splits, removing
* any added splits, and undoing the effects of xaccTransDestroy, * any added splits, and undoing the effects of xaccTransDestroy,
* as well as restoring prices, memo's descriptions, etc. * as well as restoring share quantities, memos, descriptions, etc.
* *
* The xaccTransIsOpen() method returns TRUE if the transaction * The xaccTransIsOpen() method returns TRUE if the transaction
* is open for editing. Otherwise, it returns false. * is open for editing. Otherwise, it returns false. */
*/
void xaccTransBeginEdit (Transaction *trans, gboolean defer); void xaccTransBeginEdit (Transaction *trans, gboolean defer);
void xaccTransCommitEdit (Transaction *trans); void xaccTransCommitEdit (Transaction *trans);
void xaccTransRollbackEdit (Transaction *trans); void xaccTransRollbackEdit (Transaction *trans);
@ -197,13 +195,10 @@ void xaccTransAppendSplit (Transaction *trans, Split *split);
* leaving the accounting structure out-of-balance or otherwise * leaving the accounting structure out-of-balance or otherwise
* inconsistent. * inconsistent.
* *
* If the deletion of the split leaves the transaction "empty", * If the deletion of the split leaves the transaction with no
* then the transaction will be marked for deletion. (It will * splits, then the transaction will be marked for deletion. (It
* not be deleted until the xaccTransCommitEdit() routine is called.) * will not be deleted until the xaccTransCommitEdit() routine is
* The transaction is considered "empty" if it has no splits in it, * called.)
* or it has only one split left, and that split is not a price split
* (i.e. has a non-zero value). Transactions with only one split in
* them are valid if and only if the value of that split is zero.
*/ */
void xaccSplitDestroy (Split *split); void xaccSplitDestroy (Split *split);