r20081 - gnucash/trunk/src/engine - Add function for creating a new copy of an existing GncInvoice.
Derek Atkins
warlord at MIT.EDU
Thu Jan 13 10:47:51 EST 2011
Christian Stimming <stimming at tuhh.de> writes:
> Even worse, the semantics of those functions are also vastly
> different: Some of the *Clone functions are intended to create a
> duplicate of the source object but in a different QofBook, including
> setting kvp values with the GUID of the old in the new object and vice
> versa, i.e. gncCloneInvoice(). Not quite what I would call a "clone".
> OTOH xaccTransClone() and xaccSplitClone() are "normal" deep copy
> constructors, but xaccCloneAccount() is not, and
> xaccCloneAccountSimple() also is not. Gee.
We should make sure that we're consistent. If xaccFooClone() does one
thing and xaccBarClone() does a different thing it could lead to
confusion. We should rename and standardize on that Clone(), Copy(),
Duplicate(), etc do/mean.
> In my case, the use case for the function is a button "Duplicate this
> invoice", so the invoice and all its content should be duplicated
> inside the same QofBook and will subsequently be edited so that it can
> be distinguished from the original invoice. This requires a normal
> copy constructor (deep copy).
>
> If the normal constructor function is called gncFooCreate, a standard
> copy constructor should be called gncFooCopy. All other non-standard
> functions should be named significantly different, like
> gncFooCopyIntoDifferentBook (maybe not) or gncFooOtherBookCopy (that's
> a serious proposal).
-derek
> Christian
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord at MIT.EDU PGP key available
More information about the gnucash-devel
mailing list